[Tex/LaTex] Adding alignment marker & gives: Error: Extra }, or forgotten \right \end{align}

alignequationserrors

I have a weird problem with the Align environment in combination with brackets spanning more than 1 line. When I add alignment markers (&) to my equation in the Align environment I suddenly get an error saying that I have an extra }.

The minimal example that reproduces the error looks like this:

\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}

\begin{document}
    \begin{align}
    J      =& 2  \left[3x \right.  \nonumber  \\
    \left. +& 4  \right]
    \end{align}
\end{document}

If i take out the & it works. If I take out the brackets it also works. Can anyone explain what is going on and how I can overcome this issue?

For completeness, the actual equation looks like this:

\begin{align}
 J=E-\Delta P V =& \gamma\int_{-\pi}^{\pi}\int_0^{r_0}\left[\sqrt{r^2+r^2 \partial_r z^2 + \partial_\phi z^2}-r \cos\theta_Y \right. \nonumber  \\
\left. + & \,\frac{\rho g}{\gamma} z r \left(\frac{z}{2}\cos\alpha-r \sin \alpha \cos\phi\right)-\Delta P r z  \right] dr d\phi
\end{align}

Best Answer

Is that what you want?

% arara: pdflatex

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \begin{align}
    J &= 2 \left[3x \right. \nonumber \\
     &+ \left. 4  \right]
    \end{align}
\end{document}

enter image description here

The problem in your MWE was that you put a & between your left and right delimiter. Instead of the automatic solution of \left[ and \right] I would recommend a manual choice for most cases (especially here, where the bracket from first line could get another automatic sizing than the bracket from the second line). In the following MWE, you can see how to use \bigl[/\bigr] as an example. In this very case, you could just use [ ], as you do not need enlarged brackets.

% arara: pdflatex

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \begin{align}
    J &= 2 \bigl[3x \nonumber \\
     &\quad+ 4\bigr]
    \end{align}
\end{document}

And here is your real example:

% arara: pdflatex

\documentclass{article}
\usepackage{amsmath}
\newcommand{\der}{\,\mathrm{d}}

\begin{document}
\begin{align}
J&=E-\Delta PV\nonumber\\
&=\gamma\int_{-\pi}^{\pi}\int_0^{r_0}\biggl[\sqrt{r^2+r^2 \partial_r z^2 + \partial_\phi z^2}-r \cos\theta_Y \nonumber  \\
&\phantom{{}=\gamma\int_{-\pi}^{\pi}\int_0^{r_0}\biggl[}+\frac{\rho g}{\gamma} zr \biggl(\frac{z}{2}\cos\alpha-r \sin \alpha \cos\phi\biggr)-\Delta Prz\biggr] \der r\der\phi
\end{align}
\end{document}

enter image description here