# Alignment with brackets

I am having problem in the align environment when I have brackets. Here is my example.

\begin{align}
A& = B~~~&+c~~-D\\
E& = F&+G-H
\end{align}


However, a similar problem I have with the use of brackets in an equation is below which is giving me an error

\begin{align}
A& = \left(B~~~&+c~~-D\right)\\
E& = \left(F&+G-H \right)
\end{align}


Could some provide assistance with the second command. I need to align about the + or - signs. In summary, how can I make the second code work properly (when we have brackets in the equation). Here I don't find the use of \left. or \right. as the brackets are in the same line.

Thanks.

-
There is also a second alignment issue in this question not present in the potential duplicate. –  Andrew Swann Jun 22 '13 at 15:52
The answer in the duplicate question does address this question as well. –  T. Verron Jun 24 '13 at 8:16

If you want multiple alignment spots, try using the alignat environment like such:

\begin{alignat}{4}
A& = \bigl(B & + & c-D\bigr)\\
E& = \bigl(F & + & G-H \bigr)
\end{alignat}


Does this achieve the desired result you are looking for?

As David Carlisle points out, it may be better to use \bigl(\bigr) so there isn't a size issue.

-
bettet to use \bigl( \bigr) than \left(\right. \left. \right) as otherwise there is no guarantee the brackets will match in size –  David Carlisle Jun 22 '13 at 15:17
@DavidCarlisle I will make the correction. –  dustin Jun 22 '13 at 15:18
Thanks alot for your correction. –  learner123 Jun 23 '13 at 5:50

The commands \left...\right must occur on the same side of an aligment, i.e. in one "cell". In this case you must use the specific sizing commands \bigl...\bigr or their variants \Bigl, \biggl, \Biggl etc.

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{alignat}{2}
A& = \bigl(B&&+c-D\bigr)\\
E& = \bigl(F&&+G-H \bigr)
\end{alignat}
\end{document}


Note that I have used the alignat environment rather than align. Multiple columns in align are designed for aligning separate equations, such as

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
x &=y  &  p&=q, \\
X &= Y &  P&=Q.
\end{align}

\end{document}


On the other hand alignat provides multiple alignment points in the same equation. In both cases one usually has an odd number of &'s and groups are aligned pairwise "right & left", thus the column of p''s is right aligned. Foralignatyou have to say how many such "pairs" there are: this is equal to "(number of &'s + 1)/2". Thus the argument toalignatin my top example with three ampersands is2.

Finally you should also be aware spacing around relation signs at such alignment points. Consider:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{alignat}{4}
x &=y  &&+ (y-1)^3&+&(y+1)^7 &{}-{}&1, \\
X &= Y &&+  Y^3&+&Y^7 &{}-{}&1.
\end{alignat}

\end{document}


Looking at the columns of relation signs, note that the spacing around the first two columns with &= and &&+ is correct, while that for the third with &+& is too tight. In the forth column I have placed extra empty groups {}-{}` to correct this.

-
Thanks alot for your correction. It worked –  learner123 Jun 23 '13 at 5:50