Search This Blog

Monday, October 22, 2012

Latex Pagebreaks

Latex Pagebreaks

Besides the tricks talked about in the latex manual about pagebreaks and linebreaks, the following can be useful. A useful TeX command that can be used in LaTeX but is not mentioned in the LaTeX manual is \looseness.
\looseness+1 This is the start of a paragraph ....
tells latex/tex that is the paragraph can be made to take up one more line let it do so. This is useful for filling up an underfull page or forcing a line on to the next page (in cases where a singleton line already exists on the next page and looks bad).
\looseness-1 This is the start of a paragraph ....
Does the opposite. Latex/Tex will try to make the paragraph take up one less line. You can sometimes go back several pages and increase or decrease several paragraphs by one line to ensure a page looks nice.

General rules

The TeXbook is the major source for information on the pagebreaking algorithm unfortunately the algorithm is fairly complicated. In general page breaking is done by balancing the need to avoid widows and orphans, avoiding overfull pages, and avoiding underfull pages. It can do this by manipulating the glue (elastic space that can be found around figures, section heads, etc) and choosing where to break paragraphs. The tools the user can use for affecting pagebreaking are
\pagebreak[]
use to start a new page at the end of the current line. Without arguments if forces a page break. With arguments of 0,1,2,3, or 4 it suggests that this is a good place to break. 4 being equivalent to no argument and forcing the break. No extra space is put at the end of the page.
\nopagebreak
similar to \pagebreak except it prevents a pagebreak at the end of the current line. I rarely use it.
\samepage
pretty much as the latex manual says. I rarely use it.
\newpage
forces a break at the point and puts in space as needed at the end of the page.
\clearpage
similar to \newpage but figures are also printed
\cleardoublepage
similar to \clearpage but will force another page if needed so the next page with print is odd numbered.
Underfull \hboxes are the most common error for pages that don't fit exactly. Unless they look bad many people ignore them. You can try putting in some more elastic space. I confess I tend to use the tex commands for stretchable space (\vskip and \hskip) instead of the latex commands. The format is
\vskip 10pt plus 2pt minus 3pt
which says 10pts is best but tex/latex can go as high as 12pts or as low as 7pts without complaint. The default \parskip in 10pt article style is 0pt plus 1pt. The little stretch stops many underfull hbox errors. Don't forget the option of floating large diagrams by using the figure or table environment. If you don't use \caption argument within the figure, it won't be labelled which can be useful.

No comments:

Post a Comment

Thank you