1

I have a very long align formula and I do not know how to optimally (that it looks good and is accetable with LaTeX rules) line-break this. Currently I have

\begin{align*}
\mathrm{Var}(\alpha)&\approx (1+\pi^{2})\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Var}(\zeta^{*})+\frac{\pi^{2}\exp(-2\delta^{*}+2\zeta^{*})}{1+\pi^{2}}\cdot  \mathrm{Var}(\pi)\\ &+ (1+\pi^{2})\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Var}(\delta^{*}) + \\
2&\times \left[ \pi\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Cov}(\pi,\zeta^{*}) - (1+\pi^{2})\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Cov}(\delta^{*},\zeta^{*})  - \pi\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Cov}(\delta^{*},\pi)\right]
\end{align*}

I tried

\begin{align*}
\mathrm{Var}(\alpha)&\approx (1+\pi^{2})\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Var}(\zeta^{*})+\frac{\pi^{2}\exp(-2\delta^{*}+2\zeta^{*})}{1+\pi^{2}}\cdot  \mathrm{Var}(\pi)\\ &+ (1+\pi^{2})\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Var}(\delta^{*}) + \\
2&\times \left[ \pi\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Cov}(\pi,\zeta^{*}) - (1+\pi^{2})\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Cov}(\delta^{*},\zeta^{*}) \\ & - \pi\exp(-2\delta^{*}+2\zeta^{*})\cdot \mathrm{Cov}(\delta^{*},\pi)\right]
\end{align*}

But I get the error message:

! Extra }, or forgotten \right.
<template> }
            $}\ifmeasuring@ \savefieldlength@ \fi \set@field \hfil \endtempl...
l.1533 \end{align*}
2
  • Please provide a MWE. Aug 18, 2013 at 13:35
  • 1
    You can't use \left in one line and \right in another; by the way, they aren't necessary in this context.
    – egreg
    Aug 18, 2013 at 13:52

2 Answers 2

5

One thing you can do, is to use the \hphantom command:

\documentclass{article}

\usepackage{mathtools}

\DeclareMathOperator*\var{Var}
\DeclareMathOperator*\cov{Cov}

\begin{document}

\begin{align*}
  \var(\alpha)
  &\approx (1 + \pi^{2}) \exp(-2\delta^{*} + 2\zeta^{*}) \cdot \var(\zeta^{*})\\
  &\hphantom{{}\approx} + \frac{\pi^{2} \exp(-2\delta^{*} + 2\zeta^{*})}{1 + \pi^{2}} \cdot \var(\pi)\\
  &\hphantom{{}\approx} + (1 + \pi^{2}) \exp(-2\delta^{*} + 2\zeta^{*}) \cdot \var(\delta^{*})\\
  &\hphantom{{}\approx} + 2 \times \bigl[\pi \exp(-2\delta^{*} + 2\zeta^{*}) \cdot \cov(\pi, \zeta^{*})\\
  &\hphantom{{}\approx + 2 \times \bigl[} - (1 + \pi^{2}) \exp(-2\delta^{*} + 2\zeta^{*}) \cdot \cov(\delta^{*}, \zeta^{*})\\
  &\hphantom{{}\approx + 2 \times \bigl[} - \pi \exp(-2\delta^{*} + 2\zeta^{*}) \cdot \cov(\delta^{*}, \pi)\bigr]
\end{align*}

\end{document}

output

On Barbara's note: egreg has explained why one needs \bigl and \bigr intead of \left and \right.

Comment

If you want to save a few keystrokes, you can use the following:

\documentclass{article}

\usepackage{mathtools}

\DeclareMathOperator*\var{Var}
\DeclareMathOperator*\cov{Cov}

\begin{document}

\begin{align*}
  \var(\alpha)
  &\approx (1 + \pi^2) \exp(-2\delta^* + 2\zeta^*) \cdot \var(\zeta^*)\\
  &\hphantom{{}\approx} + \frac{\pi^2 \exp(-2\delta^* + 2\zeta^*)}{1 + \pi^2} \cdot \var(\pi)\\
  &\hphantom{{}\approx} + (1 + \pi^2) \exp(-2\delta^* + 2\zeta^*) \cdot \var(\delta^*)\\
  &\hphantom{{}\approx} + 2 \times \bigl[\pi \exp(-2\delta^* + 2\zeta^*) \cdot \cov(\pi, \zeta^*)\\
  &\hphantom{{}\approx + 2 \times \bigl[} - (1 + \pi^2) \exp(-2\delta^* + 2\zeta^*) \cdot \cov(\delta^*, \zeta^*)\\
  &\hphantom{{}\approx + 2 \times \bigl[} - \pi \exp(-2\delta^* + 2\zeta^*) \cdot \cov(\delta^*, \pi)\bigr]
\end{align*}

\end{document}
2
  • you might explain why you used \bigl and \bigr. (very nice alignment.) Aug 18, 2013 at 13:56
  • @barbarabeeton Comment added. (And thank you for the compilment.) Aug 18, 2013 at 14:02
5

You can reduce the size of the equation and some repetitive typing by this way:

\documentclass{article}

\usepackage{mathtools}

\DeclareMathOperator*\var{Var}
\DeclareMathOperator*\cov{Cov}

\begin{document}

\begin{align*}
  \var(\alpha)
  &\approx (1+\pi^{2})A\cdot \var(\zeta^{*})
   + \frac{\pi^{2}A}{1+\pi^{2}}\cdot \var(\pi)
   + (1+\pi^{2})A\cdot \var(\delta^{*})\\
  &\hphantom{{}\approx} + 2 \times \bigl[ \pi A\cdot \cov(\pi,\zeta^{*})
   - (1+\pi^{2})A\cdot \cov(\delta^{*},\zeta^{*})
   - \pi A\cdot \cov(\delta^{*},\pi)\bigr]
\end{align*}
where 
\[
    A = \exp(-2\delta^{*}+2\zeta^{*})
\]

\end{document}

enter image description here

0

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.