# Tag Archives: parskip

## On paragraphs in TeX/LaTeX

When writing documents in TeX/LaTeX, it is important to understand how the TeX engine “thinks”. A paragraph is the basic text unit in a document and many TeX/LaTeX commands, when used properly, affect the current paragraph only. TeX provides a set of basic commands controlling the way a paragraphs are typeset. The following article explains the most commonly used commands and illustrates them with examples.

Any piece of text in TeX/LaTeX is a paragraph and follows predefined specifications. Single line-breaks will be ignored by the engine. To end a paragraph, leave a blank line between the end of the current and the beginning of the new paragraph.

...end of the current paragraph.

Beginning of a new paragraph...

The second, indented line marks the beginning of a new paragraph.

Alternatively, \par might be used to end a paragraph.

\documentclass{article}
\usepackage{blindtext}
\begin{document}
\blindtext\par\blindtext
\end{document}

##### Paragraph width

In plain TeX, \hsize controls the paragraph width, set to 6.5in by default. The example below shows how to change the paragraph width for a single paragraph.

\documentclass{article}
\usepackage{blindtext}
\begin{document}
\blindtext

\hsize 4in
\blindtext
\end{document}

The \leftskip and \rightskip commands provide a alternative, reducing the paragraph size from left and right respectively.

\documentclass{article}
\usepackage{blindtext}
\begin{document}
\blindtext

\leftskip=1.5in
\blindtext

\leftskip=0in \rightskip=1.5in
\blindtext
\end{document}

LaTeX knows at least two macros to control the paragraph width, the minipage environment and the \parbox command.

%Parbox macro
\parbox{4in}{...}

%Minipage environment
\begin{minipage}{4in}
...
\end{minipage}

Within a paragraph, the width is changed through the \hangindent and \hangafter commands. \hangindent controls the amount of indentation from left (positive value) or right (negative value). \hangafter, on the other hand, controls the number of full-width lines before changing the indent (\hangindent). A positive number produces full-width lines at the beginning, whereas a negative number produces them at the end.

Here is an example reducing the paragraph width by 2in from the right after the fifth line.

\documentclass[11pt]{article}
\usepackage{blindtext}
\begin{document}
\hangindent=-2in
\hangafter=5
\blindtext

\blindtext
\end{document}

##### Paragraph indentation

By default, TeX indents the first line of each paragraphs by 20pt. The \parindent command controls the indentation of paragraphs. To change the indentation document-wide, set \parindent in the document preamble to the desired value. To disable the indentation for a single paragraph, use \noindent at the beginning of the paragraph.

\documentclass{article}
\usepackage{blindtext}
\parindent=0pt % disables indentation
\begin{document}
\blindtext

\blindtext
\end{document}

##### Vertical space between paragraphs

TeX leaves no vertical space between paragraphs by default (\parskip=0pt). Similar to \parindent, setting \parskip in the document preamble controls the vertical space between paragraphs document-wide.

\documentclass{article}
\usepackage{blindtext}
\parskip=12pt % adds vertical space between paragraphs
\begin{document}
\blindtext

\blindtext
\end{document}

##### Vertical space between lines

While using the default font size (10pt), the line distance is 12pt. A ratio of 1.2 (line height to font size) leaves enough space between lines for a good reading experience and gives a harmonious look. The line height can be changed through \baselineskip.

More on font size in LaTeX.

\documentclass{article}
\usepackage{blindtext}
\begin{document}
\blindtext

\baselineskip=20pt
\blindtext
\end{document}

A gentle introduction to TeX, a relatively short, but well written introduction to TeX by Michael Doob.

## 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}

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