# Removing horizontal space in align environment?

\begin{alignat*}{3}
a &= b &+& c &+& d\\
b &= b &+& c &+& d\\
c &= b &+& c &+& d\\
aoeu &= \mathrm{something long here}
\end{alignat*}


produces

How do I remove the space circled in red while keeping the "=" signs circled in green aligned? (Also, I want the "+" signs aligned.)

• How should the "a", "b", "c", and "d" elements be aligned in their respective columns: left-aligned, centered, or right-aligned? Please advise. – Mico May 18 '18 at 21:43
• @Mico left-aligned (so there's no space between the "+" and "c" of "+c" or between the "+" and "d" of "+d") – Geremia May 18 '18 at 23:53
• Thanks for this reply; I've adjusted the code in my answer accordingly. – Mico May 19 '18 at 4:55

As I don't know the real stuff that will be in your alignat* environment, I kept the three alignment columns. A solution consists in putting the r.h.s. of the last row in an \rlap command, which makes it have 0 width. In case this r.h.s. were a maths formula, mathtools defines a \mathrlap command, which has the same effect in math mode:

\documentclass[11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{mathtools}

\begin{document}

\begin{alignat*}{3}
a &= b &{}+{}& c &{}+{}& d\\
b &= b &{}+{}& c &{}+{}& d\\
c &= b &{}+{}& c &{}+{}& d\\
aoeu &= \rlap{something long here}\\
a & =\mathrlap{\frac{-b\pm\sqrt{b^2-4ac}}{2a}}
\end{alignat*}

\end{document}


• you lose the \mathbin spacing of + with &+& – David Carlisle May 18 '18 at 19:31
• @DavidCarlisle: Oh! yes. I didn't notice it as I focused on the extra spacing. I'll fix that in a moment. Thanks for pointing it! – Bernard May 18 '18 at 19:53
• You lose the proper centering. – egreg May 18 '18 at 20:21
• @egreg: That's right with the present code. With the real code, I don't know: either it may be unimportant (e.g. one wants to have only the significant part of the alignment centred, or it will be compensated by some formula.In each case, I think it's a matter of lavorazione a mano. – Bernard May 18 '18 at 20:36

I am assuming that your real equation contains more thrilling entries than a, b, c, and d. If that's the case, you may be better off employing a flexible array environment.

\documentclass{article}
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{C}{>{{}}c<{{}}} % for binary and relational operators
\newcolumntype{L}{>{\displaystyle}L} % automatic display-style math mode, left-aligned
\begin{document}
\setlength\arraycolsep{0pt} \renewcommand\arraystretch{1.2} % to emulate vert. spacing of 'align' env. \begin{array}{LCLCLCLl} % the final column is a "dummy" column a &=& b &+& c &+& d\\ b &=& b &+& c &+& d\\ c &=& b &+& c &+& d\\ aoeu &=& \multicolumn{6}{l}{\mbox{something long here}} \end{array}
\end{document}

• I'd add the local setting \renewcommand{\arraystretch}{1.2} to better emulate align*. – egreg May 18 '18 at 20:21
• @egreg - Many thanks for the suggestion. I took it on board right away. :-) – Mico May 18 '18 at 20:37