Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing
  19. Initials


  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Text

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher's Corner
  5. Curriculum Vitae
  6. Academic Journals (MLA, APA, etc.)

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics


  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Creating Package Documentation
  5. Themes


  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks


  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this boxedit the TOC

Font families edit

There are hundreds—if not thousands—of typefaces, or font families. Common examples include Times, Courier, and Helvetica. These families can generally be grouped into three main categories: serif, sans serif, and monospaced. LaTeX commands generally refer to these with the shorthand rm, sf, and tt respectively.

By default, LaTeX uses Computer Modern, a family of typefaces designed by Donald Knuth for use with TeX. It contains serif, sans serif, and monospaced fonts, each available in several weights and optical sizes.

The bodies of LaTeX documents are set in Roman (serif) type by default, but this can be changed by setting the family default:


where <family> is any of the following:

  • \rmdefault
  • \sfdefault
  • \ttdefault

Emphasizing text edit

Tex recognizes two types of markup commands:

  • Semantic - \emph{text} -- by default italise font. Can be overwritten by \renewcommand\emph{\textbf}. Replace textbf per requirements/preferences.
  • Visual - which actually applies required formatting:
    • Family - \textrm{} \textsf{} \texttt
    • Weight - \textbf{} - bold, \textmd{} - medium
    • Shape - \textup{}, \textit{}, \textsl{}

There are variation of the visual markup for a specific font. The above are commonly used elements. For reference on the items see section Font styles

To add some emphasis to a word or a phrase, use the \emph{text} command, which usually italicizes the text.

I want to \emph{emphasize} a word.

I want to emphasize a word.

The command is dynamic: if you emphasize a word which is already in an emphasized sentence, it will be reverted to the upright font.

\emph{In this emphasized sentence, there is an emphasized \emph{word} which looks upright.}

In this emphasized sentence, there is an emphasized word which looks upright.

Text may be emphasized more heavily through the use of boldface, particularly for keywords the reader may be trying to find when reading the text. As bold text is generally read before any other text in a paragraph or even on a page, it should be used sparingly. It may also be used in place of italics when using sans-serif typefaces to provide a greater contrast with unemphasized text. Bold text can be generated with the \textbf{text} command.

\textbf{Bold text} may be used to heavily emphasize very important words or phrases.

Bold text may be used to heavily emphasize very important words or phrases.

Font styles edit

Typefaces usually come in various styles and weights, such as italic and bold. The following table lists the commands you will need to access typical font shapes.

Note: Paragraph breaks are not allowed inside the command forms.

LaTeX command Equivalent switch Output style Remarks
\textnormal{...} {\normalfont ...} document font family This is the default or normal font.
\emph{...} {\em ...} emphasis Typically italics. Using emph{} inside of italic text removes the italics on the emphasized text.
\textrm{...} {\rmfamily ...} roman font family
\textsf{...} {\sffamily ...} sans serif font family
\texttt{...} {\ttfamily ...} teletypefont family This is a fixed-width or monospace font. Depending on the font zero have a dash in it to differenciate from letter O
\textup{...} {\upshape ...} upright shape The same as the normal typeface.
\textit{...} {\itshape ...} italic shape
\textsl{...} {\slshape ...} slanted shape A skewed version of the normal typeface (similar to, but slightly different from, italics).
\textsc{...} {\scshape ...} Small Capitals
\uppercase{...} uppercase (all caps) Also \lowercase. There are some caveats, though; see here.
\textbf{...} {\bfseries ...} bold
\textmd{...} {\mdseries ...} medium weight The normal font weight.
\textlf{...} {\lfseries ...} light A font weight lighter than normal. Not supported by all typefaces.

Generally, one should prefer the commands over their equivalent switches because the former automatically corrects spacing immediately following the end of the selected style.

You may have noticed the absence of underline—this is because underlining is a byproduct of the typewriter era, and is not recommended when bold and italic type is available instead.[2] However, underlining can be useful in some cases, such as to draw attention to changes during editing. Although underlining is available via the \underline{...} command, text underlined in this way will not break properly. Instead, use the \ul{...} command from the soul package or \uline{...} command from the ulem (underline emphasis) package. By default, the latter package also overrides \emph to underline instead of italicize the text. In the likely case that this is not your intent, use the normalem option, i.e. \usepackage[normalem]{ulem}. Both packages also provide strikethrough text with \st{...} or \sout{...}, respectively.

Sizing text edit

Built-in sizes edit

To scale text relative to the default body text size, use the following commands:

Command Output
\tiny sample text
\scriptsize sample text
\footnotesize sample text
\small sample text
\normalsize sample text
\large sample text
\Large sample text
\LARGE sample text
\huge sample text
\Huge sample text

These commands change the size within a given scope. For instance {\Large some words} will change the size of only some words, and does not affect the font in the rest of the document. It will work for most parts of the text.


