LaTeX: Fonts

IMAGE logo
ONLINE HELP

Fonts

You will need to define your fonts at the beginning of any LaTeX document. After defining them, you'll only need to use font commands to change the font, for instance to bold or italicize a word or words.

In LaTeX, there are generally three styles within any font family, which are distinguished as font family, font shape, and font series. The commands for family, shape, and series are commutative, so they can be combined as with the command:
{\bfseries\itshape\sfffamily text you want in bold, italics, and sans-serif}

The above command would make the type in bold, italic, and sans-serif. The commands for font can only be combined as long as they aren't contradictory. Contradictory font commands would be trying to get slanted italics, or attempting to combine different font families.

LaTeX expects three font families as defaults.

Font Family CodeCommand
Roman (serif, with tails on the uprights) as the defaultrm\textrm{text}
Sans-serif, with no tails on the uprightssf\textsf{text}
Monospace (fixed-width or typewriter)tt\texttt{text}

For the common type shape and series commands, use the simplified syntax in the table below.

Type StyleCommandExample
Italic\textit{words in italics}puts the words in the brackets in italics
Slanted\textsl{words to be slanted}puts a few words in slanted type.
Small Capitals\textsc{words to be in small capitals}puts the words in the brackets in small capitals
Bold\textbf{words to be in bold}puts the words in brackets in bold
Sans-serif\textsf{words to be in sans-serif}puts the words into sans-serif type
Monospace\texttt{words to be in monospace}puts a few words in typewriter type
Emphasis\emph{word}italicizes word(s). When the surrounding text is in italics, LaTeX knows to read \emph{words} as emphasized and so it will unitalicize words when used within surrounding text already in italics.
Monospace{\tt words}Monospaces all words within the curly braces.
Italics{\it words}Italicizes all words within the curly braces.

Font Size

Font size in LaTeX is controlled with font size commands. Please note that you will need to reset the font size with one of these commands after changing it. Also, note that certain commands may overrule the font size commands; for instance, the \end{center} will cancel the font size commands. If you want to select just some text for a size change, use the following commands in the bracket, command, bracket words, close bracket, close bracket syntax; like this: {\huge{short}}. The commands and their sizes are listed in the table below.

CommandNominal Point SizeExact Point Size
\tiny55
\scriptsize77
\footnotesize88
\small99
\normalsize1010
\large1212
\Large1414.40
\LARGE1817.28
\huge2020.74
\Huge2424.88

Changing Fonts

If you use any packages that change the font, those packages will change the default of the same type. For instance, using the Bookman font (which is done by using this command in the preamble: \usepackage{bookman})makes the default Roman font Bookman, but leaves the sans-serif and monospace fonts alone. Similarly, using the Helvetica font (done with this command in the preamble: \usepackage{helvet}) changes the default sas-serif font to Helvetica, but leaves the Roman and Monospace fonts alone. When changing fonts, you can do so like this, using the command and calling the particular font, or you can change all of the default fonts at once with the following commands.

CommandChanges the defaults to
timesTimes, Helvetica, Courier
pslatexsame as Times, but uses a specially narrowed Courier. This is preferred over Times because of the way it handles Courier.
newcentNew Century Schoolbook, Avant Garde, Courier
palatinoPalatino, Helevetica, Courier
palatcmchanges the Roman to Palatino only, but uses CM mathematics

For more on the fonts available with a typical LaTeX installation, please see the documentation in the IMAGE Lab (page 75 in A Beginner's Guide to Typsetting with LaTeX). Also, please note that there are many more fonts available for download.

Changing Fonts Temporarily

To change the font temporarily, first group the text where you want the font changed in curly braces. Then, use the commands \fontencoding, \fontfamily, and \selectfont. These commands should be used immediately inside the opening curly braces, like:

{\fontfamily{phv}\selectfont Helvetica looks like this}
and {\fontencoding{OT1}\fontfamily{ppl} Palatino looks like this}.
}

The above commands would make a sentence where "Helvetica looks like this" would be in the Helvetica font (phv is the code for Helvetica) and "and" would be in the default font and "Palatino looks like this" would be in the Palatino font (denoted with the Palatino code, which is ppl). This example would be very rare, but it shows how the fonts can be changed in the most extreme circumstances.

Font Color

Using the color package (which must be called in the Preamble), you can typeset LaTeX in any color. To add the color package in the Preamble, use the command:
\usepackage{color}

The color package makes a default color package available. The colors available with this are: red, green, and blue (for screen display) and cyan, magenta, and yellow (to go with black for the CMYK color model for printing). To make a single word or phrase in color, use the command:
\textcolor{color}{words to be in color}
For example, \textcolor{red}{text in red}

For more on color and how to use 255 colors, please see the documentation in the IMAGE Lab.

Back


Home || Help Home || Contact IMAGE || Search the Help Pages Updated Monday, 14-Jul-2003 13:48:50 EDT