9

I know that you can enter multiline equations using the align environment and line breaks (\\).

I want to LaTeX multiple polynomials that are very long (up to a page in length, single-spaced and 12 point font) without having to manually insert each line break. Even if I went through the trouble once, I'd have to do it all over again just to reformat the document.

Is there a way to do this, or do I have to use something like the verbatim environment or the listings environment, where the polynomials just become text?

1

4 Answers 4

10

Displayed math can't be broken automatically, but in-line math can. So you can try something like

\newenvironment{polynomial}
  {\par\vspace{\abovedisplayskip}%
   \setlength{\leftskip}{\parindent}%
   \setlength{\rightskip}{\leftskip}%
   \medmuskip=4mu plus 2mu minus 2mu
   \binoppenalty=0
   \noindent$\displaystyle}
  {$\par\vspace{\belowdisplayskip}}

and put your long polynomial in the newly defined environment.

2

if you're using amsmath, there's a command \allowdisplaybreaks that would work in an align environment (though not in the aligned sub-environment). it's documented in the amsmath user's guide on pp.8-9. the recommendation is to put

\allowdisplaybreaks[1]

in your preamble if you want it to work throughout the document.

1

Have a look at the breqn package, I used it few years back briefly with good results. There is also a presentation which shows a few eqs.

(I find it rather inconvenient that docstrip documentation just describe packages without actually showing what they output. Sigh.)

1
  • Just found out that there is breqn tag at tex.stackexchange.
    – eudoxos
    Jul 18, 2011 at 9:46
1

You may also use the breqn environment to break the equation across many lines. Example taken from the breqn user guide.

\documentclass{article}

\usepackage{mathpazo}
\usepackage[mathpazo]{flexisym}
\usepackage{breqn}

\begin{document}

\begin{dmath}[label={sna74}]
  \frac{1}{6} \left(\sigma(k,h,0) +\frac{3(h-1)}{h}\right)
  +\frac{1}{6} \left(\sigma(h,k,0) +\frac{3(k-1)}{k}\right)
  =\frac{1}{6} \left(\frac{h}{k} +\frac{k}{h} +\frac{1}{hk}\right)
  +\frac{1}{2} -\frac{1}{2h} -\frac{1}{2k},
\end{dmath}

\end{document}

Note that, according to the user guide, the breqn class only supports the mathpazo and mathptmx packages, but that could have changed since the document was written.

Like I mentioned in my previous post, the dmath environment is similar to the equation environment, except that it supports line breaking and variant numbers (i.e. equation numbering). To avoid number variants, use the dmath* environment. See the breqn user guide for other environments.

Hope this helps (and that the format is easier to read).

1
  • Thanks you for updating your question. Note that you can edit your answers and questions to provide more informations. Please use answers only for solutions to the stated question and address other users in comments. The @ notification only works in comments and the chat anyway. Some formatting tips: If you indent lines by 4 spaces, then they are marked as a code sample. If you use this the code gets syntax highlighting! Use back-ticks to mark inline code including package names etc. Jul 26, 2011 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .