Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 38 ยท Documents and Text Formatting

Fonts, Sizes and Spacing

Change font sizes with \large and \small, understand font families, shapes and weights, set line spacing and paragraph spacing, and add horizontal and vertical space.

The default LaTeX look (Computer Modern or Latin Modern fonts, tight line spacing, indented paragraphs) is a deliberate, well-tested design. Still, you will often need larger headings, smaller footnotes, more breathing room between lines, or a different font. This lesson covers the tools for each, starting with the ones you will use daily.

Font sizes

LaTeX has ten size declarations, from \tiny to \Huge. Each one switches the size until the end of the current group or environment. The real point sizes depend on the base size you chose in \documentclass (10pt, 11pt or 12pt).

Command 10pt document 11pt document 12pt document
\tiny 5 6 6
\scriptsize 7 8 8
\footnotesize 8 9 10
\small 9 10 10.95
\normalsize 10 10.95 12
\large 12 12 14.4
\Large 14.4 14.4 17.28
\LARGE 17.28 17.28 20.74
\huge 20.74 20.74 24.88
\Huge 24.88 24.88 24.88

Use them in a group so the change stays local:

LATEX
{\Large A bigger sentence.} Back to normal.

\begin{center}
  \small This note is set smaller.
\end{center}

The sizes are relative, so if you later change the whole document from 11pt to 12pt, everything scales together. That is much better than hard-coding point values. When you really need a specific size, \fontsize{14}{17}\selectfont sets size and line height explicitly.

The stand-in below prints each size for the base size you pick. The numbers come from the table above; the browser draws them, so the shapes are not Computer Modern, but the proportions are the real ones.

LaTeX size scale (stand-in)

Font families, series and shapes

A LaTeX font has three independent properties. You can mix them.

Property Values Declaration Command
Family roman, sans serif, typewriter \rmfamily, \sffamily, \ttfamily \textrm, \textsf, \texttt
Series (weight) medium, bold \mdseries, \bfseries \textmd, \textbf
Shape upright, italic, slanted, small caps \upshape, \itshape, \slshape, \scshape \textup, \textit, \textsl, \textsc

So \textbf{\textit{...}} is bold italic in the current family. A sans-serif bold small caps title: {\sffamily\bfseries\scshape Title}.

Changing the document font

With pdfLaTeX you load a font package in the preamble. A few popular ones:

LATEX
\usepackage{lmodern}        % Latin Modern: a sharper Computer Modern
\usepackage{libertine}      % Linux Libertine (needs the font installed in the distribution)
\usepackage{mathpazo}       % Palatino text and math
\usepackage{helvet}         % Helvetica-like sans
\renewcommand{\familydefault}{\sfdefault}   % make sans serif the default

With XeLaTeX or LuaLaTeX you can use any font installed on your system:

LATEX
\usepackage{fontspec}
\setmainfont{Libertinus Serif}     % body text
\setsansfont{Libertinus Sans}
\setmonofont{DejaVu Sans Mono}

Not every font on your machine is on the machine of your co-author or journal. Fonts embedded in the PDF are always fine to share, but the .tex file must be compiled where the fonts exist. Overleaf provides a large set of fonts.

Line spacing

Default line spacing is compact, matching print typography. Two common ways to widen it:

LATEX
\usepackage{setspace}
\onehalfspacing          % 1.5 lines
% \doublespacing         % double spacing, often required for theses
% \singlespacing         % back to default

Or without a package, for a quick factor: \renewcommand{\baselinestretch}{1.25} in the preamble. Inside a part of the document use the spacing environment from setspace, for example \begin{spacing}{1.5} ... \end{spacing}.

Paragraph indentation and spacing

By default LaTeX indents the first line of each paragraph and adds no extra space between paragraphs. This is traditional book style. The modern "block" style (no indent, space between paragraphs) is one package away:

LATEX
\usepackage{parskip}     % zero indent, space between paragraphs

Or do it by hand:

LATEX
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 1pt minus 1pt}

The plus and minus parts are rubber lengths: LaTeX may stretch or shrink the space by that much, which helps pages come out evenly filled. To suppress the indent of one paragraph write \noindent at its start; to force one use \indent.

Horizontal and vertical space

Sometimes you must insert space on purpose.

Command Result
\, thin space (also inside math)
\quad space as wide as the letter M
\qquad twice a \quad
\hspace{1cm} a horizontal space of exactly 1 cm (ignored at a line start; use \hspace*)
\hfill stretchable space that pushes things apart
\vspace{1cm} vertical space between paragraphs
\smallskip, \medskip, \bigskip small, medium, big vertical gaps
\vfill stretchable vertical space

\hfill is beautiful for layouts: Left text \hfill Right text puts the two parts at opposite ends of the line. \vfill between two blocks pushes the second to the bottom of the page.

LATEX
Name: Ada Student \hfill Date: \today

\vspace{1.5cm}

\begin{center}
  \Large\textbf{Report}
\end{center}

Units LaTeX understands include pt, mm, cm, in, em (width of an M in the current font) and ex (height of an x). Using em and ex makes spacing scale with the font.

Practical advice

  • Change sizes with the named commands, not with absolute point values.
  • Set spacing once in the preamble rather than patching paragraphs with \vspace and \\. A document full of manual spaces breaks when content moves.
  • Do not use more than two or three font families in one document.
  • If you see "Font shape ... not available" in the log, the font lacks that combination (for example bold small caps); LaTeX substitutes and warns.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does {\Large Hello} do?

    A size declaration lasts until the end of its group, here the braces.
  2. 2. Which package gives you \onehalfspacing?

    setspace provides \singlespacing, \onehalfspacing and \doublespacing.
  3. 3. What does Left \hfill Right do?

    \hfill is a stretchable horizontal space that fills the line.
  4. 4. Which engine lets you choose any installed system font with \setmainfont?

    fontspec works with the Unicode engines XeLaTeX and LuaLaTeX.

Summary

  • Ten size commands from \tiny to \Huge scale with the document's base size.
  • A font has family, series and shape; mix them with text commands or declarations.
  • pdfLaTeX loads font packages; XeLaTeX and LuaLaTeX use fontspec and system fonts.
  • setspace controls line spacing; parskip or \parindent/\parskip control paragraphs.
  • \hfill, \vfill, \quad, \hspace and \vspace add flexible or fixed space.

Next: Sections, Title Pages and Table of Contents