From Wikibooks, open books for an open world
Jump to: navigation, search
LaTeX logo.svg


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


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

Technical Texts

  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

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. 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

Fonts are a complex topic. For common documents, only Font families, Emphasizing text, and Font encoding are really needed. The other sections are more useful to macro writers or for very specific needs.


The digital fonts have a long and intricate history.

Originally TeX was conceived to use its own font system, MetaFont, designed by D. Knuth. The default font family for TeX and friends is called Computer Modern. These high quality fonts are scalable, and have a wide range of typographical fine tuning capabilities.

Standard tex compilers will let you use other fonts. There are many different font types, such as PostScript Type1/Type3 fonts and bitmap fonts. Type1 are outline fonts (vector graphics) which are commonly used by pdftex. Bitmap fonts are raster graphics, and usually have very poor quality, which can easily be seen when zooming or printing a document. Type3 is a superset of Type1 and has more functionalities from Postscript, such as embedding raster graphics. In the TeX world, Type3 fonts are often used to embed bitmap fonts.

It should be noticed that fonts get generated the first time they are required, hence the long compilation time.

However, MetaFont is internally a quite complex font system, and the most popular font systems as of this day are Truetype font (ttf) and OpenType font (otf). With modern TeX compilers such as xetex and luatex it is possible to make use of such fonts in LaTeX documents. If you want/have to stick with the standard compilers, the aforementioned font types must first be converted and made available to LaTeX (e.g. converted to Type1 fonts). The external links section below has some useful resources.

In LaTeX, there are many ways to specify and control fonts. It is a very complex matter in typography.

Font families[edit]

There are many font families e.g. Computer Modern, Times, Arial, and Courier. Those families can be grouped into three main categories: roman (rm) or serif, sans serif (sf) and monospace (tt) (see Typeface for more details). Each font family comes with the default design which falls into one of those categories; however, it is interchangeable among them. Computer Modern Roman is the default font family for LaTeX. Fonts in each family also have different properties (size, shape, weight, etc.). Families are meant to be consistent, so it is highly discouraged to change fonts individually rather than the whole family.

The three families are defined by their respective variables:

  • \rmdefault
  • \sfdefault
  • \ttdefault

The default family is contained in the \familydefault variable, and it is meant to have one of the three aforementioned variables as value. The default is defined (in the preamble) like the following assignment:


This will turn all the part of the document using the default font to the default sans serif, which is Computer Modern Sans Serif if you did not change the default font.

Changing font families usually works in two steps:

  1. First specify which family you want to change (rm, sf or tt).
  2. Second specify the new default family if it is not rm.

Mathematical fonts is a more complex matter. Fonts may come with a package that will take care of defining all three families plus the math fonts. You can do it by yourself, in which case you do not have to load any package.

Below is an example[1] that demonstrates how to change a specific family.

% Default font (\familydefault = \rmdefault = Computer Modern Roman)
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

% Palatino font (ppl must be installed).
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

% Iwona font (iwona must be installed).
Lorem ipsum dolor sit amet, consectitur adipiscing elit.

LaTeX font example.png

The three default family font variables and the \familydefault variable should not be confused with their respective switch:

  • \normalfont
  • \rmfamily
  • \sffamily
  • \ttfamily

Available LaTeX Fonts [2][edit]

To choose a font of your liking, please visit Here are some common examples.

Below are some fonts which are installed by default.

Serif Fonts[edit]

Abbreviation Font Name
cmr Computer Modern Roman (default)
lmr Latin Modern Roman
pbk Bookman
bch Charter
pnc New Century Schoolbook
ppl Palatino
ptm Times

Sans Serif Fonts[edit]

Abbreviation Font Name
cmss Computer Modern Sans Serif (default)
lmss Latin Modern Sans Serif
pag Avant Garde
phv Helvetica

Typewriter Fonts[edit]

Abbreviation Font Name
cmtt Computer Modern Typewriter (default)
lmtt Latin Modern
pcr Courier

