tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* MathML and <mo>, <mi>, <mn>
@ 2017-06-20  8:04 Anthony J. Bentley
  2017-06-21 20:59 ` Ingo Schwarze
  2017-06-23  2:57 ` Ingo Schwarze
  0 siblings, 2 replies; 5+ messages in thread
From: Anthony J. Bentley @ 2017-06-20  8:04 UTC (permalink / raw)
  To: tech

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-23 21:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-20  8:04 MathML and <mo>, <mi>, <mn> Anthony J. Bentley
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

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).