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 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?

share|improve this question
1  
Welcome to TeX.sx! A tip: you can use backticks ` to mark your inline code as I did in my edit. –  doncherry Jul 18 '11 at 9:04
add comment

4 Answers

up vote 10 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.)

share|improve this answer
    
Just found out that there is breqn tag at tex.stackexchange. –  eudoxos Jul 18 '11 at 9:46
add comment

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).

share|improve this answer
    
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. –  Martin Scharrer Jul 26 '11 at 21:35
    
Thanks Martin, Shall do next time - Bill –  Bill Jul 27 '11 at 0:17
add comment

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.