Document Fundamentals

Paragraph Formatting

Learn paragraph alignment, indentation, line spacing, manual breaks, and special paragraph environments in LaTeX.

Altering the paragraph formatting is rarely necessary in academic writing. It is primarily used for formatting text in floats or for more exotic documents.

Paragraph Alignment

Paragraphs in LaTeX are usually fully justified, i.e. flush with both the left and right margins. For whatever reason, should you wish to alter the justification of a paragraph, there are three environments at hand:

AlignmentEnvironmentCommand
Left justifiedflushleft\raggedright
Right justifiedflushright\raggedleft
Centercenter\centering

All text between the \begin and \end of the specified environment will be justified appropriately. The commands listed are for use within other environments.

Note: There is no way (in standard LaTeX) to set full justification explicitly. If you do not enclose the above 3 commands into a group, the rest of the document will be affected.

The right way of doing this with commands is:

{\raggedleft Some text flushed right.
}

If you really need to disable one of the above commands locally, you can use the command \justifying from package ragged2e.

Paragraph Indent

By default, the first paragraph after a heading follows the standard Anglo-American publishers' practice of no indentation. The size of subsequent paragraph indents is determined by a parameter called \parindent. You can override it:

\setlength{\parindent}{1cm} % Default is 15pt.

Whitespace in LaTeX can also be made flexible. This means that values such as extra vertical space inserted before a paragraph \parskip can have a default dimension plus an amount of expansion minus an amount of contraction:

\setlength{\parskip}{1cm plus 4mm minus 3mm}

If you want to indent a paragraph that is not indented, you can use:

\indent

at the beginning of the paragraph.

To create a non-indented paragraph:

\noindent

as the first command of the paragraph.

Tip: If you want to use the style of having no indentation with a space between paragraphs, use the parskip package:

\usepackage{parskip}

To indent subsequent lines of a paragraph, use the TeX command \hangindent:

\hangindent=0.7cm This paragraph has an extra indentation at the left.

Paragraph Line Break

Default style for \paragraph may seem odd in the first place, as it writes the following text next to the title. If you do not like it, use a class other than the traditional article/book.

If you add a manual line break with \\, LaTeX will complain. Simply adding an empty space will do it:

\paragraph{Title} \hspace{0pt} \\
Text...

Alternatively:

\paragraph{Title} ~\\
Text...

Line Spacing

To change line spacing in the whole document use the command \linespread covered in Text Formatting.

Alternatively, you can use the setspace package which provides the following environments:

  • doublespace: lines are double spaced
  • onehalfspace: line spacing set to one-and-half spacing
  • singlespace: normal line spacing
  • spacing: customizable line spacing, e.g. \begin{spacing}{\baselinestretch} ... \end{spacing}

Manual Breaks

LaTeX takes care of formatting, breaks included. You should avoid manual breaking as much as possible, for it could lead to very bad formatting.

CommandDescription
\newlineBreaks the line at the point of the command.
\\Breaks the line at the point of the command.
\\[extra-space]Breaks the line with extra vertical space before the next line.
\\*Breaks the line and prohibits a page break after the forced line break.
\linebreak[number]Breaks the line. The number represents priority (0-4).
\parEnds the current paragraph. Equivalent to leaving a blank line.

Note: If you use these commands to put a break in a section heading, the line will also be broken in the table of contents. To avoid such a division, you can use the \section[]{} command.

Special Paragraphs

Verbatim Text

There are several ways to introduce text that won't be interpreted by the compiler. If you use the verbatim environment, everything input between the begin and end commands is processed as if by a typewriter:

\begin{verbatim}
The verbatim environment
  simply reproduces every
 character you input,
including all  s p a c e s!
\end{verbatim}

Note: once in the verbatim environment, the only command that will be recognized is \end{verbatim}.

If this is a problem, you can use the alltt package instead:

\begin{alltt}
Verbatim extended with the ability
to use normal commands.  Therefore, it
is possible to \emph{emphasize} words in
this environment, for example.
\end{alltt}

For a short verbatim phrase, use the \verb command:

\verb+my text+

Typesetting URLs

The hyperref or url package provides the \url command:

Go to \url{http://www.uni.edu/~myname/best-website-ever.html} for my website.

When using this command through the hyperref package, the URL is "clickable" in the PDF document.

Multiline Comments

The only way LaTeX allows you to add comments is by using the special character %. Alternatively, you can use the verbatim package to use the comment environment:

\usepackage{verbatim}

This is another
\begin{comment}
rather stupid,
but helpful
\end{comment}
example for embedding
comments in your document.

Skipping Parts of the Source

A more robust way of making the TeX engine skip some part of the source is to use the TeX \iffalse-conditional:

This we want to keep

\iffalse % ----- START THE CUT ---------
But this part we want to skip
\fi % ---------- END THE CUT -----------

Here it begins again

Quoting Text

LaTeX provides several environments for quoting text:

  • quote: for a short quotation, or a series of small quotes, separated by blank lines.
  • quotation: for use with longer quotations, of more than one paragraph, because it indents the first line of each paragraph.
  • verse: is for quotations where line breaks are important, such as poetry. New stanzas are created with a blank line, and new lines within a stanza are indicated using the newline command \\.

Abstracts

In scientific publications it is customary to start with an abstract which gives the reader a quick overview of what to expect. See Document Structure.

Copyright © 2026