There are two variants of the automatic page break in LaTeX, one with vertical compensation and one without.
flushbottom
The variant \flushbottom works with a vertical compensation, which results in the sides having the same length.
raggedbottom
The variant \raggedbottom does not make any vertical compensation, which leads to the fact that the sides can have different lengths.
documentclass | flushbottom | raggedbottom |
article | no | yes |
report | no | yes |
book | yes | no |
letter | no | yes |
newpage
Where it is placed, the page is broken. This occurs regardless of being in the sentence and / or paragraph.
pagebreak
The page break occurs only after the current line has ended. There may also be a vertical compensation on the front side. The command has an optional value which can be set between 0 and 4. The default value is 4. The higher the value is set, the more likely the page break will be set.
clearpage
Used in oneside documents. Works like newpage, but delivers all sliding objects (for example tables) before.
cleardoublepage
Like clearpage but only for twoside documents.
nopagebreak
The first is the use of the \nopagebreak command this works similar to the pagebreak command with the difference that depending on the option value, default is also here 4 to prevent the break at the place where it was set.
enlargethispage
The second is to use the \enlargethispage{size} or the \enlargethispage*{size} command. On the page where this command was set, the text size is increased by the specified size. For example \enlargethispage{\baselineskip} allows one extra line. The star variant additionally expresses the content as much as possible together.
If a page break is to occur within an equation, the command \displaybreak[Option] can be used when amsmath package is included. This command allows to set a page break within an equation. The optional value can be between 0 and 4, the default value is 4. The higher the value, the more likely the page break is to be set. When using the command, make sure that its effect refers to the following line break. See also the following example.
& ... {\sigma^{2}_{1} \sigma^{2}_{2} \sigma^{2}}\right)\right)dv\\ \displaybreak &=\frac{1}{2 \pi \sigma_{1} \sigma_{2}} \int^{\infty}_{-\infty} \exp \left(-\frac{1}{2}\left( ... \right)\right)dv\\ %<- after this line break, the page break is insert
The needspace package (version 1.3d 2010) provides two commands \needspace{length} and \Needspace{length}, which prevent page breaks within a certain area. If there is not enough space, a \newpage is automatically inserted.
The package is included with \usepackage{needspace} and it currently has no options.
The difference between the two commands is that \needspace{length} provides approximately the specified space for the subsequent content on the same page. In addition, printing is made without vertical compensation, so with raggedbottom even if flushbottom was set.
The \Needspace{Length} command will have exactly the specified space available for the subsequent content on the same page. The command should only be used between two paragraphs. Here, too, printing is executed without vertical compensation (raggedbottom). The star variant of the command \Needspace*{Length} works analogously, with the difference that if flushbottom is set, for example with the documentclass book, there is a vertical compensation this time.
... text .... \needspace{4\baselineskip} 4 lines more ... ...
... text .... \Needspace*{4\baselineskip} 4 lines more ... Just this time with vertical compensation if flushbottom is set