Resurchify LaTeX Guide
Resurchify

Paragraph formatting in LaTeX


The default formatting in LaTex makes the content quite legible. But it can surely be changed to give it a new look.

Table of Contents

  1. Introduction
  2. Starting a new paragraph
  3. Paragraph Indentation
  4. Line spacing
  5. Quick Understanding of line spacing terms

Introduction


We can change the look of the document by changing length of some elements. Let’s take a look.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
 
\setlength{\parindent}{5em}
\setlength{\parskip}{2em}
\renewcommand{\baselinestretch}{3.0}
 
\begin{document}
This is the first test paragraph to test the indentation of the paragraph and the other associated features.
Let’s go further and deep dive further for understanding…….
\end{document}

In the example stated above, we have separated the paragraphs by a blank line.


Starting a new paragraph


To start a new paragraph in LATEX, you can leave a blank line in between as stated in the above example. There is one more way to start this as in the following example.

1
2
This is the first paragraph. We are still in the first paragraph. \par
This is the second paragraph. We are still in the second paragraph.

In the example above, the \par command starts a new paragraph.




Paragraph Indentation : Indent First Paragraph; Indent Whole Paragraph LaTeX; Latex Indent Line


LaTeX does not indent the first paragraph of a section or a chapter by default . \parindent helps in determining the size of the subsequent paragraph.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
\setlength{\parindent}{3em}
 
\begin{document}
This is the first paragraph. We are still in the first paragraph. \par
\noindent This is the second paragraph. We are still in the second paragraph.
Another paragraph, just for understanding.Also,
I am only entering a double blank line now
And a new paragraph is getting defined.
...
\end{document}

The document class sets the default length of this parameter. Indent size can also be changed. In the example stated above, the first lines of each paragraph are indented 3em (an "em" equals the length of the "m" in the current font), this is followed by the command  \setlength{\parindent}{3em}. We can set this at any place in the document but it is recommended to place it in the preamble of the document.

Suppose, for some piece of text, you do not require any indentation, place the command \noindent at the beginning if that text. In case, you don’t want the complete document to be indented, set the indentation length to zero with the command \setlength{\parindent}{0pt}.

In the case where you want to indent a paragraph that is not indented, use the command \indent right above it. Please note that this command will only have an effect when \parindent is set to zero.


LaTeX Paragraph Spacing


\parskip is the parameter that defines the paragraph spacing. It defines the space between a paragraph and the preceding text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
 
\setlength{\parindent}{3em}
\setlength{\parskip}{2em}
 
\begin{document}
This is the first paragraph. This is the content of first
paragraph. First paragraph ends here\par
This is the second paragraph...
 
\end{document}

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


Line spacing


There are three commands in LaTex that control the line spacing, Let’s have a look at an example redefining the length of \baselinestretch.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
 
\setlength{\parindent}{3em}
\setlength{\parskip}{2em}
\renewcommand{\baselinestretch}{2.5}
 
\begin{document}
This is the first paragraph. This is the content of first
paragraph. And it ends here. \par
This is the text in second paragraph...
\end{document}

In the example above,  \renewcommand{\baselinestretch}{1.5} scales the default interline space to 2 its default value. This number can be set to the value of your choice.

The other two LATeX lengths that change the line spacing are as follows:

  • \baselineskip : This length defines the minimum space between the bottom of two successive lines in a paragraph. It can be changed in the preamble by  \setlength{\baselineskip}{value}.
  • \linespread{value} : Value here determines line spacing. The value, here is little confusing because of the following meaning:

Value Line spacing
1 single spacing
1.3 one-and-a-half spacing
1.6 double spacing

Quick Understanding of line spacing terms


  • \parindent, determines paragraph indentation
  • \parskip, determines space between paragraph and preceeding text

Powered by www.resurchify.com