4

I am attempting to align some equations using a align environment.
However it seems that when I try to make empty cells it fails to align properly

How do I properly have a empty cell in a align environment?

Here is a sample of what I am trying to do:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{equation*}
\begin{aligned}
(a,1)+(b,1)                     &          &= (a+b,1) \\
((a,1)+(b,1))                   &\cdot(1,c)&= (a+b,1)\cdot(1,c) \\
(a,1)\cdot(1,c)+(b,1)\cdot(1,c) &          &= (a+b,c) \\
(a,c)+(b,c)                     &          &= (a+b,c)
\end{aligned}
\end{equation*}
\end{document}
4
  • 2
    I'm guessing split only allows one alignment point. Perhaps you need some form of aligned. Mar 28 '17 at 18:54
  • As Steven guessed you need aligned not split, if you want more that one alignment. Btw you probably need more &'s. Split only handles one single alignment. Nowadays I tend to use aligned as the goto inner env instead of split.
    – daleif
    Mar 28 '17 at 18:59
  • @StevenB.Segletes Thank you for that. It seems that aligned still has a problem, albeit not a compilation error, so I have changed the question. Mar 28 '17 at 19:01
  • @MöbiusStripMall -- you might benefit from looking at this question: Difference between align and alignat environments Mar 28 '17 at 21:10
4

While not wholly clear what you seek, this may be it, here using TABstacks.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabstackengine}
\TABstackMath
\begin{document}
\begin{equation*}
\setstackaligngap{0pt}
\TABbinary
\setstackgap{L}{1.2\baselineskip}
\alignCenterstack{
(a,1)+(b,1)                     &          &&= (a+b,1) \\
((a,1)+(b,1))                   &\cdot(1,c)&&= (a+b,1)\cdot(1,c) \\
(a,1)\cdot(1,c)+(b,1)\cdot(1,c) &          &&= (a+b,c) \\
(a,c)+(b,c)                     &          &&= (a+b,c)
}
\end{equation*}
\end{document}

enter image description here

Alternately, with a \tabularCenterstack instead of an \alignCenterstack, to produce the identical output:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabstackengine}
\TABstackMath
\begin{document}
\begin{equation*}
\setstacktabulargap{0pt}
\TABbinary
\setstackgap{L}{1.2\baselineskip}
\tabularCenterstack{rcl}{
(a,1)+(b,1)                     &          &= (a+b,1) \\
((a,1)+(b,1))                   &\cdot(1,c)&= (a+b,1)\cdot(1,c) \\
(a,1)\cdot(1,c)+(b,1)\cdot(1,c) &          &= (a+b,c) \\
(a,c)+(b,c)                     &          &= (a+b,c)
}
\end{equation*}
\end{document}
4

Solution with array:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\[\setlength\arraycolsep{1pt}
\begin{array}{r@{}cl}
(a,1)+(b,1)                     &          &= (a+b,1) \\
((a,1)+(b,1))                   &{}\cdot{}(1,c)&= (a+b,1)\cdot(1,c) \\
(a,1)\cdot(1,c)+(b,1)\cdot(1,c) &          &= (a+b,c) \\
(a,c)+(b,c)                     &          &= (a+b,c)
\end{array}
\]
\end{document}   
2
  • Check the spacing around the \cdot. Mar 28 '17 at 19:03
  • 1
    ups, corrected!
    – Zarko
    Mar 28 '17 at 19:05
4

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
aligned
\begin{equation*}
\begin{aligned}
(a,1)+(b,1)                     &          &&= (a+b,1) \\
((a,1)+(b,1))                   &\cdot(1,c)&&= (a+b,1)\cdot(1,c) \\
(a,1)\cdot(1,c)+(b,1)\cdot(1,c) &          &&= (a+b,c) \\
(a,c)+(b,c)                     &          &&= (a+b,c)
\end{aligned}
\end{equation*}


alignat
\begin{alignat*}{2}
(a,1)+(b,1)                     &          &&= (a+b,1) \\
((a,1)+(b,1))                   &\cdot(1,c)&&= (a+b,1)\cdot(1,c) \\
(a,1)\cdot(1,c)+(b,1)\cdot(1,c) &          &&= (a+b,c) \\
(a,c)+(b,c)                     &          &&= (a+b,c)
\end{alignat*}

\end{document}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.