Two important aspects of selecting a font are specifying a size and a style. The LaTeX commands for doing this are described here.
The following type style commands are supported by LaTeX.
In the table below the listed commands, the \text...
commands,
is used with an argument, as in \textit{text}
. This is
the preferred form. But shown after it, in parenthesis, is the
corresponding declaration form, which is sometimes useful. This form
takes no arguments, as in {\itshape text}
. The scope of
the declaration form lasts until the next type style command or the end
of the current group. In addition, each has an environment form such as
\begin{itshape}...\end{itshape}
.
These commands, in both the argument form and the declaration form, are
cumulative; for instance you can get bold sans serif by saying either of
\sffamily\bfseries
or \bfseries\sffamily
.
One advantage of these commands is that they automatically insert italic
corrections if needed (see \/). Specifically, they insert the
italic correction unless the following character is in the list
\nocorrlist
, which by default consists of a period and a comma.
To suppress the automatic insertion of italic correction, use
\nocorr
at the start or end of the command argument, such as
\textit{\nocorr text}
or \textsc{text \nocorr}
.
\textrm (\rmfamily)
Roman.
\textit (\itshape)
Italics.
\textmd (\mdseries)
Medium weight (default).
\textbf (\bfseries)
Boldface.
\textup (\upshape)
Upright (default).
\textsl (\slshape)
Slanted.
\textsf (\sffamily)
Sans serif.
\textsc (\scshape)
Small caps.
\texttt (\ttfamily)
Typewriter.
\textnormal (\normalfont)
Main document font.
Although it also changes fonts, the \emph{text}
command
is semantic, for text to be emphasized, and should not be used as a
substitute for \textit
. For example, \emph{start
text \emph{middle text} end text}
will result in the
start text and end text in italics, but middle text
will be in roman.
LaTeX also provides the following commands, which unconditionally
switch to the given style, that is, are not cumulative. They are
used as declarations: {\cmd...}
instead of
\cmd{...}
.
(The unconditional commands below are an older version of font switching. The earlier commands are an improvement in most circumstances. But sometimes an unconditional font switch is precisely what you want.)
\bf
Switch to bold face.
\cal
Switch to calligraphic letters for math.
\it
Italics.
\rm
Roman.
\sc
Small caps.
\sf
Sans serif.
\sl
Slanted (oblique).
\tt
Typewriter (monospace, fixed-width).
The \em
command is the unconditional version of \emph
.
The following commands are for use in math mode. They are not
cumulative, so \mathbf{\mathit{symbol}}
does not
create a boldface and italic symbol; instead, it will just be in
italics. This is because typically math symbols need consistent
typographic treatment, regardless of the surrounding environment.
\mathrm
Roman, for use in math mode.
\mathbf
Boldface, for use in math mode.
\mathsf
Sans serif, for use in math mode.
\mathtt
Typewriter, for use in math mode.
\mathit
(\mit)
Italics, for use in math mode.
\mathnormal
For use in math mode, e.g., inside another type style declaration.
\mathcal
Calligraphic letters, for use in math mode.
In addition, the command \mathversion{bold}
can be used for
switching to bold letters and symbols in
formulas. \mathversion{normal}
restores the default.
Finally, the command \oldstylenums{numerals}
will typeset
so-called “old-style” numerals, which have differing heights and
depths (and sometimes widths) from the standard “lining” numerals,
which all have the same height as uppercase letters. LaTeX’s
default fonts support this, and will respect \textbf
(but not
other styles; there are no italic old-style numerals in Computer
Modern). Many other fonts have old-style numerals also; sometimes the
textcomp
package must be loaded, and sometimes package options
are provided to make them the default. FAQ entry:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=osf.
The following standard type size commands are supported by LaTeX. The table shows the command name and the corresponding actual font size used (in points) with the ‘10pt’, ‘11pt’, and ‘12pt’ document size options, respectively (see Document class options).
Command | 10pt | 11pt | 12pt |
---|---|---|---|
\tiny | 5 | 6 | 6 |
\scriptsize | 7 | 8 | 8 |
\footnotesize | 8 | 9 | 10 |
\small | 9 | 10 | 10.95 |
\normalsize (default) | 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 |
The commands are listed here in declaration forms. You use them by declaring them, as with this example.
\begin{quotation} \small The Tao that can be named is not the eternal Tao. \end{quotation}
The scope of the \small
lasts until the end of the
quotation
environment. It would also end at the next type style
command or the end of the current group, so you could enclose it in
extra curly braces {\small We are here, we are here, we are
here!}
. You can instead use the environment form of these commands;
for instance, \begin{tiny}...\end{tiny}
.
These commands are primarily intended for writers of macros and packages. The commands listed here are only a subset of the available ones.
\fontencoding{encoding}
Select the font encoding, the encoding of the output font. There are a
large number of valid encodings. The most common are OT1
,
Knuth’s original encoding for Computer Modern (the default), and
T1
, also known as the Cork encoding, which has support for the
accented characters used by the most widespread European languages
(German, French, Italian, Polish and others), which allows TeX to
hyphenate words containing accented letters. For more, see
https://ctan.org/pkg/encguide.
\fontfamily{family}
Select the font family. The web page http://www.tug.dk/FontCatalogue/ provides one way to browse through many of the fonts easily used with LaTeX. Here are examples of some common families.
pag | Avant Garde |
fvs | Bitstream Vera Sans |
pbk | Bookman |
bch | Charter |
ccr | Computer Concrete |
cmr | Computer Modern |
cmss | Computer Modern Sans Serif |
cmtt | Computer Modern Typewriter |
pcr | Courier |
phv | Helvetica |
fi4 | Inconsolata |
lmr | Latin Modern |
lmss | Latin Modern Sans |
lmtt | Latin Modern Typewriter |
pnc | New Century Schoolbook |
ppl | Palatino |
ptm | Times |
uncl | Uncial |
put | Utopia |
pzc | Zapf Chancery |
\fontseries{series}
Select the font series. A series combines a weight and a width. Typically, a font supports only a few of the possible combinations. Some common combined series values include:
m | Medium (normal) |
b | Bold |
c | Condensed |
bc | Bold condensed |
bx | Bold extended |
The possible values for weight, individually, are:
ul | Ultra light |
el | Extra light |
l | Light |
sl | Semi light |
m | Medium (normal) |
sb | Semi bold |
b | Bold |
eb | Extra bold |
ub | Ultra bold |
The possible values for width, individually, are (the meaning and relationship of these terms varies with individual typefaces):
uc | Ultra condensed |
ec | Extra condensed |
c | Condensed |
sc | Semi condensed |
m | Medium |
sx | Semi expanded |
x | Expanded |
ex | Extra expanded |
ux | Ultra expanded |
When forming the series string from the weight and width, drop the
m
that stands for medium weight or medium width, unless both
weight and width are m
, in which case use just one
(‘m
’).
\fontshape{shape}
Select font shape. Valid shapes are:
n | Upright (normal) |
it | Italic |
sl | Slanted (oblique) |
sc | Small caps |
ui | Upright italics |
ol | Outline |
The two last shapes are not available for most font families, and small caps are often missing as well.
\fontsize{size}{skip}
Set the font size and the line spacing. The unit of both parameters
defaults to points (pt
). The line spacing is the nominal
vertical space between lines, baseline to baseline. It is stored in the
parameter \baselineskip
. The default \baselineskip
for
the Computer Modern typeface is 1.2 times the \fontsize
.
Changing \baselineskip
directly is inadvisable since its value is
reset every time a size change happens; see \baselinestretch
, next.
\baselinestretch
LaTeX multiplies the line spacing by the value of the
\baselinestretch
parameter; the default factor is 1. A change
takes effect when \selectfont
(see below) is called. You can
make a line skip change happen for the entire document, for instance
doubling it, by doing \renewcommand{\baselinestretch}{2.0}
in
the preamble.
However, the best way to double-space a document is to use the setspace package. In addition to offering a number of spacing options, this package keeps the line spacing single-spaced in places where that is typically desirable, such as footnotes and figure captions. See the package documentation.
\linespread{factor}
Equivalent to
\renewcommand{\baselinestretch}{factor}
, and
therefore must be followed by \selectfont
to have any effect.
Best specified in the preamble, or use the setspace
package, as
just described.
\selectfont
The effects of the font commands described above do not happen until
\selectfont
is called, as in
\fontfamily{familyname}\selectfont
. It is often useful
to put this in a macro:
\newcommand*{\myfont}{\fontfamily{familyname}\selectfont}
(see \newcommand & \renewcommand).
\usefont{enc}{family}{series}{shape}
The same as invoking \fontencoding
, \fontfamily
,
\fontseries
and \fontshape
with the given parameters,
followed by \selectfont
. For example:
\usefont{ot1}{cmr}{m}{n}