Use "columnwidth" for Cross Formula Alignment

Q

How to align columns cross multiple <mtable> elements?

✍: FYIcenter.com

A

If you have multiple equations with labels in a page, and want to align labels cross all equations, you can use the "columnwidth" attribute in <mtable> tags.

Here is an example:

To simply the following equation:
    <math display="inline" displaystyle="normal">
    <mtable columnwidth="500px auto" columnspacing="0.1in" columnalign="left">
      <mtr>
        <mtd><mi>y</mi><mo>=</mo><mfrac>
          <mrow> <msup><mi>x</mi><mn>2</mn></msup> <mo>&#x2212;</mo> <mn>4</mn> </mrow>
          <mrow> <mi>x</mi><mo>&#x2212;</mo><mn>2</mn> </mrow>
        </mfrac> </mtd>
        <mtd><mtext>(1)</mtext></mtd>
      </mtr>
    </mtable>
    </math>
we can factoring the Numerator first:
    <math display="inline" displaystyle="normal">
    <mtable columnwidth="500px auto" columnspacing="0.1in" columnalign="left">
      <mtr>
        <mtd><mi>y</mi><mo>=</mo><mfrac>
          <mrow>
            <mo>(</mo> <mi>x</mi><mo>+</mo><mn>2</mn> <mo>)</mo> <mo>&#x2062;</mo>
            <mo>(</mo> <mi>x</mi><mo>&#x2212;</mo><mn>2</mn> <mo>)</mo>
          </mrow>
          <mrow> <mi>x</mi><mo>&#x2212;</mo><mn>2</mn> </mrow>
        </mfrac></mtd>
        <mtd><mtext>(2)</mtext></mtd>
      </mtr>
    </mtable>
    </math>
then cancel out the common factor:
    <math display="inline" displaystyle="normal">
    <mtable columnwidth="500px auto" columnspacing="0.1in" columnalign="left">
      <mtr>
        <mtd><mi>y</mi><mo>=</mo><mi>x</mi><mo>+</mo><mn>2</mn></mtd>
        <mtd><mtext>(3)</mtext></mtd>
      </mtr>
    </mtable>
    </math>

The output may not be displayed correctly in some browsers:

To simply the following equation:
    
    
      
        y=
           x2 − 4 
           x−2 
         
        (1)
      
    
    
we can factoring the Numerator first:
    
    
      
        y=
          
            ( x+2 ) ⁢
            ( x−2 )
          
           x−2 
        
        (2)
      
    
    
then cancel out the common factor:
    
    
      
        y=x+2
        (3)
      
    
    

But the output in MathJax Live Editor looks good:

Use 'mtable' with 'columnwidth'
Use 'mtable' with 'columnwidth'

By the way, this is a good workaround to replace the <mlabeledtr> element, which is deprecated now.

 

⇒ Use "mspace" instead of "columnwidth"

⇐ Use "mtable" for Linebreaking and Indentation

⇑ Alignment, Indentation and Line Breaks

⇑⇑ MathML (Mathematical Markup Language)

2026-10-17, ∼1741🔥, 0💬