36

I am writing down a rather long expression, which has to be splitted in a align environment. The thing is that this expression has parentheses which have to be splitted too. I don't want to use resizebox, as this won't look pretty. My code is

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\begin{document}

\begin{align*}
\bullet \int\limits_V\!G(\mathbf{x,x^\prime})\rho(\mathbf{x^\prime})\;\diff^3x=&     \sum_{l=0}^{\infty}\dfrac{Q}{8\pi^2R^2(2l+1)}\cdot\left(\int\limits_{a}^{b}\!\left[r_{<}^l-    \dfrac{a^{2l+1}}{r_<^{l+1}}\right]\left[\dfrac{1}{r_<}-\dfrac{r_<^l}    {b^{2l+1}}\right]\delta(r-R)\;\diff r\right)\\
    \cdot &     \left(\int\limits_{0}^{\pi}\!P_l(\cos{\theta^\prime})P_l(\cos{\theta})\cos{\theta}\;\diff     \theta\right)\cdot \underbrace{\left(\int\limits_{0}^{2\pi}\!\diff \phi\right)}_{2\pi}\\
    =& \sum_{l=0}^{\infty}\dfrac{Q}{4\pi R^2(2l+1)}\cdot \left(     \int\limits_{a}^{R}\!\left[r_{<}^l-\dfrac{a^{2l+1}}{r_<^{l+1}}\right]\left[\dfrac{1}{r_<}-    \dfrac{r_<^l}{b^{2l+1}}\right]\delta(r-R)\;\diff r_<\\
    +& \int\limits_{R}^{b}\!\left[r_{<}^l-\dfrac{a^{2l+1}}{r_<^{l+1}}\right]\left[\dfrac{1}    {r_<}-\dfrac{r_<^l}{b^{2l+1}}\right]\delta(r-R)\;\diff r_> \right)\\%here's the error 
    \cdot &     \left(P_l(\cos{\theta^\prime})\int\limits_{0}^{\pi}P_l(\cos{\theta})\underbrace{\cos{\theta    }}_{P_1}\;\diff\theta\right)
\end{align*}

\end{document}

My output is

