Today, I wanted to write a system of linear equations in a triangular form using \(\LaTeX\). As you may know, \(\LaTeX\) and especially the amsmath
package offers many ways to align equations. I wanted to achieve something like
I tried several ways including the align
or equation
(with split
) environment. But for some reason, all of them messed up.
Finally, I found the alignat
environment, also from the amsmath
package, which did what I wanted. This environment lets you explicitly set the spacing between the equations. The MWE looks like
\documentclass{scrartcl}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}% Use alignat when you wish to have individual equation numbering
&l_{00} y_{0} && = b_{0} \\
&l_{10} y_{0} + l_{11} y_{1} && = b_{1} \\
&l_{20} y_{0} + l_{21} y_{1} + l_{22} y_{2} && = b_{2}
\end{alignat*}
\end{document}
As the official documentation (p. 7) explains, the mandatory argument is the number of “equation columns” which can be calculated as the maximum number of &
in a row + 1 divided by 21.