# Aligning multiple places in equations using align

My question is simple. I've played around with the & symbol to align my equations neatly under each other, but I just can't get it to look nice. This is the closest I've got:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{align}
A_{0} & = -\frac{3\sigma_{1}' h H L^{2}}{E (H+h)^{3}} &=& -1.62\times 10^{-6}\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (\alpha_{2}-\alpha_{1}) L^{2}}{(H+h)^{3}} &=&  2.95\times 10^{-8}\,\mathrm{m\,K^{-1}} \\
C_{0} & = \frac{4 L^{3}}{E W (H+h)^{3}} &=& 1.08\,\mathrm{m\,N^{-1}}
\end{align}
\end{document}


which produces the following output: How can I remove the horizontal space in the middle yet still align the equal signs under each other? It should be the middle equation that dictates the spaces, i.e. the other two equations need to align to that one.

As a final question I could ask: How would you do it to make it 'look nice'?

And yes, I have looked at the other similar questions without luck.

• And also, strangely there is no/very little space after the right equal sign - why? – Carsten Gade Sep 28 '14 at 11:21
• none of the answers has addressed the question in your comment, about the lack of space after the second = sign. in order to get the correct space, (la)tex has to consider the classes of the two adjacent characters. since the second = is followed by a &, there isn't any character there to check, and no space is left. you can force it by adding {} after the =, but it's better to simply put both && before the =. (or follow the guidance of the "real" answers.) – barbara beeton Sep 28 '14 at 19:19

Two solutions with alignat; one of them has two alignment points, the other, three, so that the numeric values are aligned on the integer part of the mantissa:

 \documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

\begin{alignat}{3}
A_{0} & = -\frac{3σ_{1}' h H L²}{E (H+h)³} &&= - & & 1.62 × 10⁻⁶\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (α_{2}-α_{1}) L²}{(H+h)³} &&= & & 2.95 × 10⁻⁸\,\mathrm{m\,K⁻¹} \\
C_{0} & = \frac{4 L³}{E W (H+h)³} &&= & & 1.08\,\mathrm{m\,N⁻¹}
\end{alignat}

\begin{alignat}{2}
A_{0} & = -\frac{3σ_{1}' h H L²}{E (H+h)³} &&= - 1.62 × 10⁻⁶\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (α_{2}-α_{1}) L²}{(H+h)³} &&= 2.95 × 10⁻⁸\,\mathrm{m\,K⁻¹} \\
C_{0} & = \frac{4 L³}{E W (H+h)³} &&= 1.08\,\mathrm{m\,N⁻¹}
\end{alignat}

\end{document} • Your top answer is exactly what I was looking for! It's nice to have the numeric values aligned as well. – Carsten Gade Sep 28 '14 at 11:45

What you need is alignat:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{alignat}{2}
A_{0} & = -\frac{3\sigma_{1}' h H L^{2}}{E (H+h)^{3}} &{}={}& -1.62\times 10^{-6}\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (\alpha_{2}-\alpha_{1}) L^{2}}{(H+h)^{3}} &{}={}&  2.95\times 10^{-8}\,\mathrm{m\,K^{-1}} \\
C_{0} & = \frac{4 L^{3}}{E W (H+h)^{3}} &{}={}& 1.08\,\mathrm{m\,N^{-1}}
\end{alignat}
\end{document}


\begin{alignat}{2} aligns at two points (two equation columns) and you have to use three &s. To get the proper spacing around = in the second column use {}={} You have to use the alignat environment. Also, use siunitx for the physical quantities.

\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

\begin{alignat}{2}
A_{0}
&= -\frac{3\sigma_{1}'hHL^{2}}{E(H+h)^{3}}
&&= \SI{-1.62e-6}{\m} \\
B_{0}
&= - \frac{3hH(\alpha_{2}-\alpha_{1})L^{2}}{(H+h)^{3}}
&&= \SI{2.95e-8}{\m\per\K} \\
C_{0}
&= \frac{4L^{3}}{EW(H+h)^{3}}
&&= \SI{1.08}{\m\per\N}
\end{alignat}

\end{document} Update

Inspired by Barnard's answer, here is a way in case you also want to align the units:

\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

\begin{alignat}{4}
A_{0}
&= -\frac{3\sigma_{1}'hHL^{2}}{E(H+h)^{3}}
&&={}& -1.62 &\times 10^{-6} && \,\si{\m} \\
B_{0}
&= - \frac{3hH(\alpha_{2}-\alpha_{1})L^{2}}{(H+h)^{3}}
&&={}& 2.95 &\times 10^{-8} && \,\si{\m\per\K} \\
C_{0}
&= \frac{4L^{3}}{EW(H+h)^{3}}
&&={}& 1.08 & && \,\si{\m\per\N}
\end{alignat}

\end{document} • @CarstenGade You're welcome. Side-note: In case you have table tables with physical quantities, siunitx is again the way to go when typesetting them (see the manual)! – Svend Tveskæg Sep 28 '14 at 11:47
• Hm, apparently I can only accept one answer. I will accept Bernard's since he also aligned the numeric values, which is nice. – Carsten Gade Sep 28 '14 at 11:47
• @CarstenGade No problem. If you had told me about your other alignment request, I could have done that for you as well. :) – Svend Tveskæg Sep 28 '14 at 11:49
• @Svend Tveskæg: Good point for the siunitx loading that I had forgotten. – Bernard Sep 28 '14 at 11:51
• @SvendTveskæg I don't doubt it ;) It's nice to see a fellow dane in here, btw. – Carsten Gade Sep 28 '14 at 11:54