9
  • 4
    You might be aware of the usage \left( ... \right. to suppress one side of the delimiters.
    – percusse
    Jan 6, 2013 at 16:28
  • @percusse: I don't understand what you are trying to say...
    – Thanos
    Jan 6, 2013 at 16:35
  • 1
    You can leave left parenthesis on the first line and right parenthesis on the second line without scaling.
    – percusse
    Jan 6, 2013 at 16:36
  • @percusse: I see! Now it's working, but it's not pretty in the eyes... I used \bigg which makes it better looking! Thank's!!!
    – Thanos
    Jan 6, 2013 at 16:43
  • 2
    I agree some expressions are just impossible to beautify. So the only thing that matters is that it's not ambiguous.
    – percusse
    Jan 6, 2013 at 16:45

1 Answer 1

46

The commands \left and \right have to appear always in pairs within a single alignment cell. For this reason it is not possible to split them over several lines.

To achieve the desired outcome, you have two possibilities: one is to use to make artificial pairs by using an empty delimiter denoted by ., e.g., \left( formula \right. and on the next line \left. formula \right). The problem here is that you may end up with differently sized parentheses if your formulas have different heights (in your example I guess you are ok).

The alternative is to choose the delimiter size manually using \bigl, \Bigl, \biggl, or \Biggl instead of \left and \bigr, etc. instead of \right. Do not just use \bigg without the "l" or "r" as this changes the parentheses to an ordinary symbol instead of a mathopen or mathclose atom and that changes the spacing!

There are a few things not quite correct in your formula:

  • in amsmath alignment should be specified to the left of the relational symbol, i.e., &= not =&
  • I replaced most of the \left/\rightin favor of explicit delimiters as the parentheses should not get bigger than the integrals
  • On continuation lines one can use \phantom to move the second line inwards. This is a bit tricky and may require using \mathrel as well to tell LaTeX that something is still a relation, but it is worth the effort in the quality of the output.
  • It may be worth the time to read up a good documentation on the amsmath package if you typeset this kind of formulas.
  • One final advice: while you can't leave empty lines in formulas there is no reason not to split it in the source over many lines as this makes understanding and editing it much easier :-)

So here is my version of your formula (not beautifully layed out on the input but perhaps a little better already):

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\begin{document}

\begin{align*}
             \bullet \int\limits_V\!G(\mathbf{x,x^\prime})\rho(\mathbf{x^\prime})\;\diff^3x
    &=     \sum_{l=0}^{\infty}\dfrac{Q}{8\pi^2R^2(2l+1)}
             \cdot \Biggl(\int\limits_{a}^{b}\!\left[r_{<}^l -   
                    \dfrac{a^{2l+1}}{r_<^{l+1}}\right]\left[\dfrac{1}    
                    {r_<}-\dfrac{r_<^l}    {b^{2l+1}}\right]\delta(r-R)\;\diff r\Biggr)
\\
    &\mathrel{\phantom{=}}   % <--- this makes space of a relational =
             \mathrel\cdot            % <--- tricky this is no longer considered a relation because of the phantom above  
      \Biggl( \int\limits_{0}^{\pi}\!P_l(\cos{\theta^\prime})P_l(\cos{\theta})\cos{\theta}\;\diff     
                                      \theta\Biggr)
           \cdot  \underbrace{\left(\int\limits_{0}^{2\pi}\!\diff \phi\right)}_{2\pi}
\\
    &= \sum_{l=0}^{\infty}\dfrac{Q}{4\pi R^2(2l+1)}\cdot 
           \Biggl(     \int\limits_{a}^{R}\!\left[r_{<}^l-\dfrac{a^{2l+1}}{r_<^{l+1}}\right]\left[\dfrac{1}{r_<}
                  -    \dfrac{r_<^l}{b^{2l+1}}\right]\delta(r-R)\;\diff r_<
\\
    &\phantom{=\sum_{l=0}^{\infty}\dfrac{Q}{4\pi R^2(2l+1)}\cdot\Biggl(}   % <--- this makes space!
       +\int\limits_{R}^{b}\!\left[r_{<}^l-\dfrac{a^{2l+1}}{r_<^{l+1}}\right]\left[\dfrac{1}    {r_<}
        -\dfrac{r_<^l}{b^{2l+1}}\right]\delta(r-R)\;\diff r_> \Biggr)
\\
    &\mathrel{\phantom{=}}
        \mathrel\cdot    
       \Biggl(P_l(\cos{\theta^\prime})\int\limits_{0}^{\pi}P_l(\cos{\theta})\underbrace{\cos{\theta    }}_{P_1}\;\diff\theta\Biggr)
\end{align*}

\end{document}

And here is the result--enjoy:

enter image description here

just noticed I forgot to change \left/\right in the underbrace part ... well :-)

5
  • 1
    Thank you very much for your answer!!! Would it be OK if I edited your answer just to add the working code as well as it's output?
    – Thanos
    Jan 6, 2013 at 17:06
  • 1
    in a minute ... Jan 6, 2013 at 17:14
  • I think that you, @Thanos, should add \; to the definition of \diff, as you use it always. And may be, you would like to use \begin{multlined}[t] … \end{multlined} from the mathtools package.
    – Manuel
    Jan 6, 2013 at 23:59
  • Not the point of the question, but can someone explain the claim “in amsmath alignment should be specified to the left of the relational symbol, i.e., &= not =&”. Why would amsmath determine where the author wants to align the equation? May 14, 2021 at 19:59
  • @RandyCragun it doesn't, what I mean is that the point of alignment is to the right of &, so if you want elsewhere you put it elsewhere but you still have to put it to the left of whatever you want to see aligned. May 14, 2021 at 20:42

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.