Furthermore, the Bera Mono (BitStream Vera Mono) and LuxiMono fonts were designed to look good when used in conjunction with the Computer Modern serif font.


Cursive Fonts[edit]

Since LaTeX has no generic family group for cursive fonts, these fonts are usually assigned to the roman family.

Abbreviation Font Name
pzc Zapf Chancery

Mathematical Formula Fonts[edit]

Abbreviation Font Name
cmm Computer Modern (math italic)
cmsy Computer Modern (math symbols)
zplm Palatino (math)

Emphasizing text[edit]

In order to add some emphasis to a word or a phrase, the simplest way is to use the \emph{text} command, which usually italicizes the text. Italics may be specified explicitly with \textit{text}.

I want to \emph{emphasize} a word.


Note that the \emph 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 encoding[edit]

A character is a sequence of bytes, and should not be confused with its representation, the glyph, which is what the reader sees. So the character 'a' has different representations following the used font, for example the upright version, the italic version, various weights and heights, and so on.

Upon compilation, tex will have to choose the right font glyph for every character. This is what is called font encoding. The default LaTeX font encoding is OT1, the encoding of the original Computer Modern TeX text 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 perfect, this approach has some caveats.

  • It stops the automatic hyphenation from working inside words containing accented characters.
  • Searches for words with accents in PDFs will fail.
  • Extracting ('e.g.' copy paste) the umlaut 'Ä' via a PDF viewer actually extracts the two characters '"A'.
  • Besides, some of Latin letters could not be created by combining a normal character with an accent, to say nothing about letters of non-Latin alphabets, such as Greek or Cyrillic.

To overcome these shortcomings, several 8-bit CM-like font sets were created. Extended Cork (EC) fonts in T1 encoding contains letters and punctuation characters for most of the European languages based on Latin script. 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 changing the font encoding will have some requirements over the fonts being used. The default Computer Modern font does not support T1. 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.

Font styles[edit]

Each family has its own font characteristics (such as italic and bold), also known as font styles, or font properties.

Font styles are usually implemented with different font files. So it is possible to build a new font family by specifying the font styles of different font families.


The following table lists the commands you will need to access the typical font shapes:

Attention: No paragraph breaks are allowed inside the command forms.

LaTeX command Equivalent to 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.
\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 A font weight in between normal and bold.
\textlf{...} {\lfseries ...} light A font weight lighter than normal. Not supported by all typefaces.

The commands in column two are not entirely equivalent to the commands in column one: They do not correct spacing after the selected font style has ended. The commands in column one are therefore in general recommended.

You may have noticed the absence of underline. This is because underlining is not recommended for typographic reasons (it weighs the text down). You should use emph instead. However underlining text provides a useful extra form of emphasis during the editing process, for example to draw attention to changes. Although underlining is available via the \underline{...} command, text underlined in this way will not break properly. This functionality has to be added with the ulem (underline emphasis) package. Stick \usepackage{ulem} in your preamble. By default, this overrides the \emph command with the underline rather than the italic style. It is unlikely that you wish this to be the desired effect, so it is better to stop ulem taking over \emph and simply call the underline command as and when it is needed.

  • To restore the usual \emph formatting, add \normalem straight after the document environment begins. Alternatively, use \usepackage[normalem]{ulem}.
  • To underline, use \uline{...} along with \usepackage[normalem]{ulem}..
  • To add a wavy underline, use \uwave{...} along with \usepackage[normalem]{ulem}..
  • For a strike-out (strikethrough), use \sout{...} along with \usepackage[normalem]{ulem}..
  • For a slash through each individual character \xout{...} along with \usepackage[normalem]{ulem}.

Some font styles are not compatible one with the other. But some extra packages will fill this hole. For bold small capitals, you might want to use:

% ...
\textsc{ \textbf{This is bold small capitals} }

Sizing text[edit]

To apply different font sizes, simply follow the commands on this table:

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, so 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.

