All the keyboard characters, except for ten characters that are used for special purposes, can be typed in directly. The nine special characters $ & % #_ { } ˜ and ^ are produced by
The tenth character can be produced with $ackslash$.
The following commands sequences are used to produce accented letters, foreign characters, and a few special symbols. These commands are used in the normal text mode.
LATEX also has a great many symbols that can be used in math mode. Rather than list them all here, a complete listing of these symbols is given in Appendix A.
has several sizes of fonts that can be invoked by the { sizecmd text…
} construct. The font-size commands (sizecmd
) and the size of fonts they produce are listed below. The three options in this table refer to the default font size specified for the document as a style option in the documentstyle
command.
Standard has available the following font styles (shown in 10-point size). Notice that the last four styles are used only in math mode.
The standard font style used by is computer modern. A standard set of 75 different font face styles is usually installed and can be made available to . However, generally not all these styles are known to . In the file Ifonts. tex, which is used by to make an executable version of , many font definitions will be found commented out because of the limited internal memory possessed by most versions of . In the following table the names of the 10-point computer modern fonts that are in the standard 75-font set are listed. Those fonts not normally defined for are indicated by an asterisk (*).
However, as long as an undefined font is available, it can still be used in a document. For a particular font to be available, its metric .TFM file (which defines each character’s size) and its bit-mapped . PK file (use by the DVI drivers for screen previewing and printing) must be where can find them. If the nondefined font is available, first use the
ewfont
command to define a font command for it. For example, suppose you want to use 10-point italic sans serif (font cmssi10
). First place in the preamble or document the statement
ewfont{ISS}{cmssi10
} to define ISS
as the font change command for this font style. Then-the sequence {ISS Italic Sans Serif
} will produce Italic Sans Serif.
In the
ewfont
command can also be used to define a new font command that magnifies or scales a specific font. For example, suppose you want to define the font command BSS (Big Sans Serif) to refer to 10-point sans serif expanded to a height of 17 points, place the following statement in your document
ewfont{BSS}{cmsslO scaledmagstep3}
The optional parameter scaledmagstep3
indicates that the 10-point cmss10 font (computer modern, sans serif, 10 point) is to be magnified or scaled by a factor of 1.23 1.728. Then in your document the sequence {BBS BigSS
} will produce BigSS, which is 17 points high.
The six allowed values of magstep
and their magnification factors are:
Be aware that not all font styles are usually available in all magstep
sizes. The less frequently used 10-point font styles, for example, are usually available only in the lower two magsteps
.
Most characters in a particular font family change slightly in shape and density as the font size is adjusted. Scaling a font does not preserve these design differences. For instance, the computer modern roman font cmrlO scaled to 17 points (magstep 3
) is slightly different from the true 17-point computer modern font (cmrl7
) as can be seen in the following example:
Notice that the scaled font has heavier and wider characters, which are also shaped slightly differently than the corresponding 17-point characters. Generally, you should use the font designed for the specified character height. Unfortunately, not all fonts are available in all sizes, and when you need to use a particular font size that is unavailable then defining a scaled version of the font allows you to approximate the needed font.
Not all font styles are available in all font sizes. Each style and size combination requires its own font file (.PK and .TFM files). Some are preloaded when is started, others are only loaded on demand to reduce memory requirements, and others are unavailable. In normal text mode, loaded and loaded-on-demand fonts behave the same. If a particular font style of some unusual size is not available, LATEX will generally substitute the font of closest size and issue a warning message. The available font style and size combinations depend on your particular implementation (see your local guide). Table 1.1 shows the font style and size availability for a typical implementation (in this case ).
In normal text (paragraph and LR modes), loaded and loaded-on-demand fonts behave the same. In math mode they do not; only preloaded fonts may be used. Loaded fonts will be substituted, often without warning, for unavailable or load-on-demand fonts used in math expressions. To use load-on-demand fonts in math mode, you must first load them with the load
command. Here is an example in 8-point type for which the sans serif style is not preloaded.
Table 1.1: Typical availability of font styles
Ligatures such as ff fi fl ffl ffi or ff fi fl ffl ffi are performed automatically by . However, on rare occasions you may wish to suppress a ligature. For example, the word “shelfful” without a ligature looks better than “shelfful” with a ligature. To suppress the ligature, use shelf{}ful.
can use virtually any font once appropriate font files have been created. For this reason, is widely used to prepare many foreign language documents.
To use a particular nonstandard font (one that is not part of ), the metric .TFM
file (which defines each character’s size) and the bit-mapped .PK file (used by DVI drivers for screen previewing and printing) for the font set must first be obtained and made available to . Then the
ewfont
command is used in the document preamble to define a command name for specifying the use of the fonts. For example, in the preamble you might use
ewfont{Fr}{eufmlO}’%—Fraktur, medium face ewfont{Sc}{eusmlO} %—Script, medium face ewfont{Bb}{msbmlO}’%—Blackboard, med. face
to define Fr, Sc,
and Bb
as special font commands. (The font files EUFN10.PK, EUSM10.PK,
and MSBM10.PK
and their corresponding .TFM
files are part of .) To produce a scaled 12-point version of the Fraktur font use
ewfont{Fr}{eufmlO scaledmagstepl} %-- 12pt Fraktur
To use the Fraktur (German) font in the normal text mode of , simply invoke {Fr .. . .
} to place the text between the braces in Fraktur font. For example, {Fr ABC…XYZ
}, {Sc ABC… XYZ
}, and {Bb ABC…XYZ
} produce
A font set contains 128 characters, many of which are not alphabetic characters and cannot be represented by a keyboard symbol. To use these characters in your document, the symbol
command is used. For example, R is character 82 in EUSM10 and can be referred to as either {Sc R
} or {Sc symbol{82
}}. Some symbols, such as, can be invoked only with the symbol
command, as in this case with {Bb symbol
{121}}.
To find the decimal number of a particular character in a font file, it is necessary to obtain a listing of the characters with their numbers. Such a font character listing is often presented in a table similar to that of Table 1.2.
Table 1.2: Example decimal character table for the blackboard font set msbmlO
The new font commands Fr, Sc,
and Bb
cannot be used in math mode. You must place these fonts in an mbox
if they are to be used in a formula. For example, to produce = D x R, you must use
$mbox{Sc E} = mbox{Sc D} imes mbox{Sc R}$.
The command def
can be used to define a shorthand command to print a particular character from a nonstandard font set when in math mode. For example, first place in the preamble the sequences
so that ɛ = DxR can be entered more compactly as $ScE = ScD imes ScR$.
The standard font collection used by also has a large 1-inch font, cminch,
that can be used by defining in the preamble the font commands
Note, this font cannot be magnified, although its interletter spacing can be decreased by scaling it to less than the normal size of 1000 (see the previous definition of sqBIG
). Here are three examples with different spacing between letters. These examples were produced with the commands {sqBIG HUGE}, {BIG HUGE}
, and, to increase the normal inter let ter spacing, {BIG Hhf il Uhf il Ghfil E
}.
Sec. 1.8. Improvised Special Characters
Sometimes the standard fonts available to will not contain some special character that you need. Although the best solution is to use METRFONT
(a font generation program) to generate a special font set that contains the needed character, you can often approximate the character by superimposing several existing characters and/or line rules. Here are three examples
One symbol missing from ’s font sets is the symbol for cents. Here are four commands that approximate this symbol:
Here are the results of these different attempts. None is perfect.
The following commands in the preamble will allow you to use a poor man’s approximation to blackboard fonts.
ewcommand{BBR}{{sf Rhspace*{-0.9ex}
ule{0.15ex}{l.5ex}hspace*{0.9ex}}}
ewcommand{BBN}{{sf Nhspace*{-1. Oex}
ule{0.15ex}{l.3ex}hspace*{1.0ex}}}
ewcommand{BBQ}{{sf Qhspace*{-1.lex}
ule{0.15ex}{l.5ex}hspace*{l.lex}}}
ewcommand{BBC}{{sf Chspace*{-0.9ex}
ule{0.15ex}{l.3ex}hspace*{0.9ex}}}
ewcommand{BBD}{{sf Dhspace*{-0.9ex}
ule{0.15ex}{l.5ex}hspace*{0.9ex}}}
Thus, to produce , enter BBR BBN BBQ BBC BBD.
Just for fun, here are three faces: smiley
lahey
f rowney
The 10-point macros for smiley
, frowney
, and lahey
are as follows (for 11-point and 12-point documents, some tweaking of the dimensions is needed).
’%-- Smiley Face
def smiley{hbox{large$igcirc$hspace{-. 80em}’%
aise.2exhbox{$cdotcdot$}kern-.61em ’%--56
lower.2exhbox{scriptsize$smile$}} }
%-- Frowney Face
deffrowney{hbox{large$igcirc$hspace{-. 80em}’%
aise.2exhbox{$cdotcdot$}kern-.635em
lower.2exhbox{scriptsize$frown$}} }
’-- Blahey Face
def lahey{hbox{large$igcirc$hspace{-. 80em}*/,
aise.2exhbox{$cdotcdot$>kern-.46em
lower.3exhbox{scriptsizehbox{—}}} }
The discussion in this chapter about using different fonts is based on the original font selection scheme described in Lamport’s book. In the late 1980s, wizards Frank Mittelbach and Rainer Schöpf devised an alternative and improved scheme for using fonts with (as well as with and ). This new font selection scheme (NFSS) lets you use all the standard fonts (that is, those that come with ) and nonstandard fonts in both text and math modes without having to preload all the fonts (and thereby consume useful memory).
The NFSS also allows you to use the old font selection scheme to ensure backward compatibility. Moreover, it is the only practical way of using fonts and postscript fonts with . This new scheme will eventually become a standard part of in future releases, although many implementations of have already been modified to use the NFSS.