Search code examples
mathjax

Aligning multiple equations in MathJax


Is there a way to align multiple equations so the equators are underneath each other using MathJax?

For example:
 2x - 4 = 6
     2x = 10
      x = 5

Solution

  • Use the aligned environment and the & symbol.

    e.g.

    $$\begin{aligned} 2x - 4 &= 6 \\ 2x &= 10 \\ x &= 5 \end{aligned}$$
    

    I inserted & in front of = of each line so that the horizontal positions of =s will be the same for all the lines.

    If you do not need such horizontal alignment, you can use gathered environment instead of aligned environment without &. It will horizontally center all the lines.