# Split environment alters spacing around binary operators

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}

$$f(x) = m x^2 + b$$

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

\end{document}


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

• Either use &= or ={}& – egreg Jul 18 '13 at 21:16

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:

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

$$f(x) = m x^2 + b$$

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

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

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

\end{document}


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

• #3 is the only one i'd consider "correct". another variant (essentially what's recommended by knuth, migrated from plain tex to latex): f(x) &= mx^2 \\ &\quad b. (and you left a "how" out of the last sentence. not editing, since i just put in my own answer, and it looks greedy to have my fingerprints on all the answers.) – barbara beeton Jul 18 '13 at 21:26
• Thanks. The last method (#4) works perfectly and is reasonably convenient. Do you know why the ampersand messes up spacing even though it is only being used as formatting mark-up? A technical limitation of LaTeX? – tarheels Jul 18 '13 at 21:31
• @tarheels: As mentioned in barabara beeton's answer, it is expected to have the relation on the right side of &. So, technically you're not conforming to the required syntax. If you do, there's no problem. If you don't you have to do some magic to correct for this. – Werner Jul 18 '13 at 21:32
• @tarheels -- latex interprets input linearly. if the & comes after the =, it's too late to decide what spacing to use. – barbara beeton Jul 18 '13 at 21:35
• @tarheels: As @barbara mentioned, it's a case of syntax. In a similar vein there are other things that are physically required in LaTeX in some instances, yet in other's it's defined a little more loosely. For example, while you can end most environments using \end {<somenv>} (note the space), this is not possible with verbatim (by default). You explicitly need \end{verbatim}. There may be other instances where things just have to work a specific way, or else it fails. In some instances you can correct for this if the failure isn't fatal. – Werner Jul 18 '13 at 21:45

you're not following the recommended/required syntax. from the manual (texdoc amsldoc):

In the structures that do alignment (split, align and variants), relation symbols have an & before them but not after -- unlike eqnarray. Putting the & after the relation symbol will interfere with the normal spacing; it has to go before.

• Ah, thanks. I looked in the amsmdoc "User's Guide", but it didn't specifically mention this rule. – tarheels Jul 18 '13 at 21:27
• @tarheels -- p.3, the paragraph just before "3.2 single equations". – barbara beeton Jul 18 '13 at 21:32