About these ads

# Tag Archives: spacing

## Correctly typesetting paragraphs in LaTeX

In LaTeX, paragraphs are ended by leaving a blank line between the end of the previous and the beginning of the next paragraph, never through a combination of end-line (\\) and new-line (\newline) commands.

##### A standard paragraph
\documentclass[11pt]{article}
\begin{document}
\section{Ending a paragraph}
... end of previous paragraph.

Beginning of next paragraph ...
\end{document}

##### Changing the standard behavior

The new paragraph automatically gets indented a little with no extra vertical space between. Should you require to change this behavior, use the setlength command on parindent to change the indentation and on parskip for adjusting vertical space between paragraphs. For example, adding the following two lines of code to the preamble reduces the indentation to zero and adds some vertical space between paragraphs:

\setlength\parindent{0pt} % sets indent to zero
\setlength{\parskip}{10pt} % changes vertical space between paragraphs

For exactly one empty line between two paragraphs, use baselineskip:

\setlength{\parskip}{\baselineskip}

A similar behavior is provided by the parskip package, zero parindent and non-zero parskip. In addition, it adjusts the space between list items. It is sufficient to load the package in the preamble.

\usepackage{parskip}

##### Adding more flexibility

For documents with figures and other elements, where the number of lines differs on different pages, it may be useful to add some flexibility to space between paragraphs (“rubber” length). You define how much more or less space is allowed between paragraphs and LaTeX will find the optimal page break position.

\setlength{\parskip}{0.5\baselineskip plus2pt minus2pt}

The parskip package mentioned above uses “rubber” length.

About these ads

## Quick note on line spacing

There are two different ways to change line spacing in LaTeX. One is simpler, the other requires a package, but is more flexible.

Let’s start easy.

The linespread-command:

To change the line spacing for the entire document, you can use the linespread command in your preamble:

\linespread{<factor>}

The factor is somewhat confusing. For double-spacing you have to use 1.6 and for one-and-a-half spacing 1.3. Not very intuitive, but I'm sure there is a reason for it.

The setspace-package:

Personally, I prefer the setspace package, which is more straight forward in usage, provides more flexibility and is easy to use as well:

\usepackage{setspace}
\singlespacing
\onehalfspacing
\doublespacing
\setstretch{<factor>} % for custom spacing

You can change spacing back and forth within your document using the commands above.
However, in order to stay on top of things, it's usually better using an environment to change vertical spacing locally.

\begin{doublespace}
...
\end{doublespace}

or

\begin{spacing}{2.0}
...
\end{spacing}

Finally, the package provides improved vertical spacing on top and below of itemize and quote environments, for any other than single-space content:

\usepackage{setspace}
\doublespacing
...
\begin{singlespace*}
\begin{quote}
Quote
\end{quote}
\end{singlespace*}

And that's the difference:

Default vertical spacing

Improved vertical spacing

The package is documented within the style-file