These commands cannot be used in math mode. However, part of a formula may be set in a different size by using an \mbox command containing the size command. The new size takes effect immediately after the size command; if an entire paragraph or unit is set in a certain size, the size command should include the blank line or the \end{...} which delimits the unit.

By default, \normalsize is 10 points, but this can be changed in the \documentclass declaration, e.g. \documentclass[12pt]{article}. Note that not every document class has unique sizes for all of the above size commands.

Absolute Point Sizes
size standard classes (except slides), beamer AMS classes, memoir slides
[10pt] [11pt] [12pt] [10pt] [11pt] [12pt]
\tiny 5 6 6 6 7 8 13.82
\scriptsize 7 8 8 7 8 9 16.59
\footnotesize 8 9 10 8 9 10 16.59
\small 9 10 10.95 9 10 10.95 16.59
\normalsize 10 10.95 12 10 10.95 12 19.907
\large 12 12 14.4 10.95 12 14.4 23.89
\Large 14.4 14.4 17.28 12 14.4 17.28 28.66
\LARGE 17.28 17.28 20.74 14.4 17.28 20.74 34.4
\huge 20.74 20.74 24.88 17.28 20.74 24.88 41.28
\Huge 24.88 24.88 24.88 20.74 24.88 24.88 41.28

Points in TeX follow the standard American point system in which 1 pt is approximately 0.35136 mm. The standard point size used in most modern computer programs (known as the desktop publishing point or PostScript point) has 1 pt equal to approximately 0.3527 mm while the standard European point size (known as the Didot point) had 1 pt equal to approximately 0.37597151 mm (see: point (typography)).

Arbitrary sizes edit

The \tiny...\Huge commands are often enough for your needs, but you may occasionally want an arbitrary font size. This is done with \fontsize{<size>}{<line space>}\selectfont. For example:


sets the current font size to 5cm with 5.5 centimeter leading.

If you are using the latex or pdflatex engines, you may get a warning similar to the following:

LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <142.26378> not available
(Font)              size <24.88> substituted on input line 103.

This is because these older engines only support a fixed set of sizes—between 5 and 17 point. When he designed Computer Modern, Knuth created individual font files for these sizes, each with stroke widths and spacing optimized for that particular size. To avoid distorting them, scaling these fonts is disabled by default.

This issue is avoided when using lualatex or xelatex, which use Latin Modern - a vectorized version of Computer Modern - as the default font family. This still provides individual files at each of the original optical sizes, but will automatically scale the closest one when asked for an arbitrary size.

Using alternative fonts edit

When TeX was originally designed in the late 1970s, vector-based fonts didn't exist in any common format - PostScript wouldn't be released until 1982. Consequently, TeX was designed to use its own font system, METAFONT. Over time, TeX (and LaTeX) were extended to support PostScript fonts, and modern LaTeX engines also support the TrueType (TTF) and OpenType (OTF) fonts found on modern systems.

Using TTF and OTF fonts edit

If you are using lualatex or xelatex, you can use TTF and OTF fonts with the fontspec package:



Lorem ipsum...

The [Ligatures=TeX] option allows you to use the standard TeX ligatures mentioned in the Text Formatting chapter instead of Unicode characters that are unlikely to be on your keyboard. For example, --- can be used to create em dashes (—), quotes can be typed ``like this'' instead of “like this”, and so on.

The fontspec package is extremely configurable. See the manual[3] for details, but some basics are covered below.

Selecting font files edit

Different weights and styles of a given typeface are usually stored as separate font files. A typical typeface might offer four files to represent its normal weight, italics, bold, and bold italics. Given a typefaces's name, fontspec can generally deduce the names of the individual files. However, many typefaces come in more than two weights—some versions of Futura, for example, comes in light, book, medium, demi, bold, and extra bold weights. Sometimes small caps are stored as separate files as well.

We might want to hand-pick weights to achieve a certain look or better match the weights of other fonts in our document. Continuing to use Futura as an example, say we want to use the "book" weight for our default weight, "demi" for bold, and the font files are named:

  • Futura-Boo for upright book weight
  • Futura-BooObl for oblique book weight
  • FuturaSC-Boo for small caps, book weight
  • Futura-Dem for upright demi(bold)
  • Futura-DemObl for oblique demibold

Our font setup might resemble:

    UprightFont = *-Boo,
    ItalicFont = *-BooObl,
    SmallCapsFont = *SC-Boo,
    BoldFont = *-Dem,
    BoldItalicFont = *-DemObl

Note that instead of typing out Futura-Boo, Futura-BooObl, and so on, we can use * to insert the base name.

Controlling font features edit

The OpenType (OTF) format allows type designers to embed font features that can be turned on and off, such as:

  • Alternate versions of glyphs
  • Lining and "oldstyle" figures, each with tabular and proportional spacing[4]
  • Up to three sets of ligatures: standard, contextual, and historical
  • Superscript and subscript glyphs
  • Small caps (in the same file as the standard upper and lowercase characters)

