Skip to content

Even though the default formatting in LaTeX is fine, sometimes we need to change some elements. This article explains how to format paragraphs, change the text alignment and insert blank spaces.

Introduction

Let's start with an example:

\begin{center}
Example 1: The following paragraph (given in quotes) is an 
example of Center Alignment using the center environment. 

``LaTeX is a document preparation system and document markup 
language. LaTeX uses the TeX typesetting program for formatting 
its output, and is itself written in the TeX macro language. 
LaTeX is not the name of a particular editing program, but 
refers to the encoding or tagging conventions that are used 
in LaTeX documents".
\end{center}

ParagraphsEx1.png


These two paragraphs are written inside a center environment, which causes them to be centred. Notice that to start a new paragraph you have to insert a blank line in between them. This is quite natural, but not the only way declare a new paragraph.

  Open the examples in Overleaf.

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 code 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 also starts a new paragraph.

By default, the paragraphs are indented by 1.5 times the point size of the current font. Also, there is no extra blank space inserted between the paragraphs. In the sections below is described how to change that.

  Open the examples in Overleaf.

Paragraph Alignment (Text Justification)

Paragraphs in LaTeX are fully justified, i.e. flush with both the left and right margins. If you would like to change the justification of a paragraph, LaTeX has the following three environments: center, flushleft and flushright (see an example of center at the introduction).

\begin{flushleft}
``LaTeX is a document preparation system and document markup 
language. LaTeX uses the TeX typesetting program for formatting 
its output, and is itself written in the TeX macro language. 
LaTeX is not the name of a particular editing program, but refers 
to the encoding or tagging conventions that are used in LaTeX documents".
\end{flushleft}

ParagraphsEx3.png


The flushleft environment left-justifies the paragraph. To right-justify use flushright instead.

The aforementioned environments are based upon the switch commands: \raggedright (equivalent to flushleft), \raggedleft (equivalent to flushright) and centering (equivalent to center). A switch command switches the alignment from the point where it's inserted down to the end of the document, unless another switch command is inserted.

For more detailed information and examples on text alignment see this article.

  Open the examples in Overleaf.

Paragraph Indentation

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

\setlength{\parindent}{10ex}
This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
\noindent %The next paragraph is not indented
This is the text in second paragraph. This is the text in second 
paragraph. This is the text in second paragraph.

ParagraphsEx5.png


The default length of this parameter is set by the document class used. It is possible to change the indent size of the paragraph by using the command \setlength. In the example the paragraphs below \setlength{\parindent}{10ex} will be indented 10ex (an "ex" equals the lenght of the "x" in the current font)

If you want to create a non-indented paragraph, like the second one in the example, you can use the command \noindent at the beginning of the paragraph.

If you want to indent a paragraph that is not indented you can use \indent above it. It should be noted that this command will only have an effect when \parindent is not set to zero.

Detailed information and further examples can be found at Paragraph formatting.

  Open the examples in Overleaf.

Further Reading

For more information check

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