# How do I align equations?

I need to align the following equations: The numbers, <,> signs and theta symbol are aligned as desired. But, the words on left are not. I tried this:

\begin{flalign*}
\textit{Angle}: -45^{\circ} &\le \theta \le +45^{\circ} & \\
\textit{Bins}:  -135^{\circ} &< \theta < -45^{\circ} & \\
\textit{Slant}: +45^{\circ} &< \theta < +135^{\circ} & \\
\textit{Tilt}:  -180^{\circ} &\le \theta \le -135^{\circ} \ or\ +135^{\circ} \le \theta \le +180^{\circ}
\end{flalign*}


You could use tabular or array instead of flalign*:

\documentclass{article}
\usepackage{array,amsmath}

\begin{document}

\begin{tabular}{r>{$}r<{$}*{4}{>{$}l<{$}}}
\textit{Angle}: & -45^{\circ} & \le & \theta & \le & +45^{\circ} \\
\textit{Bins}: & -135^{\circ} & < & \theta & < & -45^{\circ} \\
\textit{Slant}: & +45^{\circ} & < & \theta & < & +135^{\circ} \\
\textit{Tilt}: & -180^{\circ} & \le & \theta & \le & -135^{\circ}\ \text{or}\ +135^{\circ} \le \theta \le +180^{\circ}
\end{tabular}

\vspace{1cm}

$\begin{array}{rrllll} \textit{Angle}: & -45^{\circ} & \le & \theta & \le & +45^{\circ} \\ \textit{Bins}: & -135^{\circ} & < & \theta & < & -45^{\circ} \\ \textit{Slant}: & +45^{\circ} & < & \theta & < & +135^{\circ} \\ \textit{Tilt}: & -180^{\circ} & \le & \theta & \le & -135^{\circ}\ \text{or}\ +135^{\circ} \le \theta \le +180^{\circ} \end{array}$
\end{document} • the spaces around the first and second signs of relation are much larger than the spaces around those signs at the end of the last line. also, the + before +135^{\circ} should be a unary plus, not binary (that can be fixed by wrapping that plus in braces: {+}). getting uniform spacing is the reason for using an align approach, or adjusting the inter-column spacing with array or tabular. – barbara beeton May 14 '15 at 21:16

I would use alignat for multiple alignments.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{alignat*}{2}
\textit{Angle}: &\ &  -45^{\circ}     &\le \theta \le +45^{\circ}  \\
\textit{Bins}:  &\ &  -135^{\circ}    &< \theta < -45^{\circ}  \\
\textit{Slant}: &\ & +45^{\circ}      &< \theta < +135^{\circ}  \\
\textit{Tilt}:  &\ &  -180^{\circ}    &\le \theta \le -135^{\circ} \ or\ {+}135^{\circ} \le \theta \le +180^{\circ}
\end{alignat*}

\end{document}


Resulting in: • i'd tidy this up by putting a space (\ ) between one pair of the &&, so that the colons aren't mashed right up against what follows. otherwise, very nice. – barbara beeton May 14 '15 at 21:24
• I would even add a quad… – Bernard May 14 '15 at 21:27
• @barbarabeeton sure, i edited my answer. i presume you mean like that. i personally would align things a little differently, but since the op didn't specify exactly how things on the left should be aligned, i left it as close to the provided code as possible. – aeroNotAuto May 14 '15 at 21:36
• yes! (the op did have a space after all the colons, so this is just as "close" to the provided code as without the space.) still got a small infelicity -- a binary rather than a unary plus for the +135 in the last line. fixing that would make it close to "perfect" (modulo the subjective decision whether the colons or the left ends of the initial terms should be aligned). that would make me happy if i were the copyeditor, and i'm an admitted fussbudget.. – barbara beeton May 15 '15 at 0:32
• @barbarabeeton ha, instead of saying i left it as close as possible, i should have said i tried to* – aeroNotAuto May 15 '15 at 23:45

