Typevia
Fonts and Typography

Introduction to LaTeX Typography

In the world of LaTeX, typography is more than just picking a pretty font; it is about readability, structure, and professional presentation. By default, LaTeX uses the Computer Modern font family, designed by Donald Knuth. While this provides a classic academic look, you will often need to adjust font sizes for emphasis or change font families to suit different document types, such as resumes, reports, or presentations.

This guide will walk you through the two primary ways to manipulate text appearance: changing the size of your text and switching between different font families.


Understanding Font Sizes

In LaTeX, font sizes are handled differently than in word processors like Microsoft Word. Instead of selecting a numerical point size (like 11.5pt), LaTeX uses relative sizing commands. This ensures that if you change the base font size of your document, all other elements scale proportionally.

Global Document Font Size

You set the "base" font size in the very first line of your LaTeX file within the \documentclass options. Standard LaTeX classes (like article, report, and book) typically support 10pt, 11pt, and 12pt.

\documentclass[12pt]{article}
\begin{document}
This document has a base size of 12 points.
\end{document}

Local Font Size Commands

To change the size of specific words or paragraphs, LaTeX provides a set of predefined commands. These range from tiny to massive:

CommandExample Result
\tinyVery small text
\scriptsizeSize used for subscripts
\footnotesizeSize used for footnotes
\smallSlightly smaller than normal
\normalsizeThe default size
\largeLarger than normal
\LargeEven larger
\LARGEVery large
\hugeHuge
\HugeThe largest available

How to Apply Sizes (Scoping)

There are two ways to apply these sizes: as a switch or as an environment.

1. Using Curly Braces (The Switch Method): If you place a size command inside braces, the effect is limited to the text within those braces. This is known as "scoping."

This is normal text. {\huge This is huge text!} Back to normal.

2. Using Environments: For larger blocks of text, you can use an environment.

\begin{small}
This entire paragraph will be rendered in a smaller font size. 
This is useful for long quotes or supplementary technical details.
\end{small}

Note: Always remember to include a paragraph break (a blank line or \par) before closing the brace or environment if the font size change affects the line spacing (leading).


Exploring Font Families

LaTeX categorizes fonts into three main families. Most documents use a combination of these to create a visual hierarchy.

  1. Roman (Serif): Features small lines (serifs) at the ends of characters. Best for long blocks of body text.
  2. Sans Serif: Fonts without serifs. Great for headings, captions, and digital displays.
  3. Typewriter (Monospaced): Every character occupies the same width. Used for code snippets and URLs.

Font Family Commands

You can switch families using either a command that takes an argument or a declaration switch.

FamilyCommand (for short text)Switch (for blocks)
Roman\textrm{text}{\rmfamily text}
Sans Serif\textsf{text}{\sffamily text}
Typewriter\texttt{text}{\ttfamily text}

Practical Example: Mixing Families

\section{Introduction}
\textsf{This section is introduced in a Sans Serif font to stand out.}

The main body of the document remains in the default Roman font. 
If you want to mention a file name, you might use 
\texttt{document.tex} to indicate it is computer-related.

{\ttfamily
  This entire block is monospaced.
  Useful for manual code entry.
}

Using External Font Packages

While Computer Modern is the default, you can easily switch your entire document to professional typefaces like Times New Roman, Palatino, or Helvetica using packages in your preamble.

Here are some common combinations:

  • Times New Roman: \usepackage{mathptmx}
  • Palatino: \usepackage{palatino}
  • Helvetica (Sans Serif): \usepackage{helvet}
  • Courier (Typewriter): \usepackage{courier}

Example: Setting a Professional Tone

To use Times for body text and Helvetica for Sans Serif elements, your preamble would look like this:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc} % Better character encoding
\usepackage{mathptmx}    % Sets Roman font to Times
\usepackage{helvet}      % Sets Sans Serif font to Helvetica

\begin{document}
This text appears in Times. \textsf{This text appears in Helvetica.}
\end{document}

Note: The \usepackage[T1]{fontenc} command is a best practice when changing fonts. It ensures that accented characters and symbols are handled correctly by modern fonts.


Best Practices and Common Pitfalls

To create high-quality documents, keep these tips in mind:

  1. Limit Your Font Choices: Avoid using more than two or three different fonts in a single document. A common professional standard is a Serif font for the body and a Sans Serif font for headings.
  2. Use Semantic Commands: Instead of manually making every header \Large\bfseries, use LaTeX’s structural commands like \section{...}. You can later change the look of all headers at once by modifying the section style in the preamble.
  3. Mind the Braces: A common mistake is forgetting to close the curly brace after a font switch:
    • Incorrect: {\small This is small. Everything after this is now small too!
    • Correct: {\small This is small.} This is back to normal.
  4. Don't Overuse Typewriter Font: Use \texttt only for technical content like code, file paths, or email addresses. It is generally harder to read for long passages.
  5. Check Readability: If you use \tiny or \scriptsize, ensure it is absolutely necessary (like in a complex table). If the reader needs a magnifying glass, the font is too small!

Summary Example

Here is a complete LaTeX document that demonstrates several concepts discussed in this guide:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{palatino} % Professional Serif font

\begin{document}

\section{Typography Demonstration}

This document showcases the \textbf{Palatino} font family. 

\begin{itemize}
    \item This is \small{small text} used for minor details.
    \item This is \large{large text} used for emphasis.
    \item We can switch to \textsf{Sans Serif for a modern look}.
    \item We use \texttt{monospace} for things like \texttt{C:\Users\Home}.
\end{itemize}

\noindent
{\Large\sffamily Summary of Rules}
\par\medskip
Always ensure your font choices enhance readability rather than distracting the reader from the content.

\end{document}

By mastering these font commands, you gain full control over the visual tone of your LaTeX documents, moving from simple defaults to professional-grade typesetting.