How is it possible to sort equations align with their = like this:
a*b*c = d*e*f
g*h = i*j
k = l*m*n
o*p*q = r
I've seen it before but I don't know how to find that!
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou're looking for the align
environment which is provided by amsmath
.
In the code below, an ampersand (&) denotes a vertical alignment point. Every line in the align
environment will be aligned such that all ampersands are vertically aligned.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
a*b*c &= d*e*f\\
g*h &= i*j\\
k &= l*m*n\\
o*p*q &= r% \\ is not needed in this line!
\end{align}
\end{document}
If you need equation numbers, there are 2 options as follows.
\documentclass[preview,border=10pt]{standalone}% change it back to
%\documentclass{article}
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax% for my own purpose, remove this line!
\begin{align}
a*b*c &= d*e*f\\
g*h &= i*j\\
k &= l*m*n\\
o*p*q &= r% no \\ in this line!
\end{align}
\end{document}
\documentclass[preview,border=10pt]{standalone}% change it back to
%\documentclass{article}
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax% for my own purpose, remove this line!
\begin{equation}
\begin{split}
a*b*c &= d*e*f\\
g*h &= i*j\\
k &= l*m*n\\
o*p*q &= r% no \\ in this line!
\end{split}
\end{equation}
\end{document}
But if you don't need equation numbers, replace align
with align*
or equation
with equation*
. \[ ... \]
can also be used for the latter case!
Note: equation+split
versus equation+aligned
can be found here.
equation
+ split
is better. aligned
is for inline mode (not inline math-mode but inline alignment). See also this answer of mine. And no, I have no better source to support that.
Aug 23, 2013 at 9:00
split
environment instead of the aligned
environment.
eqnarray
, which is better replaced by thealign
fromamsmath
.\begin{align}
with\usepackage{amsmath}
)align
is the right word. Theamsmath
package provides thealign
environment (amongst others). Insert an ampersand&
before every=
and add\\
after every line and you’re good to go. For more, check theamsmath
manual or the align tag.