Try:

\begin{flalign*}
\textit{Angle}: &&  -45^{\circ}     &\le \theta \le +45^{\circ}  \\
\textit{Bins}:  &&  -135^{\circ}    &< \theta < -45^{\circ}  \\
\textit{Slant}: && +45^{\circ}      &< \theta < +135^{\circ}  \\
\textit{Tilt}:  &&  -180^{\circ}    &\le \theta \le -135^{\circ} \ or\ +135^{\circ} \le \theta \le +180^{\circ}&
\end{flalign*}


This gives: Is this what you looking for?

Edit: A bit narrow space between text and math you achieve with adding \qquad&\qquad & at end of last row:

\textit{Tilt}:  &&  -180^{\circ}
&\le \theta \le -135^{\circ} \ or\ +135^{\circ} \le \theta \le +180^{\circ}

• Quite close! But there is large gap between words on left and equations...any idea how to handle that? – learner May 14 '15 at 20:41
• @learner There is an empty column in Zarko's code. Remove one column of "&". – Alenanno May 14 '15 at 20:42
• @Alenanno how? I tried changing "&&" to "&". Not helping! – learner May 14 '15 at 20:46
• @learner Uhm... That's odd. Let's wait for Zarko to answer. – Alenanno May 14 '15 at 20:47
• There should be empty column, otherwise you haven't aligned texts and then math part of flalign. Each second ampersand define "column" in math expresion. – Zarko May 14 '15 at 20:49

I'm not sure why the flalign environment seems to have become very fashionable. Here are two solutions, based on the alignedat inner environment.

Inside the equation* or flalign* environment (if you really want left alignment) I define a local abbreviation for the labels. If you have several of these constructions, move the command in the preamble, so you're sure that you always have the same typesetting.

The labels should be left aligned, as they are the leftmost column in a table. I also provided two alternative ways for typesetting angles in degrees; I'd avoid the explicit ^{\circ} in any case in the document body.

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\newcommand{\dg}{^{\circ}}

\newcommand{\Ang}{%
\SI[retain-explicit-plus]{#1}{\degree}%
}

\begin{document}

\lipsum*
\begin{equation*}
\!\begin{alignedat}{3}
&\tcond{Angle} &  -45\dg &\le \theta &&\le  +45\dg  \\
&\tcond{Bins}  & -135\dg &<   \theta && <   -45\dg  \\
&\tcond{Slant} &  +45\dg &<   \theta &&<   +135\dg  \\
&\tcond{Tilt}  & -180\dg &\le \theta &&\le -135\dg
\end{alignedat}
\end{equation*}
\lipsum*
\begin{flalign*}
\!\begin{alignedat}{3}
&\tcond{Angle} & \Ang{ -45} &\le \theta &&\le  \Ang{+45} \\
&\tcond{Bins}  & \Ang{-135} &<   \theta && <  \Ang{ -45} \\
&\tcond{Slant} & \Ang{ +45} &<   \theta &&<   \Ang{+135} \\
&\tcond{Tilt}  & \Ang{-180} &\le \theta &&\le \Ang{-135}
\end{alignedat}&&
\end{flalign*}
\end{document} This gets (like some other answers) the proper math spacing and (unlike the other answers), gets the proper (right) alignment on the numbers, using tabular stacks.

\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\setstacktabulargap{0pt}
\begin{document}
$\tabularCenterstack{rrcr}{ \textit{Angle}: & -45^{\circ} \le& \theta \le &+45^{\circ} & \\ \textit{Bins}: & -135^{\circ} <& \theta <& -45^{\circ} \\ \textit{Slant}: & +45^{\circ} <& \theta <& +135^{\circ} \\ \textit{Tilt}: & -180^{\circ} \le& \theta \le& -135^{\circ}& \ or\ {+}135^{\circ} \le \theta \le +180^{\circ} }$
\end{document} 