There seem to be a whopping align
, aligned
, alignedat
, alignat
, xalignat
, xxalignat
and falign
in amsmath
/ mathtools
- some also in there starred version.
I just find sloppy statements like:
"The advantage of aligned is the much better horizontal and vertical spacing.", p.52
"Similar to align, to be used inside another mathematics environment."
When do I use which align environment (best practice)?
What are the exact differences between them?
Why does the environment exist at all (example use case, if applicable)?
Which should I avoid and why?
In particular, what are the differences between
align
andxalignat
xxalignat
andflalign*
alignat*
andalignedat
and what is the semantic difference / different use-case between align*
and aligned
? When do I use which?
It appears to me as if align
is intended to be used to print independent columns whereas alignat
is intended to align dependent columns (e.g. equations [rows] aligned by their operators [columns]).
Thanks a lot!
Appendix
Source:
\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools,onlyamsmath}
\newlength{\Short}
\newlength{\LShort}
\newlength{\Long}
\setlength{\Short}{.05\columnwidth}
\setlength{\LShort}{.08\columnwidth}
\newcommand{\env}[2][]{\begin{#2}#1
\framebox[\Short]{} &= \framebox[\LShort]{} & \framebox[\LShort]{} &= \framebox[\LShort]{} & \framebox[\LShort]{} &= \framebox[\LShort]{}\\
\framebox[\Short]{} &= \framebox[\Short]{} & \framebox[\Short]{} &= \framebox[\Short]{} & \framebox[\Short]{} &= \framebox[\Short]{}
\end{#2}}
\newcommand{\Align}[2][]{\paragraph{#2}\env[#1]{#2}}
\newcommand{\mAlign}[2][]{\paragraph{#2}\[\env[#1]{#2}\]}
\begin{document}
\thispagestyle{empty}
\enlargethispage{\baselineskip}
\Align{align*}
\Align{align}
\Align[{3}]{alignat*}
\Align[{3}]{alignat}
\mAlign{aligned}
\mAlign[{3}]{alignedat}
\Align[{3}]{xalignat}
\Align[{3}]{xxalignat}
\Align{flalign*}
\Align{flalign}
\newpage
\Align{align}
\Align[{3}]{xalignat}
\Align[{3}]{xxalignat}
\Align{flalign*}
\Align[{3}]{alignat*}
\mAlign[{3}]{alignedat}
\Align{align*}
\mAlign{aligned}
\end{document}
multline
. I'd say that it is opinion based, you use the tool best suited for whatever you're typesetting. For most of my manuscript editing I tend to useequation
for one-liners andalign
for the rest (never usealign
for one-liners, trained eyes can spot them in the PDF). Occasionally I'll usegather
andalignedat
as well. I also usealigned
or alignedat` for some constructions and rarelysplit.
The rest I never use (especially notmultline
andeqnarray
)multline
intentionally. I did non write it explicitly but these are all centering environments.multline
is unique in this sense as it left-aligns the first line, right-aligns the last and centers the rest. Addingmultline
, I would also need to listgather
,gather*
,gathered
,split
and possibly others. I am curious about those as well but I thought it might be overkill for the question.*ed*
-environments are "internal" ones that might be used within other environments but are not intended to be used stand-alone and that thex*
-environments are legacy stuff -- so thatalign
,alignat
andflalign
as well as their starred counterparts remain. But since most of the stuff about LaTeX on the internet is a subjective myth, I'd like to have that confirmed by someone with more experience. And I'm also curious about the history and circumstances of those environments. :)-ed
ones are for alignments to be used within an outer math display is well documented in the amsmath documentation, you don't need "gut feeling" or to believe in myths