Adjusting line and other spacing in LaTeX
Posted on 2011-09-01 09:45:08
by Geert Vandeweyer
Line Spacing
Set line spacing in LaTeX by adding the setspace package to your preamble, with \onhalfspacing, \doublespacing or \singlespacing to set the spacing for the entire document. The benefit of this package is that it keeps single spacing in tables etc. (compared to other methods such as renewing the baselineskip commands)
\usepackage{setspace}
\onehalfspacing
\begin{document}
This text will have one and a half line spacing if it wraps around to a next line.
\end{document}
To change the spacing on a piece of the document, use the \begin \end syntax:
\usepackage{setspace}
\doublespacing
\begin{document}
This text will have double spacing.
\begin{singlespace}
However, this paragraph will have single spacing, since I don't want to waste space within the bibliography for example
\end{singlespace}
And spacing is back to double.
\end{document}
Vertical Filling of Pages
By default, LaTeX tries to fill the pages the best it can. However, somethimes this leads to large amounts of whitespace between paragraphs, which might look ugly. To disable this, add the following to the preamble. This allows LaTeX to have whitespace at the bottom of the page.
\raggedbottom
\begin{document}
\end{document}
I usually also set the penalties for creating widows and orphans to a higher level, to prevent the first or last line of paragraphs to be on seperate pages. Set it to 10000 to completely disallow it.
\widowpenalty=3000
\clubpenalty=3000
Disable or Change Indenting
A final thing I don't like about the default typesetting is the indenting of the first line of a new paragraph, without whitespace before the new paragraph. If you add the following to the preamble, indenting is disabled and (flexible) whitespace is added after each paragraph. LaTeX starts a new paragraph if there is a blank line in the .tex file.
\setlength{\parindent}{0pt}
\setlength{\parskip}{1.3ex plus 0.2ex minus 0.2ex}
If you need to indent an entire paragraph, I find the following method the easiest one:
% define a block of text/commands
\begingroup
% indent text 1.5em on the left
\leftskip1.5em
% indent text 0.5em on the right
\rightskip0.5em
This text is indented on both sides
\endgroup
indent, LaTeX, Linespacing, preamble, Typesetting, whitespace
Comments
Loading Comments