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!
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!
You'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.
– Qrrbrbirlbel
Aug 23 '13 at 09:00
split environment instead of the aligned environment.
– Mico
Aug 23 '13 at 09:11
eqnarray, which is better replaced by thealignfromamsmath. – Andrew Swann Aug 05 '13 at 14:37\begin{align}with\usepackage{amsmath}) – Jake Aug 05 '13 at 14:38alignis the right word. Theamsmathpackage provides thealignenvironment (amongst others). Insert an ampersand&before every=and add\\after every line and you’re good to go. For more, check theamsmathmanual or the [tag:align] tag. – Qrrbrbirlbel Aug 05 '13 at 14:38Thanks all you guys I solved my problem with your comments.
– sajjadG Aug 05 '13 at 14:52