General\left and \right in multiline, breaks LaTeX subformula rule

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
verbunk
Posts: 18
Joined: Fri Nov 14, 2008 10:48 pm

\left and \right in multiline, breaks LaTeX subformula rule

Post by verbunk »

Hi Guys,

I have a long formula I need to break up using array and latex is complaining about a \left on one line and the corresponding \right on another. How do I fix? Sample below.

\begin{align*}
R(\lambda, r) & =\frac{z_0}{4\pi}\frac{\mu_s^{'}}{\mu_s^{'} + \mu_a}\left[\left(\mu + \frac{1}{r_1^2}
\frac{\exp(-\mu r_1)}{r_1^2} \right)\notag\\
&+ \left(1+\frac{4}{3}A \right)\left(\mu+\frac{1}{r_2} \right)\frac{\exp(-\mu r_1)}{r_1^2}\right]
\end{align*}

The offending \right is the very last entry before \end

Thanks!
-J

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

\left and \right in multiline, breaks LaTeX subformula rule

Post by gmedina »

Hi,

use

Code: Select all

\left. 
and

Code: Select all

\right. 
(with a dot) to match any unbalanced \right or \left construct before changing lines. The following code includes three examples: the first one, uses the mentioned procedure. The second example illustrates the fact that \left and \right constructs can produce undesired results when a line break occurs. The third example suggests a better option:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
  R(\lambda, r) &= \frac{z_0}{4\pi}\frac{\mu_s^{'}}{\mu_s^{'} + \mu_a}\left[ \left(\mu + \frac{1}{r_1^2}
  \frac{\exp(-\mu r_1)}{r_1^2} \right)\right.\\
  &+ \left. \left(1+\frac{4}{3}A \right)\left(\mu+\frac{1}{r_2} \right)\frac{\exp(-\mu r_1)}{r_1^2}\right]
\end{align*}

% an undesired result using \left and \right to resize delimeters
\begin{align*}
  R(\lambda, r) &= \frac{z_0}{4\pi}\frac{\mu_s^{'}}{\mu_s^{'} + \mu_a}\left[ \left(\mu + \frac{1}{r_1^2}
  \frac{\exp(-\mu r_1)}{r_1^2} \right)\right.\\
  &+ \left. abc \right]
\end{align*}

% a better result
\begin{align*}
  R(\lambda, r) &= \frac{z_0}{4\pi}\frac{\mu_s^{'}}{\mu_s^{'} + \mu_a}\Bigg[ \left(\mu + \frac{1}{r_1^2}
  \frac{\exp(-\mu r_1)}{r_1^2} \right)\\
  &+ \left(1+\frac{4}{3}A \right)\left(\mu+\frac{1}{r_2} \right)\frac{\exp(-\mu r_1)}{r_1^2}\Bigg]
\end{align*}

\end{document} 
At the end of this other thread, Juanjo gave a very good explanation on how to get finner control on the size of delimiters.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
verbunk
Posts: 18
Joined: Fri Nov 14, 2008 10:48 pm

Re: \left and \right in multiline, breaks LaTeX subformula rule

Post by verbunk »

Wow, what a professional and complete response! Thank you for the tips, they were much appreciated.

:) -J
Post Reply