Paragraphs and new lines
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}
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.
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}
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.
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
- 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