3

I am trying to split an equation inside the align environment, but I get an error message each time I try to add the \begin{split} ... \end{split} lines in the code below:

\begin{align} % requires amsmath; align* for no eq. number
%\begin{split}
    A & = B & C & = D \\
    & = E & &  = F \\
    & = G & & = H \\[5mm]
    I & = J & K & = L \\
    & = M & &  = N \\
    & = O & & = P
%\end{split}
\end{align}

The code runs perfectly as I typed it above, but as soon as I uncomment the split lines LaTex give me an error: Extra alignment tab has been changed to \cr. I am Any idea of what is not correct in this piece of code? Thanks DK

migrated from stackoverflow.com Jun 15 '14 at 13:23

This question came from our site for professional and enthusiast programmers.

  • In its current form it is not immediately clear how you want the equation split. Can you mock up an image (or ASCII art) of what the current output is and what you actually want it to look like? – Werner Jun 12 '14 at 17:18
  • Werner, I wanted to make 6 lines of equations with 2 equations on each line. For each equation the "=" signs were supposed to line up with the equation above. I can get the equation to split, just using "align" (without the "split"), but in that case I get an equation number for each line (i.e. 6 numbers, one for each line). In order to get just one number for the entire set of equations I tried to add the split environment, but adding it gave me the error message. Let me know if you need more info or a picture and I will provide one. – user3734742 Jun 12 '14 at 18:45
3

Here are two ways of obtaining what you're after:

enter image description here

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

\begin{equation}
  \begin{aligned}
    A & = B & \qquad C & = D \\
      & = E &          & = F \\
      & = G &          & = H \\[5mm]
    I & = J &        K & = L \\
      & = M &          & = N \\
      & = O &          & = P
  \end{aligned}
\end{equation}

\begin{equation}
  \renewcommand{\arraystretch}{1.2}
  \begin{array}{r@{}>{\null}l@{\qquad}r@{}>{\null}l}
    A & = B &  C & = D \\
      & = E &    & = F \\
      & = G &    & = H \\[5mm]
    I & = J &  K & = L \\
      & = M &    & = N \\
      & = O &    & = P
  \end{array}  
\end{equation}

\end{document}

The first sets an equation (resulting in a single equation number) containing an aligned environment. This allows for the regular style align delimiting.

The second sets an array inside the equation instead of an aligned environment, with similarly formatted output. Mild horizontal spacing difference stem form the different column separation lengths.

  • Thanks. Any reason you know of why my code was not working? I looked up the code in The LaTeX companion book and also found it on the web. I could not see a reason why my approach would not work. – user3734742 Jun 13 '14 at 19:08
  • @user3734742: The mathmode document gives some good examples of how to use split. split can only handle a single alignment character & per row. – Werner Jun 13 '14 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy