Zum Inhalt springen

The default LaTeX formatting is fine and makes documents quite readable, but it can be changed if you need a different looking document. This article explains how to change the paragraph and line spacing.

Introduction

Changing the length of some specific elements my alter the looking of the entire document.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\setlength{\parindent}{4em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{2.0}

\begin{document}
This is the first paragraph, contains some text to test the paragraph
interlining, paragraph indentation and some other features. Also, is 
easy to see how new paragraphs are defined by simply entering a double 
blank space.

Hello,  here  is  some  text  without  a  meaning.   This  text  should
show what a printed text will look like at this... 
\end{document}

ParagraphFormattingEx1.png


In the previous example paragraphs are separated by a blank line in between them, this is quite easy and convenient. In this example the indentation at the first line of a paragraph, the line spacing and the paragraph spacing are manually set. These latter commands will be explained in more detail throughout the next sections.

  Open an example in ShareLaTeX

Starting a new paragraph

To start a new paragraph in LaTeX, as said before, you must leave a blank line in between. There's another way to start a new paragraph, look at the following snippet.

This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
This is the text in second paragraph. This is the text in second 
paragraph. This is the text in second paragraph.

Paragraph-blank line.png


As you can see, the \par command starts a new paragraph without the need of a blank line.

  Open an example in ShareLaTeX

Paragraph Indentation

By default, LaTeX does not indent the first paragraph of a section or a chapter. The size of the subsequent paragraph indents is determined by \parindent

\setlength{\parindent}{4em}

\begin{document}
This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
This is the text in second paragraph. This is the text in second 
paragraph. This is the text in second paragraph.

This is another paragraph, contains some text to test the paragraph
interlining, paragraph indentation and some other features. Also, 
is easy to see how new paragraphs are defined by simply entering a 
double blank space.
...
\end{document}

ParagraphFormattingEx2.png


The default length of this parameter is set by the document class used. It is possible to change the indent size. In the example, the first lines of each paragraph are indented 4em (an "em" equals the length of the "m" in the current font), this is accomplished by the command \setlength{\parindent}{4em}. It's recommended to put this command in the preamble of the document, but it can be set anywhere else.

If you want to create a non-indented paragraph, like the second one in the example, put the command \noindent at the beginning of it. If you want the whole document not to be indented, set the indentation length to zero with \setlength{\parindent}{0pt}.

On the other side, if you want to indent a paragraph that is not indented you can use \indent right above it. It should be noted that this command will only have an effect when \parindent is set to zero.

  Open an example in ShareLaTeX

Paragraph spacing

The length parameter that characterises the paragraph spacing is \parskip, this determines the space between a paragraph and the preceding text.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\setlength{\parindent}{4em}
\setlength{\parskip}{1em}

\begin{document}
This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
This is the text in second paragraph...

\end{document}

ParagraphFormattingEx3.png


In the example, the command \setlength{\parskip}{1em} sets the paragraph separation to 1em.

  Open an example in ShareLaTeX

Line spacing

There are three commands that control the line spacing, below an example redefining the length of \baselinestretch

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\setlength{\parindent}{4em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}

\begin{document}
This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
This is the text in second paragraph...
\end{document}

ParagraphFormattingEx4.png


In the example above, \renewcommand{\baselinestretch}{1.5} scales the default interline space to 1.5 its default value. Of course that number can be set to any value.

As mentioned before, there are other two LaTeX lengths that may change the line spacing:

\baselineskip
Is a length determining the minimum space between the bottom of two successive lines in a paragraph; it may be changed (in the preamble) by \setlength{\baselineskip}{value}. Where value is set using any of the LaTeX units.
\linespread{value}
where value determine line spacing. This value is somewhat confusing, because:
Value Line spacing
1.0 single spacing
1.3 one-and-a-half spacing
1.6 double spacing

  Open an example in ShareLaTeX

Reference guide

Schematic presentation of lengths in a paragraph

  • \parindent, determining paragraph indentation
  • \parskip, determining space between paragraph and preceeding text
Paragraph-layout.png

Further reading

For more information see:

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX