tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: "Anthony J. Bentley" <anthony@anjbe.name>
To: tech@mdocml.bsd.lv
Subject: MathML and <mo>, <mi>, <mn>
Date: Tue, 20 Jun 2017 02:04:29 -0600	[thread overview]
Message-ID: <45090.1497945869@cathet.us> (raw)

Hi,

Consider the quadratic formula:

x={-b +- sqrt{b sup 2 - 4ac}} over 2a

Wikipedia suggests it should be rendered in MathML like so (leaving
out invisible operators):

  <mrow>
    <mi>x</mi>
    <mo>=</mo>
    <mfrac>
      <mrow>
        <mo>&#8722;</mo>
        <mi>b</mi>
        <mo>&#177;</mo>
        <msqrt>
          <msup>
            <mi>b</mi>
            <mn>2</mn>
          </msup>
          <mo>&#8722;</mo>
          <mn>4</mn>
          <mi>a</mi>
          <mi>c</mi>
        </msqrt>
      </mrow>
      <mrow>
        <mn>2</mn>
        <mi>a</mi>
      </mrow>
    </mfrac>
  </mrow>

mandoc -Thtml renders it like so:

  <mrow>
    <mi>x=</mi>
    <mfrac>
      <mrow>
        <mi>-b</mi>
        <mi>&#177;</mi>
        <msqrt>
          <mrow>
            <msup>
              <mi>b</mi>
              <mi>2</mi>
            </msup>
            <mi>&#8722;</mi>
            <mi>4ac</mi>
          </mrow>
        </msqrt>
      </mrow>
      <mi>2a</mi>
    </mfrac>
  </mrow>

A few things are noticeable here:

- mandoc only uses <mi>, not <mo> or <mn>.
- mandoc will transform a '-' into U+2212, but only when it's not
  directly adjacent to a digit.
- In Firefox, <mi> only seems to italicize single letters.

It looks like adjacent variables, numbers, and operators should be split:
    - 'x=' should become <mi>x</mi><mo>=</mo>
    - '-b' should become <mo>&#8722;</mo><mi>b</mi>
    - '-4ac' should become <mo>&#8722;</mo><mn>4</mn><mi>a</mi><mi>c</mi>

The MathML standard says (MathML 3.0 2e # 3.2.33) that "sin" is
appropriately marked up with <mi>. So <mi>sin</mi> should be enough to
correctly render eqn's mathematical words. It seems that for
non-mathematical words to be rendered with italics by default, they
should be rendered with a <mi> per letter?

-- 
Anthony J. Bentley
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

             reply	other threads:[~2017-06-20  8:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  8:04 Anthony J. Bentley [this message]
2017-06-21 20:59 ` Ingo Schwarze
2017-06-23  2:57 ` Ingo Schwarze
2017-06-23  3:22   ` Anthony J. Bentley
2017-06-23 21:24   ` Ingo Schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45090.1497945869@cathet.us \
    --to=anthony@anjbe.name \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).