[Tex/LaTex] Split environment alters spacing around binary operators

amsmathmath-modemath-operatorsspacing

I've been using split environment from amsmath. A problem that I've run into is that if an & for alignment is placed next to a binary operator, the spacing on that side of the operator is reduced from what it should be.

Here is a minimal example:

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

\begin{equation}
    f(x) = m x^2 + b
\end{equation}

\begin{equation}
\begin{split}
    f(x) = & m x^2 \\
    & + b
\end{split}
\end{equation}

\end{document}

split spacing

Any idea how to avoid this issue without having to fiddle around with manual spaces each time?

Best Answer

The usual way of using the alignment operator is either & = (on the left side), or via ={} & (to correct the spacing around the binary relation. Here's how you would use both:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}

\begin{equation}
  f(x) = m x^2 + b
\end{equation}

\begin{equation}
  \begin{split}
    f(x) = & m x^2 \\
    & + b
  \end{split}
\end{equation}

\begin{equation}
  \begin{split}
    f(x) & = m x^2 \\
    &\phantom{{}={}} + b
  \end{split}
\end{equation}

\begin{equation}
  \begin{split}
    f(x) ={} & m x^2 \\
    & + b
  \end{split}
\end{equation}

\end{document}

Note how the correction for the \phantom relation = ensures proper spacing.