Paragraph formatting
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}
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.
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.
As you can see, the \par
command starts a new paragraph without the need of a blank line.
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}
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.
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}
In the example, the command \setlength{\parskip}{1em}
sets the paragraph separation to 1em.
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}
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 |
Reference guide
Schematic presentation of lengths in a paragraph
- \parindent, determining paragraph indentation
- \parskip, determining space between paragraph and preceeding text
Further reading
For more information see:
- Lengths in LaTeX
- Line breaks and blank spaces
- Text alignment
- Multiple columns
- Paragraphs and new lines
- Bold, italics and underlining
- Font sizes, families, and styles
- Font typefaces
- Supporting modern fonts with XƎLaTeX
- Lists
- Sections and chapters
- Management in a large project
- The not so short introduction to LaTeX2ε
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Debugging Compilation timeout errors
- How-to guides
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Fractions and Binomials
- Aligning Equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management in LaTeX
- Bibliography management with biblatex
- Biblatex bibliography styles
- Biblatex citation styles
- Bibliography management with natbib
- Natbib bibliography styles
- Natbib citation styles
- Bibliography management with bibtex
- Bibtex bibliography styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections and equations
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typing exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class
- Tips