There are two basic ways of changing fonts: you can either change the
font for a small selection of text, for example, if you want to
emphasize a word, or you may wish to change the font "from
this point onwards". The commands shown in
table 4.4 are of the first type (text-block commands),
whereas those shown in table 4.5 are of the second
type--a declaration (or modal
command). [What's wrong with \bf, \it
etc.?]
If you use an italic or slanted font declaration, you will need
to add an italic correction \/ at the end of the block
of text, when the last letter of the sloping text leans too
far over. For example, compare
{\itshape Some italic text} back to upright.
which yields
to
{\itshape Some italic text\/} back to upright.
which yields
In the first example, the final letter "t" in the word "text" leans too far over the space. In the second example, extra space (known as italic correction) is inserted.
If you use one of the text-block commands, such as
\textit, the italic correction is dealt with by the
command, so the above example would equivalent to:
\textit{Some italic text} back to upright.
which again yields
The effect is more noticeable when part of a word is stressed. For example:
{\itshape repeated}ly \textit{repeated}ly
produces
Environments can be used instead. Each environment has the same name as its corresponding declaration, but without the preceding backslash. For example:
\begin{sffamily}Some sans-serif text.\end{sffamily}
yields:
You can combine a font family with a given shape and weight using a variety of methods, such as:
{\sffamily\slshape Some slanted sans-serif text\/}
\textsl{\sffamily Some slanted sans-serif text}
\textsf{\textsl{Some slanted sans-serif text}}
\begin{sffamily}\slshape Some slanted sans-serif
text\/\end{sffamily}
Note that some combinations are not available, in which case LaTeX will give a warning message, [Warning: "Font shape ... not available"] and will substitute the font for what it considers to be the closest available match. [How to do bold-tt or bold-sc]
Note also that the command \emph,
the declaration \em and the
environment em behave slightly
differently to the corresponding \textit command,
\itshape declaration and itshape environment.
The latter simply use an italic font, whereas the former will toggle
between sloping and upright. So if the surrounding font is upright
then \emph, \em and em will use the
sloping font, but if the surrounding font is italic or slanted,
\emph, \em and em will use an upright
font. This is particularly useful in abstracts where the
abstract font varies between class
files. It is recommended that if your intention
is to emphasize something, you should use \emph etc. rather
than \textit etc. Examples:
Some \emph{emphasized} text.
yields
{\itshape Some \emph{emphasized} text.}
yields
{\sffamily Some \emph{emphasized} text.}
yields
Nicola L. C. Talbot.
School of Computing Sciences.
University of East Anglia.
Last Modified: 2008-01-15