Document Fundamentals

Text Formatting

Learn text formatting techniques in LaTeX including spacing, hyphenation, quote marks, diacritics, ligatures, and more.

This section will guide you through text-formatting techniques. Formatting refers to most things to do with appearance including text style and spacing. Formatting may also refer to paragraph and page layout; here we will focus on the customization of words and sentences.

Writers use formatting techniques to differentiate textual elements from the rest of the text. The many ways in which writers wish to differentiate textual elements give rise to many formatting techniques. Italicization is often used to add emphasis to key words or phrases. Footnotes are useful for providing extra information or clarification without interrupting the main flow of the text. For these reasons, formatting is very important. However, it is also very easy to abuse, and a document that has been overdone can look and read worse than one with none at all.

LaTeX is so flexible that we will actually only skim the surface, as you can have much more control over the presentation of your document if you wish. Having said that, one of the purposes of LaTeX is to take away the stress of having to deal with the physical presentation yourself, so you need not get too carried away!

Spacing

Line Spacing

If you want to use larger inter-line spacing in a document, you can change its value by putting the

\linespread{factor}

command into the preamble of your document. Use \linespread{1.3} for "one and a half" line spacing, and \linespread{1.6} for "double" line spacing. Normally the lines are not spread, so the default line spread factor is 1.

The setspace package allows more fine-grained control over line spacing:

\usepackage{setspace}
%\singlespacing
\onehalfspacing
%\doublespacing
%\setstretch{1.1}

To change line spacing within the document:

This paragraph has \\ default \\ line spacing.

\begin{doublespace}
  This paragraph has \\ double \\ line spacing.
\end{doublespace}

\begin{spacing}{2.5}
  This paragraph has \\ huge gaps \\ between lines.
\end{spacing}

Note: The line spacing value is contained in the \baselineskip length, but it is not recommended to change its value since it will have an impact on other types of content than paragraphs.

Non-Breaking Spaces

A non-breaking space between two tokens (e.g. words, punctuation marks) prevents the processors from inserting a line break between them. Additionally, a non-breaking space cannot be enlarged. It is very important for a consistent reading.

LaTeX uses the ~ symbol as a non-breaking space:

D.~Knuth
EUR~50

Sentence-Spacing

LaTeX inserts varying amounts of space between the words. By default, it follows traditional typesetting practice and inserts more space at the end of a sentence to assist the reader: an em-space rather than a word-space.

The additional space after periods can be disabled with:

\frenchspacing

which tells LaTeX not to insert more space after a period than after ordinary character. Frenchspacing can be turned off later in your document via the \nonfrenchspacing command.

A backslash before a space generates a space that will not be enlarged. A tilde ~ character generates a non-breaking space. The command \@ before a period specifies that this period terminates a sentence even when it follows an uppercase letter.

Stretched Spaces

You can insert a horizontal stretched space with \hfill:

Author Name \hfill \today

Similarly you can insert vertical stretched space with \vfill:

\maketitle
\vfill
\tableofcontents
\clearpage

\section{My first section}
% ...

Manual Spacing

The spaces between words and sentences, between paragraphs, sections, subsections, etc. is determined automatically by LaTeX. It is against LaTeX philosophy to insert spaces manually and will usually lead to bad formatting.

Hyphenation

LaTeX hyphenates words whenever necessary. Hyphenation rules will vary for different languages. LaTeX supports only English by default, so if you want to have correct hyphenation rules for your desired language, see Internationalization.

If the hyphenation algorithm does not find the correct hyphenation points, you can remedy the situation by using:

\hyphenation{word list}

causes the words listed in the argument (separated by blanks) to be hyphenated only at the points marked by "-".

\hyphenation{FORTRAN Hy-phen-a-tion}

The command \- inserts a discretionary hyphen into a word:

\begin{minipage}{2in}
I think this is: su\-per\-cal\-i\-frag\-i\-lis\-tic\-ex\-pi\-al\-i\-do\-cious
\end{minipage}

One or more words can be kept together on the one line with:

\mbox{text}

To avoid hyphenation altogether:

\hyphenpenalty=100000

Quote-Marks

LaTeX treats left and right quotes as different entities. For single quotes, a grave accent ` gives a left quote mark, and an apostrophe ' gives a right. For double quotes, simply double the symbols:

``To ``quote'' in LaTeX''

The right quote is also used for apostrophe in LaTeX without trouble.

For left bottom quote and European quoting style you need to use T1 font encoding:

\usepackage[T1]{fontenc}

The package csquotes offers a multilingual solution to quotations, with integration to citation mechanisms offered by BibTeX.

Dashes and Hyphens

LaTeX knows four kinds of dashes:

InputOutputPurpose
--inter-word
----page range, 1--10
------punctuation dash—like this
$-$minus sign
Hyphen: daughter-in-law, X-rated\\
En dash: pages 13--67\\
Em dash: yes---or no? \\
Minus sign: $0$, $1$ and $-1$

The commands \textendash and \textemdash are also used to produce en-dash (–), and em-dash (—), respectively.

Ellipsis (…)

A sequence of three dots is known as an ellipsis. You cannot enter 'ellipsis' by just typing three dots, as the spacing would be wrong. Instead, use:

Not like this ... but like this:\\
New York, Tokyo, Budapest, \ldots

Alternatively, you can use the \textellipsis command which allows the spacing between the dots to vary.

Ligatures

Some letter combinations are typeset not just by setting the different letters one after the other, but by actually using special symbols, called ligatures. Ligatures can be prohibited by inserting {} between the two letters:

\Large Not shelfful\\
but shelf{}ful

Slash Marks

When the slash character / is immediately preceded and/or followed by text without intervening white space, LaTeX does not allow a line break. For longer expressions, replace / with \slash:

input\slash output

To have both a line break and automatic hyphenation:

input\slash\hspace{0pt}output

Text Mode Superscript and Subscript

Sub and superscripting can be done using \textsubscript{} and \textsuperscript{}:

Wombat\textsubscript{walzing}

Michelangelo was born on March 6\textsuperscript{th}, 1475.

Text Figures ("Old Style" Numerals)

Many typographers prefer to use oldstyle figures elsewhere and lining figures when numerals are interspersed with full caps, in tables, and in equations:

\oldstylenums{1234567890}

Some fonts do not have text figures built in; the textcomp package attempts to remedy this. Put \usepackage{textcomp} in your preamble.

Formatting Macros

Even if you can easily change the output of your fonts using those commands, you're better off not using explicit commands like this, because they work in opposition to the basic idea of LaTeX, which is to separate the logical and visual markup of your document. Instead, use \newcommand to define a "logical wrapper command":

\newcommand{\oops}[1]{\textit{#1} }

Do not \oops{enter} this room,
it's occupied by \oops{machines}
of unknown origin and purpose.
Copyright © 2026