0

The following script is an adaptation of Sandhu ('03) MathML Handbook, page 97 – Presentation markup / Controlling alignment (simultaneous equations). The alignment refuses to render in any of the standard browsers including Firefox Quantum (preferred browser Safari). I'm running macOS Sierra on a dual-core system. If you can get the alignment working, please let me know.

<?xml version="1.0" encoding="UTF-8"?>
<heading>Presentation markup / Tabular math</heading>
<subheading>Simultaneous equations</subheading>
<body>
  <math>
    <mtable>
      <mtr>
        <mtd>
          <mrow>
            <mn>2</mn>
            <mo>&InvisibleTimes;</mo>
            <maligngroup/><mi><malignmark/>x</mi>
            <maligngroup/><mo><malignmark/>+</mo>
            <maligngroup/><mi><malignmark/>y</mi>
            <maligngroup/><mo><malignmark/>=</mo>
            <mo>-</mo>
            <maligngroup/><mn><malignmark/>5</mn>
          </mrow>
        </mtd>
      </mtr>
      <mtr>
        <mtd>
          <mrow>
            <maligngroup/><mi><malignmark/>x</mi>
            <maligngroup/><mo><malignmark/>-</mo>
            <mn>2</mn>
            <mo>&InvisibleTimes;</mo>
            <maligngroup/><mi><malignmark/>y</mi>
            <maligngroup/><mo><malignmark/>=</mo>
            <maligngroup/><mn><malignmark/>1</mn>
          </mrow>
        </mtd>
      </mtr>
    </mtable>
  </math>
</body>

Each equation is placed in a seperate cell of a table consisting of two rows and one column. Five different parts have to be aligned in each equation indepently, so each has five alignment groups and five alignment points. A simplification of this structure is offered on the following page, but the base case first. (Chapter 3.5.5 of the W3C Mathematical Markup Language (MathML) Version 3.0 2nd Edition text works through an example that is –syntactically– a bit more opulant.)

Here is a very crude block for what the code above should produce (using the <mspace/> element):

<html>
  <math>
    <mtable>
      <mtr>
        <mtd>
          <mrow>
            <mn>2</mn>
            <mi>x</mi>
          </mrow>
        </mtd>
        <mtd>
          <mo>+</mo>
        </mtd>
        <mtd>
          <mrow>
            <mspace width="10px"/>
            <mi>y</mi>
          </mrow>
        </mtd>
        <mtd>
          <mo>=</mo>
        </mtd>
        <mtd>
          <mrow>
            <mo>-</mo>
            <mn>5</mn>
          </mrow>
        </mtd>
      </mtr>
      <mtr>
        <mtd>
          <mrow>
            <mspace width="5px"/>
            <mi>x</mi>
          </mrow>
        </mtd>
        <mtd>
          <mo>-</mo>
        </mtd>
        <mtd>
          <mrow>
            <mn>2</mn>
            <mi>y</mi>
          </mrow>
        </mtd>
        <mtd>
          <mo>=</mo>
        </mtd>
        <mtd>
          <mrow>
            <mspace width="20px"/>
            <mn>1</mn>
          </mrow>
        </mtd>
      </mtr>
    </mtable>
  </math>
</html>
  • This part of the spec is not supported in any web-oriented renderer. – Peter Krautzberger Mar 21 '18 at 12:19
  • @PeterKrautzberger thanks for your note. I was just reading through (CoCalc_SageMath)'s documentation to find out how much MathML it handles. Which is the ideal environment for rendering (experimenting with) all of its specifications? – Luqman Malik Mar 21 '18 at 18:19
  • Okay, I just found the W3C math tools Wiki... – Luqman Malik Mar 21 '18 at 18:40
  • The wiki and the spec are not maintained. The working group closed in 2016. If you need complex layout on the web, CSS is a better starting point. (But it also lacks such alignment features.) – Peter Krautzberger Mar 22 '18 at 13:40
  • @PeterKrautzberger The aim is to transform .xml "MathML" files to SVG (I updated the source script above and I did see your [related](https://stackoverflow.com/questions/34924033/convert-latex-mathml-to-svg-or-image-with-mathjax-or-similar/35430069#35430069) answer on the topic). Currently trying to use pmmL2SVG via Saxon9 processor to that end. Ran into a `main manifest attribute` error message in setting up the JAR. I'll try reaching out to Bert Bos if I can't get it working. – Luqman Malik Mar 23 '18 at 20:43
  • The answer was about MathJax. If you want to help MathJax get malignmark support, the team might be interested in contributions Just be sure to look at https://github.com/mathjax/mathjax-v3/ for the upcoming rewrite. – Peter Krautzberger Mar 24 '18 at 22:55
  • Thanks, @PeterKrautzberger. – Luqman Malik Mar 26 '18 at 07:02

0 Answers0