All of these features can be turned on and off using different fontspec options. If we wanted to set our body text in Linux Libertine with oldstyle, proportionally-spaced figures, for example, we might set up our fonts as follows:

    Numbers={OldStyle, Proportional}
]{Linux Libertine}

Features can be turned on and off using \addfontfeatures{...}. Say you wanted to set a table in lining, tabular figures:

{\addfontfeatures{Numbers={Lining, Tabular}}
    \begin{tabular}{l r}
        Widgets: & 25 \\
        Gadgets: & 6 \\
        Whatsits & 24 \\
} % Return to previous figure style

Changing fonts in latex and pdflatex edit

If you are not using one of the Unicode-aware engines, font selection is more complicated. (See the discussion of encoding below.) Useful resources for latex and pdflatex font configuration include:

Font encoding edit

Digitising human language is a complicated topic that has evolved significantly since TeX's inception.

Unicode edit

Today, text is usually represented in computer systems using Unicode. Briefly,

  • A Unicode text file is made of a series of code points, each of which can represent a character to be drawn, an accent or other diacritical mark to combine with an adjacent character, or some non-printing character, such as instruction to print subsequent text right-to-left.
  • One or more of these code points combines to represent a grapheme cluster or glyph, the shapes within a font that we informally call "characters".
  • Modern font formats such as TrueType and OpenType contain encoding tables which map code points to the glyphs the font file contains.

LuaLaTeX and XeLaTeX use these tools to render Unicode-encoded input files (LuaLaTeX accepts UTF-8 files, while XeLaTeX is a bit more flexible and also accepts UTF-16 and UTF-32) into PDF documents.

TeX encodings edit

The original TeX and LaTeX, designed long before the advent of Unicode, use a very different scheme. When using latex or pdflatex, you must choose an input encoding, which the engine uses to interpret your file, and an output encoding, which the engine uses to map your inputs to glyphs. The default font encoding is OT1, the encoding of the original Computer Modern fonts. It contains only 128 characters, many from ASCII, but leaving out some others and including a number that are not in ASCII. When accented characters are required, TeX creates them by combining a normal character with an accent. While the resulting output looks correct, this approach has some caveats compared to Unicode-based approaches:

  • It prevents automatic hyphenation from working inside words containing accented characters.
  • Searches for words with accents in PDFs will fail.
  • Extracting (e.g., via copy-paste) the umlaut 'Ä' via a PDF viewer actually extracts the two characters '"A'.
  • Some Latin letters cannot be created with this approach, to say nothing about letters of non-Latin alphabets such as Greek or Cyrillic.

To overcome these shortcomings, several other 8-bit output encodings were created. Extended Cork (EC) fonts in T1 encoding contains letters and punctuation characters for most European languages that use Latin alphabets. The LH font set contains letters necessary to typeset documents in languages using Cyrillic script. Because of the large number of Cyrillic glyphs, they are arranged into four font encodings—T2A, T2B, T2C, and X2. The CB bundle contains fonts in LGR encoding for the composition of Greek text. By using these fonts you can improve/enable hyphenation in non-English documents. Another advantage of using new CM-like fonts is that they provide fonts of CM families in all weights, shapes, and optically scaled font sizes.

All this is not possible with OT1; that's why you may want to change the font encoding of your document.

Note that different fonts support different output encodings. The default Computer Modern font does not support T1, for example. You will need Computer Modern Super (cm-super) or Latin Modern (lmodern), which are Computer Modern-like fonts with T1 support. If you have none of these, it is quite frequent (depends on your TeX installation) that tex chooses a Type3 font such as the Type3 EC, which is a bitmap font. Bitmap fonts look rather ugly when zoomed or printed.

The fontenc package tells LaTeX what font encoding to use. Font encoding is set with:


where encoding is the font encoding. It is possible to load several encodings simultaneously.

There is nothing to change in your document to use CM Super fonts (assuming they are installed), they will get loaded automatically if you use T1 encoding. For lmodern, you will need to load the package after the T1 encoding has been set:


The package ae (almost European) is obsolete. It provided some workarounds for hyphenation of words with special characters. These are not necessary any more with fonts like lmodern. Using the ae package leads to text encoding problems in PDF files generated via pdflatex (e.g. text extraction and searching), besides typographic issues.

PDF fonts and properties edit

PDF documents have the capability to embed font files. It makes them portable, hence the name Portable Document Format.

Many PDF viewers have a Properties feature to list embedded fonts and document metadata.

Many Unix systems make use of the poppler tool set which features pdfinfo to list PDF metadata, and pdffonts to list embedded fonts.

References edit

  1. Matthew Butterick. "Bold or italic". Practical Typography.
  2. Matthew Butterick. "Underlining". Practical Typography.
  4. Matthew Butterick. "Alternate figures". Practical Typography.

Previous: Colors Index Next: List Structures