Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a very long equations inside

\begin{eqnarray}
   long equation go over 2 pages...
\end{eqnarray}

I can't break into two by

 \begin{eqnarray}
          1/n of long
    \end{eqnarray}
    \begin{eqnarray}
          b/n of long
    \end{eqnarray}

Unfortunately, the alignment is gone since the alignment of the second page is based on the first equation on the second page. I wonder is there a way to keep the same alignment for a really long equations?

share|improve this question
4  
best to avoid eqnarray altogether and use align and friends from amsmath; see eqnarray-vs-align –  cmhughes Nov 29 '12 at 0:29
    
@cmhughes: Thanks for the tip. –  Chan Nov 29 '12 at 0:31
add comment

1 Answer

up vote 12 down vote accepted

Instead of using eqnarray, use align (or any of the other environments provided by the amsmath package). During the document preparation, using \allowdisplaybreaks[1] in the preamble, allows an individual automatic page break inside displayed equations; a simple example:

\documentclass{article}
\usepackage[paperheight=4cm]{geometry}% just for the example
\usepackage{amsmath}

\allowdisplaybreaks[1]

\begin{document}

\begin{align*}
a &= b \\
&= c \\
&= c \\
&= c \\
&= c \\
&= c \\
&= c \\
&= c 
\end{align*}

\end{document}

enter image description here

As egreg mentions in his comment, once the document is finished, is best to suppress \allowdisplaybreaks[1] from the preamble and use \displaybreak inside the corresponding displayed equation and put it in the best place for the break (which may not be the one automatically chosen); this command is best placed immediately before the line change command where it is to take effect:

\documentclass{article}
\usepackage[paperheight=4cm]{geometry}% just for the example
\usepackage{amsmath}

\begin{document}

\begin{align*}
a &= b \\
&= c \\
&= c \\
&= c \displaybreak\\
&= c \\
&= c \\
&= c \\
&= c 
\end{align*}

\end{document}

The reasons for not using eqnarray can be found in Avoid eqnarray! by Lars Madsen.

share|improve this answer
    
This is right when working on the document. In the final revision \allowdisplaybreaks should be disabled and \displaybreak put in the best place for a break, which may not be the one chosen automatically. –  egreg Nov 29 '12 at 0:33
    
Thanks a lot, that's exactly what I'm looking for. –  Chan Nov 29 '12 at 0:35
    
@egreg I added your comment to my answer. Thank you! –  Gonzalo Medina Nov 29 '12 at 0:41
    
It would be nice if latex had a way to write displaybreak[30], which would change the breaking penalty. Then, you could put optional displaybreaks everywhere, and latex would choose the best one(s). –  Neil G Dec 24 '12 at 6:57
    
Let me tell you that this site is awesome. Many of the things that I don't know how to do in LaTeX were already asked and answered by someone here in this site! :) –  Vicent 2 days ago
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.