The default for \normalsize is 10 point (option 10pt), but it may differ for some Document Styles or their options. The actual size produced by these commands also depends on the Document Style and, in some styles, more than one of these size commands may produce the same actual size.

Note that the font size definitions are set by the document class. Depending on the document style the actual font size may differ from that listed above. And not every document class has unique sizes for all 10 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

As a technical note, points in TeX follow the standard American point size 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)).

Local font selection[edit]

You can change font for a specific part of the text. There are four font properties you can change.

The font encoding, such as OT1 (TeX default) or T1 (extended characters support, better PDF support, widely used).
The font family.
The series: l=light, m=medium, b=bold, bx=very bold.
The shape: it=italic, n=normal, sl=slanted, sc=small capitals.
Some text in anttlc...

The \selectfont command is mandatory, otherwise the font will not be changed. It is highly recommended to enclose the command in a group to cleanly return to the previous font selection when desired.

You can use all these commands in a row:

Some text in anttlc...

The default values are stored in \encodingdefault, \familydefault, \seriesdefault and \shapedefault. Setting back the default font properties can be done with


For short, you can use the \usefont{<encoding>}{<family>}{<series>}{<shape>} command.

\usefont{T1}{cmr}{m}{n} % Computer Modern Roman (TeX default) in T1 encoding. May lead to bad text quality if you do not have cm-super installed.
\usefont{T1}{phv}{m}{sc} % phv family (sans serif) medium small capitals.
\usefont{T1}{ptm}{b}{it} % ptm family bold italic
\usefont{U}{pzd}{m}{n}   % ...

Arbitrary font size[edit]

The \tiny...\Huge commands are often enough for most contents. These are fixed sizes however. In most document processors, you can usually choose any size for any font. This is because the characters actually get magnified. If it usually looks correct for medium sizes, it will look odd at extreme sizes because of an unbalanced thickness. In TeX it is possible to change the magnification of anything, but highly discouraged for the aforementioned reason. Changing the font size is made by changing the font file. Yes, there is a file for every size: cmr10 for Computer Modern Roman 10pt, cmr12 for Computer Modern Roman 12pt, etc. This ensure the characters are correctly balanced and remain readable at all defined sizes.

You may choose a particular font size with the \fontsize{<size>}{<line space>} command. Example:

{\fontsize{5cm}{5.5cm}\selectfont This is big!}

If you are using the default Computer Modern font encoding, you may get the following message:

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

In that case you will notice that the font size is by default restricted to a set of fixed sizes as noted above. You can use the fix-cm or type1cm packages to allow computer modern fonts to be scaled to arbitrary values.

Finding fonts[edit]

You will find a huge font directory along examples and configurations at TUG Font Catalogue.

Using arbitrary system fonts[edit]

If you use the XeTeX or LuaTeX engine and the fontspec package, you'll be able to use any font installed in the system effortlessly. XeTeX also allows using OpenType technology of modern fonts like specifying alternate glyphs and optical size variants. XeTeX also uses Unicode by default, which might be helpful for font issues.

To use the fonts, simply load the fontspec package and set the font:



Lorem ipsum...

Then compile the document with xelatex or lualatex. Note that you can only generate .pdf files, and that you need a sufficiently recent TeX distribution (TeX Live 2009 should work for XeTeX and Tex Live 2010 for LuaTeX). Also you should not load the inputenc or fontenc package. Instead make sure that your document is encoded as UTF-8 and load fontspec, which will take care of the font encoding. To make your document support both pdflatex and xelatex/lualatex you can use the \ifxetex/ \ifluatex macro from the ifxetex/ ifluatex package. For example for xelatex


  \defaultfontfeatures{Ligatures=TeX} % To support LaTeX quoting style
  \setromanfont{Hoefler Text}

Lorem ipsum...

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.

Useful websites[edit]

TrueType (ttf) fonts[edit]


  1. found at the Google discussion group latexlovers
  2. Taken from

Previous: Colors Index Next: List Structures