0

I'd like to obtain something like,

   A + B = C + D
=> A + B + E = C + D + E
=> A + E = C + D + E - B
         = C + F - B
         = G - B
=> A + E + B = G

I've tried fiddling with align and alignat, but couldn't get what I want. The only way that I could think of is to use explicit value for horizontal space, which is very messy. Another solution is to use phantom, but again that seems cumbersome.

Any help regarding this is appreciated!

1

alignat(*) works with the proper number of columns, and a \quad to give it some air:

\documentclass[]{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
                    & & A + B & = C + D\\
   \Rightarrow\quad & & A + B & + E = C + D + E\\
   \Rightarrow\quad & & A + E & = C + D + E - B\\
                    & &       & = C + F - B\\
                    & &       & = G - B\\
   \Rightarrow\quad & & A + E & + B = G
\end{alignat*}
\end{document}

Here I've tried to reproduce your example as closely as possible. Personally, I'd align on the "=" sign, if you want that, just move the "&" to before the "=".

  • I can see that it works! But why do I need two "&" at the start of every line? – ChesterX May 17 '18 at 13:27
  • 1
    I think it has to do with the alignment: even columns (normally starting with the "=") are left-aligned, odd columns are right-aligned. So every "equation" in a line has to cover 2 columns to get the proper alignment – remco May 17 '18 at 13:34
  • @ChesterX add some text into that blank column, you will see that it left aligns to the arrows, and is not needed here. (unlike a tabular ams alignments have no padding space so an empty column does not cause spurious space in the output) – David Carlisle May 17 '18 at 13:54
1

I would write it a bit differently, I see it less confusing if aligned at the = signs as below. An array can also be used efficiently here.

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

\[
\begin{array}{l @{\quad} l @{{}={}} l}
               & A + B     & C + D\\
   \Rightarrow & A + B + E & C + D + E\\
   \Rightarrow & A + E     & C + D + E - B\\
               &           & C + F - B\\
               &           & G - B\\
   \Rightarrow & A + E + B & G
\end{array}
\]

\end{document}

enter image description here

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.