Chapter 7. Fonts and Encodings

7.1. Introduction

Half of the job of (La)TeX as a typesetting system is to process the source document and to calculate from it the characters’ positions on the output page. But (La)TeX has only a primitive knowledge about these characters, which it basically regards as black boxes having a width, height, and depth. For each font these dimensions are stored in a separate external file, the so-called TeX font metric or .tfm file.

The character shapes that correspond to such a .tfm file come into play at a later stage, after (La)TeX has produced its .dvi file. Character placement information in the .dvi file and information about character shapes present in the .pk file or in outline descriptions (e.g., PostScript) are combined by a driver program that produces the character image on the output medium. Usually one driver program is needed for every output medium—for screen representation, a low-resolution laser printer, or other device. With TeX variants such as pdfTeX or VTeX that bypass the production of .dvi output and instead directly generate PDF or PostScript output, the situation is slightly different (but, as far as LaTeX is concerned, similar). In that case the character shapes are “added” when the underlying formatter produces the final output format. That is, the driver program is internal, but the basic concepts are identical.

7.1.1. The history of LaTeX’s font selection scheme (NFSS)

When TeX was developed in 1979, only a dozen fonts were set up for use with the program: the “Almost Computer Modern” fonts, developed by Donald Knuth along with TeX. With only this restricted set of fonts being available, a straightforward approach for accessing them was used: a few control sequences were defined that changed from one external font to another.

This situation had not greatly changed five years later, when LaTeX was first released. Only the names of the fonts supplied with (La)TeX had changed, from Almost Computer Modern to Computer Modern, which was merely a slightly improved version of the former. So it was quite natural that LaTeX’s font selection scheme followed the plain TeX concept with the addition of size-changing commands that allowed typesetting in 10 predefined sizes.

As a result LaTeX’s font selection was far from general. For instance, when defining a heading command to produce a bolder font (by using a f command in its definition), the use of, say, sf (for a sans serif font) inside that same heading did not produce a bold sans serif font but rather a medium-weight sans serif font (the bold attribute was ignored). Similarly, when, say, f was used inside emphasized text, the result was not a bold italic font, as normally desired, but rather a plain Roman bold font.

This behavior was caused by the fact that all the font-changing commands, such as f, referred to a fixed external font. As a consequence, rather than requesting an attribute change of the current font, they replaced the current font with another. Of course, LaTeX enhanced the plain TeX mechanism to a certain extent by providing a set of size-changing commands. Nevertheless, the underlying concept of the original release had a major drawback: the correspondence tables were hard-wired into LaTeX, so that changing the fonts was a difficult, if not impossible, task.

Since that time low-priced laser printers have become available and simultaneously a large number of font families from PostScript and other type formats have appeared. The number of fonts in source format (freely available to every (La)TeX installation) has also increased drastically. But, unfortunately, there was no easy and standard method for integrating these new fonts into LaTeX—typesetting with LaTeX meant typesetting in Computer Modern on almost all installations. Of course, individual fonts could be loaded using the ewfont command, but this capability cannot be called integration: it requires a great deal of user intervention, because the additional fonts do not change size under the control of size commands, and it was extremely complicated to typeset a whole document in a font family.

There have been a few efforts to integrate other fonts into LaTeX. Typically, they involved exchanging one hard-wired font table with another. Thus, the resulting LaTeX variant was as inflexible as the original one, as this approach merely forced the use of a different set of fonts.

This unsatisfactory situation was finally resolved in 1989 with the release of the New Font Selection Scheme (NFSS) [128, 130] written by Frank Mittelbach and Rainer Schöpf, which became widely known after it was successfully used in AMS-LaTeX (see Chapter 8). This system contains a generic concept for varying font attributes individually and for integrating new font families easily into an existing LaTeX system. The concept is based on five attributes that can be defined independently to access different fonts, font characteristics, or font families. To implement it, some of the LaTeX commands were redefined and some new commands were added.

Later, a prototype version for scalable fonts was coded by Mark Purtill. Starting from his work, Frank Mittelbach designed and implemented NFSS2 integrating work by Sebastian Rahtz (on PostScript fonts) and several others. This version became the standard LaTeX font selection scheme in 1994, when the current LaTeX version (LaTeX2ε) was released.

This font selection scheme has now been in worldwide use for more than a decade and the code has proven to be stable and successful, though some people feel that extensions would be useful. The LaTeX Project Team would welcome such experimental extensions in the form of external packages, which at a later stage might be consolidated into a successor of the base font selection mechanism.

7.1.2. Input and output encodings

As one of the side effects of being able to access more fonts, it became apparent that two related areas in TeX made hard-wired selections no longer appropriate: the areas of input and output (or font) encodings.

If we press a key on a keyboard (usually) some 8-bit number will be generated representing a certain character. An input encoding describes which character corresponds to which number. When using different national keyboards or different operating systems, the correspondence between character and number may vary widely. For example, on the German keyboard that the author used to write this text, the key labeled “ä” will generate the 8-bit number “228” when used with Linux or Windows, but it generates “132” when used with MS-DOS.

When your document is stored in a computer file, information that remains about the characters consists of only these 8-bit numbers; the information about the input encoding used is not explicitly stored. Thus, if you transfer a file to a different environment, such as, from the United States to the United Kingdom, you might find that the dollar signs in your document are suddenly interpreted as pound symbols when viewing your file with some program (editor) that makes the wrong assumption about the encoding used to write the file.

To help with input encoding problems, in 1994–1995 the LaTeX Project Team developed the inputenc package. It enables users to explicitly declare the input encoding used for documents or parts of documents. This mechanism allows you to safely transfer documents from one LaTeX installation to another and to achieve identical printed results.1

1 Other solutions to this problem exist. For example, some people advertise the use of translation tables hard-wired into the program TeX itself. This works as long as all people exchanging documents use a TeX system with the same hard-wired tables but fails otherwise.

The input encoding concept

The inputenc package works by interpreting the 8-bit numbers present in the file (representing the characters) and mapping them to an “internal LaTeX representation”, which uniquely (albeit on a somewhat ad hoc basis) covers all characters representable in LaTeX. For further processing, such as writing to some auxiliary file, LaTeX exclusively uses this internal representation, thereby avoiding any possible misinterpretation.

However, at some point LaTeX has to associate these internal character representations with glyphs (i.e., character shapes in certain fonts) so another mapping must take place. TeX’s fonts contain a maximum of 256 glyphs. These glyphs are not addressed by name, but rather by (8-bit) numbers representing the positions of the glyphs in the font (i.e., we have to map from a large unique naming space into several small ones). And it probably does not come as a large surprise to hear that these glyph positions again vary widely.

Thus, even after preserving the meaning of our dollar sign from the external file to the internals of LaTeX, we might still end up with the wrong shape on paper if we happen to select a font for printing that contains an unexpected glyph in the position (slot) we assumed was occupied by a dollar sign.1 It is one of the tasks of NFSS to ensure either that any LaTeX internal character representation is properly rendered or, if that is impossible for some reason, that the user receives a proper error message.

1 The example of the $ turning into a £ sign is not artificial: some of the original TeX fonts show this strangeness, and Knuth [82, p.339] even advocates typesetting a pound symbol using {it$}.

Image Made-up accented characters prevent hyphenation

If fonts contain accented characters as individual glyphs, rather than only base characters plus accents (from which TeX then has to build up the accented glyphs internally), then it is preferable to use these glyphs because they typically have a better appearance. There is also a technical reason for this preference: the accent primitive of TeX will suppress hyphenation. This defect might be acceptable if such words are occurring only infrequently, as when typesetting English. However, when dealing with, say, a French text in which all words with accents are never hyphenated, line breaking soon becomes a nightmare.

To cater to the different possibilities, a command such as 'e (LaTeX’s internal representation for the character e-acute, é) sometimes has to initiate some complicated actions involving the accent primitive. In other cases it merely informs the paragraph builder that it wants the glyph from a certain slot in the current font.

The output encoding concept

All this is achieved in LaTeX through the concept of output encodings, which map the LaTeX internal character representations to appropriate glyph positions or to glyph-building actions depending on the actual glyphs available in the font used for typesetting. Although the output encoding concept was fully introduced with NFSS2, it took several years to finally settle on its current implementation (the internals were rewritten several times while the developers were gaining more insight into the problems in this area).

* * *

The following sections describe release 2 of NFSS, which was completed at the end of 1992 and became part of standard LaTeX in 1994. As far as the user interface is concerned, it is intended for integration into LaTeX3.

We start by discussing font characteristics in general and introduce the major attributes used in LaTeX for orthogonal font switching. We then describe the use of the high-level interface—that is, the commands a user normally has to deal with. This includes commands used in normal text (Section 7.3), special features for use in mathematical formulas (Section 7.4), and an overview of basic support packages for NFSS—those being distributed together with LaTeX (Section 7.5). It also covers the packages and commands provided to deal with the encoding issues mentioned earlier.

One of the important advantages of LaTeX’s font selection scheme is the ease with which new fonts for use in the main text can be integrated. Besides the Computer Modern families, which are used by default, one can easily use other font families by adding the appropriate package in the preamble. Of course, for successful processing and printing the corresponding font files (e.g., the .tfm and .pk, Type 1, or TrueType files) must be installed on the system. The next three sections deal with major and minor font packages. Section 7.6 discusses PSNFSS, the standard PostScript support for LaTeX, which is part of the required set of packages available with any LaTeX distribution.

This is followed by a collection of other interesting packages for adjusting the document body fonts (Section 7.7) and by an introduction to the LaTeX world of symbols (Section 7.8). All packages described are available free of charge, and most (if not all) are part of a modern LaTeX distribution. Some pointers to commercial font support are given as well.

The final part of this chapter describes the low-level interfaces that are useful when defining complex new commands and that are important when new fonts are to be made available in LaTeX. Here you will find low-level commands for changing individual font attributes (Section 7.9), commands for setting up new fonts with LaTeX (Section 7.10), and a discussion of LaTeX’s encoding models for text and math (Section 7.11). The chapter concludes with a section devoted to compatibility questions that arise with very old LaTeX documents.

7.2. Understanding font characteristics

There are many design principles that divide fonts into individual overlapping classes. Knowledge of these characteristics often proves helpful when deciding which font family to use in a special context (for further reading see, for example, the books [28, 41, 116] or the article [52]).

7.2.1. Monospaced and proportional fonts

Fonts can be either monospaced or proportionally spaced. In a monospaced font, each individual character takes up the same horizontal space regardless of its shape. In contrast, characters in a proportionally spaced font take up different amounts of space depending on their shape. In Figure 7.1 on the following page, you can see that the “i” of the monospaced font occupies the same space as the “m”, while it is noticeably narrower in the proportional font. As a result, proportional fonts (also called typographical fonts) normally allow more words to be placed on a page and are more readable than monospaced fonts. The extra spaces around individual characters of monospaced fonts make it more difficult for the eye to recognize word boundaries and thus make monospaced text less readable.

Image

Figure 7.1. Major font characteristics

However, monospaced fonts do have their uses. Within the proper context, they enhance the quality of the printed document. For example, in tables or computer listings where proper alignment of information is important, a monospaced font is a natural choice. In computer science books, it is common practice to display computer programs in a monospaced font to make them easily distinguishable from surrounding explanations.

But the use of monospaced fonts goes beyond marking portions of a document as special. One can even consider choosing a monospaced font as the base font for a complete document. Such a font has the flavor of the manual or electric typewriter engine; it looks hand-made when used with unjustified paragraphs and therefore may be better suited to certain situations than a more professional-looking typographical font. Keep in mind, however, that monospaced fonts look very poor when lines are justified. (See Section 3.1.11 to learn how to turn off justification.)

7.2.2. Serifed and sans serif fonts

Another useful classification is based on the presence or absence of serifs. Serifs are the tiny strokes at the extremities of character shapes (see Figure 7.2). Originally they were produced by the chisel, when Roman capitals were engraved into stone. For this reason, serifed fonts are often referred to as “Roman” fonts.

Image

Figure 7.2. Comparison of serifed and sans serif letters

Serifed fonts traditionally have been used for long texts because, it was argued, they are more readable. It was long thought that serifed letters give the eye more clues for identification. This is certainly true if only parts of the characters are visible, but for fully visible text recent research has shown that reading speed is not substantially affected by the absence of serifs [150].

7.2.3. Font families and their attributes

Besides the crude classifications of serifed versus sans serif and monospaced versus proportional, fonts are grouped into font families. Members of a font family share common design principles and are distinguished by variations in size, weight, width, and shape.

Font shapes

An important attribute when classifying a member of a font family is its shape. Of course, sometimes it is a matter of personal judgment whether a set of fonts with different shapes constitutes one or several families. For example, Donald Knuth called his collection of 31 Computer Modern fonts a family [86], yet they form a meta-family of many families in the traditional sense.1

1 , as a design tool, allows the production of completely different fonts from the same source description, so it is not surprising that in 1989 another family was created [92] based on the sources for the Computer Modern fonts. This family, Concrete Roman, was obtained merely by varying some parameters in the source files; but since the result was so different, Knuth decided to give this family a different name.

Although there is no uniform naming convention for font shapes, this is unimportant as long as one sticks to a particular scheme within LaTeX.

The upright shape

Nearly every font family has one shape called the “upright” shape.2 For example, in the font family used in this book (Lucida Bright), the font that you are now reading is in the upright shape.

2 Sometimes you will also hear the term “Roman” shape. This is due to the fact that until recently typesetting was nearly always done using serifed fonts. Thus, “Roman” was considered to be the opposite of “italic” by many people. So be aware that in some books this term actually refers to the upright shape and not to a serifed font family.

The italic shape

Another important shape that is present in most families is the “italic” shape, which looks like this in the Lucida Bright family. Italic characters are slanted to the right and the individual letters generally are drawn differently from their upright counterparts, as illustrated in Figure 7.3. The first line in that figure shows letters from the Computer Modern Serif family in upright shape, and the third line shows the same letters in italic shape. For better comparison, the second line gives the italic letters without the usual slant—that is, the letters are artificially shown in an upright position.

Image

Figure 7.3. Comparison between upright and italic shapes

The slanted or oblique shape

Font families without serifs often lack a proper italic shape; instead, they have a “slanted” shape in which the characters slant to the right but are otherwise identical to their upright counterparts. The terms “sloped” and “oblique” are also commonly used for this shape.

The small caps shape

Faking small capitals

Another common variant is the “small caps” shape, in which the lowercase letters are represented as capitals with a reduced height, as shown in Figure 7.4. If such a shape is not available for a specific family, typographers sometimes use upright capitals from smaller sizes,1 but this practice does not produce the same quality as a well-designed small caps font. Real small caps have different widths and weight than capital letters from the same font that have been reduced to the height of designed small caps (you can clearly see that the strokes in the faked capitals in Figure 7.4 are much too thin).

1 A good rule of thumb is to use capitals from a font that is about half a point larger than the x-height of the original font unless the x-height is very small. See discussion in Section 7.10.3 on page 428 for a way to determine the x-height of any font used with TeX.

Image

Figure 7.4. Comparison between caps and small caps

It is an open argument whether one should consider “small caps” to be a shape or whether this would be better modeled as another independent axis. In the latter interpretation, fonts have a “case” attribute, which could be either mixed case (the normal case), all caps, small caps, or all lowercase. For certain font families this would certainly be the better solution, but currently the LaTeX font selection supports only four axes modeling small caps as a shape.2

2 In some cases small caps fonts are in fact modeled as extra families to enable the combination of, say, small caps italic.

There are a few other, less important shapes. Some families contain fonts in which the inner parts of the letters are drawn in a special fashion, most importantly perhaps the “outline” shapes, in which the inner parts of the letters are kept empty. For display purposes, some families also contain fonts that could be classified as “shaded”—that is, where the letters appear three-dimensional. Examples are shown in Figure 7.5 on the facing page.

Image

Figure 7.5. Outline and shaded shapes

Special variants of the Computer Modern meta-family have been produced by setting the parameters to special values. For example, there is “upright italic”, a shape in which the individual letters are drawn in italic fashion but without the usual slant (see the second line in Figure 7.3 on the previous page). This shape was devised for purposes of showing the abilities of as a tool for meta-design, but some users might take a fancy to such an unusual shape.

Weight and width

Fonts of a certain shape within a family may differ in “weight”. This characteristic refers to the thickness of the strokes used to draw the individual shapes. Once again, the commonly used names are not completely uniform, but it is relatively easy to arrive at a consistent classification. Some font manufacturers, for example, call the font weights intended to be used for normal text “book”, while others call them “medium”. For thin strokes the name “light” is commonplace, while thicker strokes are usually called “bold”. In larger font families, finer distinctions are often necessary, so that we sometimes find a range starting with “ultra light”, going through “extra light”, “light”, “semi light”, and so on, and ending with “ultra bold” at the other end. Conversely, often only a few weights are present in some families. For example, the Computer Modern Roman family has only two weights, “medium” and “bold”.

Another equally important attribute of a font is its “width”—the amount of expansion or contraction with respect to the normal or medium width in the family. Computer Modern Roman has bold fonts in “medium width” and “extended width”. One application for condensed fonts is in titles and headings, where medium-width fonts, when used at large sizes, would consume too much space. Some typesetting systems can even condense fonts automatically to fit a given measure—for example, to exactly fill a particular line in a heading. This capability is not directly possible with (La)TeX, but in any case the results are often aesthetically questionable.

Font sizes

Font sizes are traditionally measured in printer points (pt). There are 72.27 points to an inch.1 The font size is not an absolute measure of any particular characteristic, but rather a value chosen by the font designer to guide the user. For example, in a 10pt font, letters of the alphabet are usually less than 10pt tall, and only characters such as parentheses have approximately this height.

1 PostScript uses a slightly different measurement system in which 72 points equal an inch. These units, sometimes referred to as “big points”, are available in TeX as bp.

Two fonts of the same size may not blend well with one another because the appearance of a font depends on many factors, such as the height of the lowercase letters (the x-height), the stroke width, and the depth of the descenders (the part of the letters below the baseline, as in the letter q).

In the (La)TeX world, fonts are often available in sizes that are powers of 1.2—that is, in a geometric progression [82, p.17]. This arrangement was chosen because it makes it easy to produce an enlarged master copy that later can be photographically reduced, thereby effectively enlarging the final output resolution. For example, if an A5 brochure is to be produced, one could print it with magnification of Image on A4 paper. Photographic reduction from the 300dpi (dots per inch) output of a normal laser printer would produce an effective output resolution of 432dpi and thus would give higher quality than is normally possible with such a laser printer.

However, this geometric ratio scheme used by (La)TeX fonts produced with the program is not common in the professional world, where usual point sizes are 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 30, and 36. Yet not all fonts are available in all these sizes, and sometimes additional sizes are offered—such as display sizes for large headings and tiny sizes for subscripts and superscripts. The requirement for fixed sizes had its origin in the technology used. Fonts cast in metal had to exist (at a particular size) or you could not print in that size. In today’s digitalized world, fonts are usually vectorized and thus can be scaled at will. As a result, many commercial font families nowadays are provided in only a single design size.

The use of magnified or reduced fonts instead of fonts designed for a specific size often gives somewhat less satisfactory results, because to the human eye fonts do not scale in a linear fashion. The characters in handcrafted fonts of larger sizes usually are narrower than fonts magnified from a smaller size of the same family. While it is acceptable to scale fonts within a small size range if necessary, one should use fonts designed for the desired size whenever possible. The difference between fonts scaled to a particular size and those designed for that size is shown in Figure 7.6, though admittedly the variations are often less noticeable.

Image

Figure 7.6. Scaled and designed fonts (Computer Modern)

7.2.4. Font encodings

As mentioned in the chapter introduction, TeX refers to the glyphs of a font by addressing them via 8-bit numbers. Such a mapping is called a font encoding. As far as LaTeX is concerned, two fonts having the same font encoding are supposed to be interchangeable in the sense that given the same input they produce the “same” glyphs on the printed page. To illustrate what happens if we use a font with an encoding not suitable for our input, here is the first sentence of this section again (using the Zapf Dingbats font):

Image

The result is an interesting puzzle, but nothing that we want to see in ordinary documents.

By classifying fonts according to their font encodings it is possible to modify other font characteristics, such as font family or font series, and still ensure that the typeset result will stay comprehensible.

OT1 encoding

The fonts that were originally distributed with TeX have only 128 glyphs per font and therefore do not include any accented characters as individual glyphs. Instead, all such glyphs have to be constructed using the accent primitive of TeX or by similar methods. As a result any word containing diacritics cannot be automatically hyphenated by LaTeX and kerning (correction of spacing between certain letters in the font) cannot be automatically applied. The encoding of these fonts is called OT1. Although it remains the default encoding for LaTeX, it is not advisable to use OT1 for languages other than English.

T1 encoding

As an alternative encoding, the TeX user community defined a 256-character encoding called T1 that enables TeX to typeset correctly (with proper hyphenation and kerning) in more than 30 languages based on the Latin alphabet (see Section 7.5.1 on page 353 for further details). The use of the T1 encoding is, therefore, highly recommended. Nowadays nearly all font families amenable to use with LaTeX are available in this encoding; in fact, some are only available in the T1 encoding. Specifying usepackage[T1]{fontenc} after the documentclass command, makes T1 become the default encoding. Section 7.5.3 contains a more detailed discussion of the fontenc package. For more on font encodings refer to page 415 and Section 7.11 on page 440.

7.3. Using fonts in text

When you are writing a LaTeX document, appropriate fonts are normally chosen automatically by the (logical) markup tags used to structure the document. For example, the font attributes for a section heading, such as large size and bold weight, are defined by the document class and applied when a section command is used, so that you seldom need to specify font attributes yourself.

However, occasionally it becomes necessary to specify font attributes directly. One common reason is the desire to change the overall font attributes, by choosing, for example, a different font family for the main text. This alteration often can be done by simply specifying an appropriate package (see Sections 7.6 and 7.7 for descriptions of such packages).

Another use for explicit font attributes can be to mark certain portions of the document as special—for example, to denote acronyms, example, or company names. For instance, in this book, names of packages are formatted in a sans serif font. This formatting could be achieved by surrounding the names with extsf{..}, but it is much better practice to define a new command (say, LPack) for this purpose so that additional information is included in the source document. By defining individual commands for logically different things—even those that are currently being typeset in the same way—it is easier to change the formatting later in a consistent way.

Last, but not least, in some cases you may want to override a decision taken by the document class. For example, you might want to typeset a table in a smaller size to make it fit on a page. This desire is legitimate, as document classes can format documents automatically only to a certain extent. Hand-formatting—like the insertion of page breaks—is thus often necessary to create the final version. Unfortunately, explicit formatting makes further use of the document (if changes are made) difficult and error prone. Therefore, as with all visual formatting commands, you should try to minimize the direct use of font-changing commands in a document.

7.3.1. Standard LaTeX font commands

The font used for the main text of a document is called the “main font”, “body font”, or “normal font”. It is automatically selected at the beginning of the document and in certain constructs, such as footnotes, and figures. Certain logical markup tags, such as section headings, automatically switch to a different type-face or size, depending on the document class. These changes happen behind the scenes, and the only action required of the author is to introduce the correct logical markup in the document. However, sometimes it might be desirable to manually highlight individual parts of the text, by choosing an appropriate typeface; this is done with the commands described below.

Most font-changing commands come in two forms: a command with one argument, such as extbf{...}, and a declarative form, such as fseries. The declarations do not take arguments but rather instruct LaTeX that from now on (up to the end of the current group of braces or environments) it should behave in a special way. Thus, you should not write something like fseries{...}, as this would make everything bold from this point until the end of the current environment.

To change the fonts for individual words or short phrases within your document you should make use of the font commands with one argument. The declarative forms are often better in the definition of new environments or commands. For longer passages in your document, you can also use the environment form of the declaration (the declarative name without the preceding backslash), as shown in the following example:

7-3-1
Image

In fact, the font commands with one argument do not allow paragraph breaks in their arguments. Section 7.3.3 on page 344 contains a detailed comparison of the command and declarative forms and their advantages and disadvantages in specific cases.

The main document font

To switch to the main document font you can use the command extnormal or the declaration ormalfont. They are typically used only in the definition of commands or environments when it is important to define commands that always typeset in the same font regardless of the surrounding conditions. For example, the command to typeset the command names in this book is defined roughly as follows:

Image

Using ormalfont prevents the command names coming out like this in certain places.

Standard font families

By default, LaTeX maintains three font families that can be selected with short command sequences. These families are a serifed text font, accessed with the command extrm; a sans serif text font, accessed by extsf; and a typewriter font (usually monospaced), accessed by exttt. The declaration forms of these commands are mfamily, sffamily, and tfamily, respectively.

The names of the external font families accessed by these commands depend on the document class but can be changed by packages or in the preamble (see Section 7.3.5). As an installation default, the serifed font family is Computer Modern Roman, the sans serif family is Computer Modern Sans, and the typewriter family is Computer Modern Typewriter. If you use a different set-up, take care to define these default families so that the fonts can be mixed freely without visual clashes. Also, make sure that the external fonts are available in the correct resolution for the targeted output device.

In this book, the serifed font family is Lucida Bright, the sans serif family is Lucida Sans, and the typewriter family is European Modern Typewriter. These have been chosen by simply1 loading the package lucidabr and afterwards redefining tdefault to produce emtt; see Section 7.3.5 for more details on changing the default text fonts.

1 Somewhat more truthful: for the second edition of this book the Lucida fonts were scaled down slightly, while the European Modern Typewriter was scaled up to match the x-height of both families using specially designed DeclareFontShape declarations.

In most document classes, the serifed font, accessed by extrm, is also the main font of the document, so the command extrm is not used often. But if a document designer has chosen a sans serif font as the main typeface, then extrm would be the alternative serifed font family.

Standard font series

Another attribute of a typeface that can be changed is the series. In LaTeX the series is a combination of two attributes: width and weight (boldness). LaTeX provides two commands for changing the series: extmd and extbf. The corresponding declarations are mdseries and fseries, respectively. The first command selects a font with medium values for the width and the weight, while the latter switches to a bolder series. The actual values depend on the document class and its options or subsequent packages. As a default for the Computer Modern families, extbf switches to a bold extended version of the current typeface, while extmd returns to the medium width and medium weight version of the current typeface.

If finer control over the series attribute is desired, it is best to define additional high-level user commands with the help of the lower-level fontseries declaration described in Section 7.9.1. Some packages that make large font families available for use with LaTeX provide such extra commands.

Standard font shapes

A third font attribute that may be changed independently of the others is the shape of the current typeface. The default shape for most documents is the upright shape. It can be accessed, if necessary, with the command extup or the declaration upshape.

Probably the most important commands for changing the shape are extit and extsc, which switch to an italic or CAPS AND SMALL CAPS font shape, respectively. The corresponding declarations are itshape and scshape.

An alternative to extit is the extsl command (its declaration form is slshape), which switches to the slanted shape. A font family often contains only an italic or a slanted shape, yet Computer Modern Roman contains both.

At the point where one switches from slanted to upright, the characters usually come too close together, especially if the last slanted character has an ascender. The proper amount of extra white space that should be added at this boundary is called the “italic correction”. The value of this adjustment depends on the individual character shape and is stored in the .tfm file. The italic correction is automatically added by the font commands with arguments but it must be inserted manually using / when declarations are employed. For an upright font, the italic correction of the characters is usually zero or very small, but there are some exceptions. (In Computer Modern, to typeset a bold “f” in single quotes, you should say '{fseries f/}' or ' extbf{f}', lest you get a bold ‘f’ in some fonts.) In slanted or italic fonts, the italic correction is usually positive, with the actual value depending on the shape of the character. The correct usage of shape-changing declarations that switch to slanted shapes is shown in the next example.

7-3-2
Image

If you use the command forms with one argument instead, the italic correction is added automatically. This topic is further discussed in Section 7.3.3.

Small capitals are sometimes used in headings or to format names. For the latter case you can, for example, define the command ame with the definition

Image

or, using two declarations:

Image

The first definition simply switches to the desired shape, while the second form initially resets all font attributes to their defaults. Which approach is preferable depends on the available fonts and the type of document. With Computer Modern only the Roman and typewriter families contain a small caps shape, so the second definition might be preferred in certain applications because it will use small caps (though serifed) even in a sffamily context. The first command would result in a request for a medium series, small caps, shaped font in the Computer Modern Sans family. Because this font is not available, LaTeX would try to find a substitute by first changing the shape attribute to its default, with the result that you would not get small caps. (See Section 7.9.3 for further information about substitutions.)

Another interesting use of the scshape declaration is in the definition of an acronym tag:

Image

This definition makes use of the LaTeX command MakeLowercase, which changes all characters within its argument to lowercase (in contrast to the TeX primitive lowercase, this command also changes characters referred to by commands, such as OE, to lowercase). As a result, all characters in the argument of acro will be changed to lowercase and therefore typeset with small capitals.

Another slightly special shape command available in LaTeX is the emph command. This command denotes emphasis in normal text; the corresponding declaration is em. Traditionally, emphasized words in text are set in italic; if emphasis is desired in an already italicized portion of the text, one usually returns to the upright font. The emph command supports this convention by switching to the itshape shape if the current font is upright, and to the upshape shape if the current font is already slanted (i.e., if the shape is itshape or slshape). Thus, the user does not have to worry about the current state of the text when using the emph command or the em declaration.

7-3-3
Image

Using the upright shape for nested emphasis is not always very noticeable. A common typographic recommendation is, therefore, to use small capitals for the inner emphasis. This practice is not directly supported by standard LaTeX but can be achieved through the command eminnershape, made available by the fixltx2e package.

7-3-4
Image

Note that underlining for emphasis is considered bad practice in the publishing world. Underlining is used only when the output device can’t do highlighting in another way—for example, when using a typewriter. Sections 3.1.6 and 3.1.7 discuss packages that change em to produce underlining.

Standard font sizes

LaTeX has 10 size-changing commands (see Table 7.1). Since size changes are normally used only in the definition of commands, they have no corresponding command forms with one argument. The names of the commands have been retained from LaTeX 2.09 but in today’s LaTeX their functionality has changed slightly. In LaTeX2ε such a command changes only the size of the current font, with all other attributes staying the same; in LaTeX 2.09 a size-changing command also automatically switched back to the main document font.

Image

Table 7.1. Standard size-changing commands

The size selected by these commands depends on the settings in the document class file and possibly on options (e.g., 11pt) specified with it. In general, ormalsize corresponds to the main size of the document, and the size-changing commands form an ordered sequence starting with iny as the smallest and going up to Huge as the largest size. Sometimes more than one command refers to the same real size; for example, when a large ormalsize is chosen, Huge can be the same as huge. In any event, the order is always honored.

The size-related commands for the main text sizes (i.e., ormalsize, small, and footnotesize) typically influence the spacing around lists and displays as well. Thus, to change their behavior, one should not simply replace their definition by a call to fontsize, but instead start from their original definitions, as documented in classes.dtx.

Unfortunately, there is currently no relative size-changing command in LaTeX—for example, there is no command for requesting a size 2pt larger than the current one. This issue is partially resolved with the relsize package described in Section 3.1.4 on page 83.

7.3.2. Combining standard font commands

As already shown, the standard font-changing commands and declarations can be combined. The result is the selection of a typeface that matches the combination of all font attributes. For example:

7-3-5
Image

What happens behind the scenes is that the sffamily command switches to the sans serif default family, then fseries switches to the default bold series in this family, and finally large selects a large size but leaves all other font attributes unchanged (the leading appears to be unchanged because the scope of large ends before the end of the paragraph). Font metric files (i.e., .tfm files) are loaded for all intermediate typefaces, even if these fonts are never used. In the preceding example, they would be “sans serif medium 10pt” after the sffamily, then “sans serif bold extended 10pt” after the fseries, then “sans serif bold extended 14pt”, which is the font that is finally used. Thus, such high-level commands can force LaTeX’s font selection to unnecessarily load fonts that are never used. This normally does not matter, except for a small loss of processing speed when a given combination is used for the first time. However, if you have many different combinations of this type, you should consider defining them in terms of the primitive font-changing declarations (see Section 7.9).

7.3.3. Font commands versus declarations

We have already seen some examples of font commands that have arguments and change font attributes. These font-changing commands with arguments all start with ext... (except for the emph command) to emphasize that they are intended for use in normal text and to make them easily memorizable. Using such commands instead of the declarative forms has the advantage of maintaining consistency with other LaTeX constructs. They are intended for typesetting short pieces of text in a specific family, series, or shape. Table 7.2 shows the effects of these commands.

Image

Table 7.2. Standard font-changing commands and declarations

A further advantage of these commands is that they automatically insert any necessary italic correction on either side of their argument. As a consequence, one no longer has to worry about forgetting the italic correction when changing fonts.

Only in a very few situations is this additional space wrong. For example, most typographers recommend omitting the italic correction if a small punctuation character, like a comma, directly follows the font change. As the amount of correction required is partly a matter of taste, you can define in which situations the italic correction should be suppressed. This is done by specifying the characters that should cancel a preceding italic correction in the list ocorrlist.1 The default definition for this command is

1 Any package that changes the catcode of a character inside ocorrlist must redeclare the list. Otherwise, the changed character will no longer be recognized by the suppression algorithm.

Image

It is best to declare the most often used characters first, as it will make the processing slightly faster.

In addition to the global customization, it is possible to suppress the italic correction in individual instances. For this purpose, the command ocorr is provided. Note that you have to put ocorr on the left or right end inside the argument of the ext... commands, depending on which side of the text you wish to suppress the italic correction.

7-3-6
Image

In contrast, the use of the declaration forms is often more appropriate when you define your own commands or environments.

7-3-7
Image

7.3.4. Accessing all characters of a font

Sometimes it is impossible to enter a character directly from the keyboard, even though the character exists in the font. Therefore, many useful characters are accessible via command names like ss or AE, which produce “ß” and “Æ”, respectively. Some characters can also be implicitly generated from sequences of letters (this is a property of fonts) like ffi, which produces “ffi”, and ---, which produces “—” in the standard TeX fonts.

In addition, the command symbol allows you to access any character in a font by giving its number in the current encoding scheme as either a decimal, octal (preceded by '), or hexadecimal (preceded by ") number.

7-3-8
Image

The numbers corresponding to the characters in any font can be obtained by using the program nfssfont.tex, described in Section 7.5.7 on page 369.

7.3.5. Changing the default text fonts

To make it easier to modify the overall appearance of a document, LaTeX provides a set of built-in hooks that modify the behavior of the high-level font-changing commands discussed in the previous sections. These hooks are shown in Table 7.3. The values of these hooks can be set in package files or in the preamble of a document by using enewcommand. Suitable values for these commands can be found by looking through the font tables in this chapter.

Image

Table 7.3. Font attribute defaults

For example, by writing in the preamble

Image

a whole document would come out in Computer Modern Sans, because this redefinition changes the font family for the main font used by LaTeX. More exactly, the main document font is determined by the values of encodingdefault, familydefault, seriesdefault, and shapedefault. Thus, you have to make sure that these commands are defined in such a way that their combination points to an existing font shape in LaTeX’s internal tables.

Image Suboptimal encoding default

The default value stored in encodingdefault currently is OT1, which means that LaTeX assumes that most fonts use the original TeX encoding. This is actually a compatibility setting: in most circumstances it is better to use the T1 encoding because it contains many additional glyphs that are not available with OT1 and allows proper hyphenation for words with accented characters (see Section 7.5.1). Nowadays, some fonts are made available only in T1; that is, they do not support OT1 at all.

One also has to be aware that not every font encoding is suitable for use as a document-encoding default. A prerequisite is that the encoding must include most of the visible ASCII letters in their standard positions; see the discussion in Section 7.11 on page 440 for details. The encodingdefault can be changed by loading the fontenc package with one or more options; see Section 7.5.3. For more information on font encodings refer to Section 7.9.1.

Image Wrong bold default can lead to problems

Another example, this time involving a series-changing command, would be to define fdefault to produce b so that the fseries command will use bold instead of bold extended, which is the default under Computer Modern. However, there is some risk in using such a setting since, for example, in Computer Modern only the Roman family has bold variants with a medium width. Computer Modern Typewriter and Computer Modern Sans have only bold extended variants. Thus, without further adjustments, a request for a bold sans serif font (i.e., sffamilyfseries), for example, might force LaTeX to try font substitution, and finally select a medium-weight font. (This outcome can be avoided, as explained in Section 7.10.3, by specifying that the bold extended variants of the sans family should serve as substitutes for the bold medium ones.)

An example in which some default values are changed can be found in Section 7.10.8 on page 439, which covers setting up PostScript manually.

The initial setting of familydefault means that changing mdefault will implicitly also change familydefault to the new value, as long as no special setting for familydefault is defined. However, if familydefault is changed, mdefault is not affected.

7.3.6. LaTeX 2.09 font commands

The two-letter font commands used in LaTeX 2.09, such as f, are no longer defined by LaTeX2ε directly. Instead, they are defined (if at all) in the LaTeX2ε class files. For compatibility reasons the standard classes provide definitions for these commands that emulate their behavior in LaTeX 2.09. However, it is legitimate for you to redefine them in a package or in the preamble according to your personal taste, something you should not do with basic font selection commands like fseries.

Image Do not use f and friends

Because the old LaTeX 2.09 font commands are now allowed to be defined freely in a document class or by the user, they are no longer used within the code for LaTeX2ε. Instead, all internal references to fonts are created using either high-or low-level interfaces of LaTeX’s font selection scheme. This convention should be followed by package and class developers to ensure a consistent behavior throughout.

7.4. Using fonts in math

Unlike the situation in text, automatic changes in font shapes are generally not desired in math formulas. For mathematicians, individual shapes convey specific information. For example, bold upright letters may represent vectors. If the characters in a formula were to change because of surrounding conditions, the result would be incorrect. For this reason handling of fonts in mathematical formulas is different than that in text.

Characters in a formula can be loosely put into two classes: symbols and alphabet characters (including digits). Internally, (La)TeX distinguishes between eight types of math characters (to account for appropriate spacing), but for the discussion of fonts the division into two classes is generally adequate.

Some symbols, such as =, can be entered directly from the keyboard. The bulk of them, however, must be entered via a control sequence—for example, leq stands for . The other main group of characters in a formula, the alphabet characters, are entered directly from the keyboard.

More than 200 symbols are predefined in a standard (La)TeX system, allowing the user to typeset almost any desired formula. These symbols are scattered over several fonts, but they are accessed in such a way that the user does not have to be aware of their internal representations. If necessary, additional symbol fonts can be made accessible in a similar way; see Section 7.10.7.

The most important difference between symbols and alphabet characters is that symbols always have the same graphical representation within one formula, while it is possible for the user to change the appearance of the alphabet characters. We will call the commands that change the appearance of alphabet characters in a formula “math alphabet identifiers” and the fonts associated with these commands “math alphabets”. The alphabet identifiers are independent of surrounding font commands outside the formula, so a formula does not change if it is placed (for example) inside a theorem environment whose text is, by default, typeset in italics. This behavior is very important, because character shapes in a mathematical formula carry meanings that must not change because the formula is typeset in a different place in a document.

Some people who are familiar with the old method of font selection may be surprised by the fact that commands like fseries cannot be used in formulas. This is the price we must pay for the greater flexibility in choosing text font attributes—a flexibility that we do not want in a formula. We therefore need a different mechanism (math alphabet identifiers) for changing the typeface of certain alphabet characters in complicated formulas.

7.4.1. Special math alphabet identifiers

One alphabet and a huge number of symbols are not sufficient for scientists to express their thoughts. They tend to use every available typeface to denote special concepts. Besides the use of foreign alphabets such as Greek letters, which usually are accessed as symbols—alpha, eta, and so on—we find sans serif letters for matrices, bold serif letters for vectors, and Fraktur fonts for groups, ideals, or fields. Others use calligraphic shapes to denote sets. The conventions are endless, and—even more importantly—they differ from one discipline to another.

For this reason LaTeX makes it possible to declare new math alphabet identifiers and associate them with any desired font shape group instead of relying only on a predefined set that cannot be extended. These identifiers are special commands for use in a formula that typeset any alphabet character in their argument in a specific typeface. (Symbols cannot be changed in this way.) These identifiers may use different typefaces in different formulas, as we will see in Section 7.4.3, but within one formula they always select the same typeface regardless of the surrounding conditions.

Predefined alphabet identifiers

New math alphabet identifiers can be defined according to the user’s needs, but LaTeX already has a few built in. These identifiers are shown in Table 7.4. As the last lines in the table show, the letters used in formulas are taken by default from the math alphabet mathnormal. In contrast, the letters produced by mathit have different spacing; thus this alphabet could be used to provide full-word variable names, which are common in some disciplines.

Image

Table 7.4. Predefined math alphabet identifiers in LaTeX

In LaTeX2ε math alphabet identifiers are commands with one argument, usually a single letter or a single word to be typeset in a special font.

7-4-1
Image

This procedure differs from the way font commands were used in LaTeX 2.09, where commands, such as m, would cause font changes (..{ m A}..). For the most important two-letter font-changing commands like m, sf, f, it, and t, the old syntax is still supported in the standard classes. For the others you can force the old behavior by specifying the package oldlfont; see Section 7.12.1. However, we suggest that you refrain from using such commands in new LaTeX documents.

As already mentioned, another difference between the old LaTeX 2.09 font selection scheme and NFSS is that text font declarations are no longer allowed in formulas, as they merely change some characteristic of the current font rather than switching to a specific font. Thus, if you write {fseries..} instead of mathbf{..} in a formula, LaTeX will produce an error message.

The command names for the math alphabet identifiers are chosen to be descriptive rather than simple to type—they all start with math. Therefore, if you use the commands more than occasionally in your document, you should consider defining some abbreviations in the preamble, such as the following:

Image

No default math alphabet

You may wonder what the default math alphabet is—that is, from which alphabet the alphabet characters are selected if you do not specify an alphabet identifier explicitly, as in the formula $x = 123$. The answer is that no single default math alphabet exists. The (La)TeX system can be set up so that alphabetical characters are fetched from different alphabets as long as the user has not explicitly asked for a specific one, and this is normally the case, as the following example shows.

7-4-2
Image

As you can see, mathrm does not change the digits and mathnormal does not change the letters, so the default for digits in the normal set-up is the math alphabet associated with mathrm and the default for letters is the one associated with mathnormal.1 This behavior can be controlled with the DeclareMathSymbol command, which is explained in Section 7.10.7.

1 It is a strange fact that the math font that corresponds to the mathnormal alphabet actually contains old-style numerals. When the Computer Modern fonts were developed, space was a rare commodity, so Donald Knuth squeezed a number of “nonmathematical” glyphs into these fonts that are normally used only in text.

Defining new alphabet identifiers

New math alphabet identifiers are defined with the DeclareMathAlphabet command. Suppose that you want to make a slanted sans serif typeface available as a math alphabet. First you decide on a new command name, such as msfsl, to be used to select your math alphabet. Then you consult the font classification tables in this chapter (starting on page 354) to find a suitable font shape group to assign to this alphabet identifier. You will find that the Computer Modern Sans family, for example, consists of a medium series with upright and slanted shapes. If you decide to use the slanted shape of this family, you tell LaTeX using DeclareMathAlphabet.

Image

This declaration has four arguments besides the identifier: the encoding scheme, the family, the series, and the shape of the font to be used. The alphabet identifier defined in the example will always switch to Computer Modern Sans medium slanted.

7-4-3
Image

It is also possible to redefine an existing math alphabet identifier in a package file or in the preamble of your document. For example, the declaration

Image

will override the default settings for the mathsf alphabet identifier. After that, mathsf will switch to Image in your formulas. There is, however, a subtle point: if the math alphabet in question is part of a symbol font that is already loaded by LaTeX for other reasons (e.g., mathcal), it is better to use DeclareSymbolFontAlphabet as it makes better use of TeX’s somewhat limited resources for math; see page 435 for details.

7.4.2. Text font commands in math

As mentioned previously, text font declarations like mfamily cannot be used in math. However, the font-changing commands with arguments—for example, extrm—can be used in both text and math. You can use these commands to temporarily exit the math context and typeset some text in the midst of your formula that logically belongs to the text surrounding the formula. Note that the font used to typeset this text will depend on surrounding conditions—that is, it will pick up the current values of encoding, family, series, and shape, as in the next example.

7-4-4
Image

As you see, the Sans family was retained and the series was changed to bold. Perhaps more useful is the ext command, provided by the amstext package, which picks up the current values of encoding, family, series, and shape without changing any of them (see Section 8.6.1).

7.4.3. Mathematical formula versions

Besides allowing parts of a formula to be changed by using math alphabet identifiers, LaTeX lets you change the appearance of a formula as a whole. Formulas are typeset in a certain “math version”, and you can switch between math versions outside of math mode by using the command mathversion, thereby changing the overall layout of the following formulas.

LaTeX knows about two math versions called “normal” and “bold”. Additional ones are sometimes provided in special packages. For example, the mathtime package (for the commercial MathTime fonts) sets up a math version called “heavy” to typeset formulas with ultra bold symbols as provided by the MathTime fonts.

As the name indicates, mathversion{normal} is the default. In contrast, the bold version will produce bolder alphabet characters and symbols, though by default big operators, like sum, are not changed. The following example shows the same formula first in the normal and then in the bold math version.1

1 For historical reasons LaTeX has two additional commands to switch to its standard math versions: oldmath and unboldmath.

7-4-5
Image

Using mathversion might be suitable in certain situations, such as in headings, but remember that changing the version means changing the appearance (and perhaps the meaning) of the entire formula. If you want to darken only some symbols or characters within one formula, you should not change the mathversion. Instead, you should use the mathbf alphabet identifier for characters and/or use the command m provided by the bm package; see Section 8.8.2.

If you change the math version with the mathversion command, LaTeX looks in its internal tables to find where all the symbols for this new math version are located. It also may change all or some of the math alphabet identifiers and associate them with other font shapes in this version.

But what happens to math alphabet identifiers that you have defined yourself, such as the msfsl from Example 7-4-3? As long as you declared them using only DeclareMathAlphabet, they will stay the same in all math versions.

If the math alphabet identifier is to produce a different font in a special math version, you must inform LaTeX of that fact by using the SetMathAlphabet command. For example, in the default set-up the mathsf alphabet identifier is defined as follows:

Image

The first line means that the default for mathsf in all math versions is Computer Modern Sans medium. The second line states that the bold math version should use the font Computer Modern Sans bold extended instead.

Image

From the previous example, you can see that SetMathAlphabet takes six arguments: the first is the name of the math alphabet identifier, the second is the math version name for which you are defining a special set-up, and the other four are the encoding, family, series, and shape name with which you are associating it.

As noted earlier, you can redefine an existing math alphabet identifier by using DeclareMathAlphabet. If you do so, all previous SetMathAlphabet declarations for this identifier are removed from the internal tables of LaTeX. Thus, the identifier will come out the same in all math versions unless you add new SetMathAlphabet declarations for it.

7.5. Standard LaTeX font support

This section opens with a short introduction to the standard text fonts distributed together with LaTeX: Computer Modern and European Computer Modern. It is followed by a discussion of LaTeX’s standard support packages for input and font encodings. The section concludes by describing a package for tracing LaTeX’s font processing and another package for displaying glyph charts (a package the author used extensively while preparing the later parts of this chapter).

7.5.1. Computer Modern—The LaTeX standard fonts

Original TeX font encoding

Along with TeX, Donald Knuth developed a family of fonts called Computer Modern; see Table 7.5 on the next page. Until the early 1990s, essentially only these fonts were usable with TeX and, consequently, with LaTeX. Each of these text fonts contains 128 glyphs (TeX was working with 7 bits originally), which does not leave room for including accented characters as individual glyphs. Thus, using these fonts means that accented characters have to be produced with the accent primitive of TeX, which in turn means that automatic hyphenation of words with accented characters is impossible. While this restriction is acceptable with English documents that contain few foreign words, it is a major obstacle for other languages.

Image

Table 7.5. Classification of the Computer Modern font families

T1 a.k.a. “Cork” encoding

EC fonts

Not surprisingly, these deficiencies were of great concern to the TeX users in Europe and eventually led to a reimplementation of TeX in 1989 to support 8-bit characters internally and externally. At the TeX Users conference in Cork (1990), a standard 8-bit encoding for text fonts (T1) was developed that contains many diacritical characters (see Table 7.32 on page 449) and allows typesetting in more than 30 languages based on the Latin alphabet. At the University of Bochum (under the direction of Norbert Schwarz) the Computer Modern font families were then reimplemented, and additional characters were designed, so that the resulting fonts completely conform to this encoding scheme. The first implementation of these fonts was released under the name “DC fonts”. Since then Jörg Knappen has finalized them and they are now distributed as “European Computer Modern Fonts”, often shortened to “EC fonts”.1

1 Not to be confused with the European Modern Fonts™, a high-quality set of commercial fonts by Y&Y that are based on the Computer Modern design but have slightly different metrics [65].

PostScript Type 1 instances

CM-Super fonts

Both Computer Modern and the EC fonts are considered standard in LaTeX and must be available at any installation. Although originally developed with , there are now free Type 1 PostScript replacements as well. For Computer Modern these were produced by Blue Sky Research; Y&Y added the LaTeX, AMS, and Euler fonts. The EC fonts have been recently converted from sources to Type 1 PostScript by Vladimir Volovich. His implementation is called the CM-Super fonts package and, beside the EC fonts, it covers EC Concrete, EC Bright, and LH fonts (Cyrillic Computer Modern). In addition to the T1 encoding, the LaTeX standard encodings TS1, T2A, T2B, T2C, and X2 are supported by CM-Super. The CM-Super fonts have been automatically converted to the Type 1 format and although a sophisticated algorithm was used for this conversion, you cannot expect exactly the same quality as could be achieved by a manual conversion process.

Since the PostScript fonts have the same font metrics as their counterparts they need no support package in the LaTeX document. Once installed they will be automatically used by the driver program (e.g., dvips) that converts the .dvi output to PostScript. The standard .fd files for Computer Modern provide only well-defined font sizes to avoid the generation of too many bit-mapped fonts. However, with PostScript the use of intermediate sizes (via fontsize) is possible without any such side effect. The package fix-cm makes use of this feature.

Although the EC fonts were originally meant to be a drop-in extension (and replacement) for the 7-bit Computer Modern fonts, not all glyph shapes were kept in the end. For example, the German ß got a new design—a decision by the font designer that did not make everybody happy.

7-5-1
Image

With the CM-Super fonts this is no longer a problem: if one prefers the original CM glyph over the EC glyph, one can simply exchange germandbls with germandbls.alt in the file cm-super-t1.enc.1

1 An even better solution is to use a different name for the modified encoding file and then change the references in the (dvips) mapping file to use the new name.

However, these are not the only differences between the original Computer Modern fonts and the new EC fonts. The latter have many more individual designs for larger font sizes (while CM fonts were scaled linearly) and in this respect the fact that both really are different font families is quite noticeable.2 The particular example that follows is perhaps the most glaring difference of that kind.

2 The historical mistake was to pretend to NFSS that both are the same families (e.g., cmr, cmss), just encoded according to different font encodings. Unfortunately, this cannot be rectified without huge backward compatibility problems.

7-5-2
Image

This issue is no problem if one likes the EC designs and uses T1 throughout. Otherwise, a number of approaches can be taken to resolve this problem. One is to employ a different set of font definitions that do not make use of all individual EC font designs, and that are closer to those of the traditional CM fonts, but with improved typographical quality. Such a solution is provided by Walter Schmidt’s package fix-cm, which is distributed as part of the core LaTeX distribution. Load this package directly after the document class declaration (or even before using RequirePackage), as it takes effect only for fonts not already loaded by LaTeX—and the document class might load fonts.

7-5-3
Image

Another possible solution is to use the Almost European fonts (by Lars Engebretsen) or the EZ-fonts (by Robert Fuster), both of which are sets of virtual fonts built upon the Computer Modern fonts. They implement the T1 encoding with the exception of a small number of glyphs that simply cannot be obtained from the CM font material.

Image Searching problems in .pdf documents

This approach has a number of disadvantages. For instance, these solutions do not support the companion symbol fonts, so the additional symbols provided by the textcomp package cannot be used at all. More importantly, the use of virtual fonts to build composite glyphs means that a resulting .pdf file would not be searchable for words containing diacritics, simply because instead of the accented character (as a single glyph) a complicated construction is placed in this file. In other words, the solutions help to make LaTeX believe that it deals with single glyphs (and thus allows proper hyphenation and kerning) but this information is lost again in the resulting output file, so further post-processing cannot be done properly.

However, as far as the selected fonts are concerned, the ae package shows the same result as fix-cm.

7-5-4
Image

Latin Modern on the horizon

In 2002, three European TeX user groups (DANTE, GUTenberg, and NTG) initiated and funded a project to integrate all of the variants of the Computer Modern Roman typefaces into a single Latin Modern family of fonts. The project is being carried out by Bogusław Jackowski and Janusz Nowacki, and the first official version of the Latin Modern fonts was presented at the DANTE meeting in 2003.

7-5-5
Image

At the time of writing, the fonts were continuing to undergo further fine-tuning. For example, additional kerning pairs and language-dependent ligatures are being added. It is expected that a later version of the Latin Modern fonts will become the default fonts for LaTeX; for now, they can be used by loading the lmodern package and selecting the T1 encoding.

7.5.2. inputenc—Selecting the input encoding

If your computer allows you to write accented characters, either via single keystrokes or by some other input method (e.g., by pressing ' and then a to get à) and also displays them nicely in the editor...

Image

... then ideally you would use such a text directly with LaTeX instead of having to type 'a, ^e, and so forth.

While with languages such as French and German the latter approach is still feasible, languages such as Russian and Greek really require the potential for direct input, as (nearly) every character in these languages has a command name as its internal LaTeX form. For example, the default Russian definition for eftextafter contains the following text (meaning “on the next page”):

Image

Clearly, no one wants to type text like this on a regular basis. Nevertheless, it has the advantage of being universally portable, meaning that it will be interpreted correctly on any LaTeX installation. On the other hand, typing on an appropriate keyboard

Image

is clearly preferable, provided it is possible to make LaTeX understand this kind of input. The problem is that what is stored in a file on a computer is not the characters we see in the above sequence, but rather octets (numbers) representing the characters. In different circumstances (using a different encoding), the same octets might represent different characters.

How does LaTeX determine which interpretation it should use? As long as everything happens on a single computer and all programs interpret octets in files (when reading or writing) in the same manner, everything is usually fine. In such a situation it may make sense to activate an automatic translation mechanism that is built into several recent TeX implementations. If, however, any file produced on such a system is sent to a different computer, processing is likely to fail or, even worse, may appear to succeed, but will in fact produce wrong results by displaying incorrect characters.

To cope with this situation the inputenc package was created. Its main purpose is to tell LaTeX the “encoding” used in the document or in a part of the document. This is done by loading the package with the encoding name as an option. For example:

Image

From that point onward LaTeX knows how to interpret the octets in the remainder of the document on any installation,1 regardless of the encoding used for other purposes on that computer.

1 This statement is true only if the TeX installation has not been set up to make some hard-wired transformation when reading from a file. As mentioned in the introduction to this chapter, many TeX implementations have been extended to support such transformations, but if they are activated it is no longer possible to process documents in several languages in parallel.

A typical example is shown below. It is a short text written in the koi8-r encoding popular in Russia. The right side shows what the text looks like on a computer using a Latin 1 encoding (e.g., in Germany). The left side shows that LaTeX was nevertheless able to interpret the text correctly because it was told which input encoding was being used.

7-5-6
Image

The list of encodings currently supported by inputenc is given below. The interface is well documented, and support for new encodings can be added easily. Thus, if the encoding used by your computer is not listed here, it is worth looking into the inputenc package documentation1 to see whether it was added recently. You can also search the Internet for encoding files for inputenc provided by other authors. For example, encodings related to the Cyrillic languages are distributed together with other font support packages for Cyrillic languages.

1 Process inputenc.dtx with LaTeX.

The ISO 8859 standard [67] defines a number of important single-byte encodings, of which those related to the Latin alphabet are supported by inputenc. For MS-DOS and Windows operating systems a number of single-byte encodings have been defined by IBM and Microsoft, of which a subset is currently supported. In addition, some encodings defined by other computer vendors are available. The perhaps somewhat ad hoc (and constantly growing) selection is mainly the result of contributions from the LaTeX user community.

latin1 This is the ISO 8859-1 encoding (also known as Latin 1). It can represent most Western European languages, including Albanian, Catalan, Danish, Dutch, English, Faroese, Finnish, French, Galician, German, Icelandic, Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.

latin2 The ISO Latin 2 encoding (ISO 8859-2) supports the Slavic languages of Central Europe that use the Latin alphabet. It can be used for the following languages: Croat, Czech, German, Hungarian, Polish, Romanian, Slovak, and Slovenian.

latin3 This character set (ISO 8859-3) is used for Esperanto, Galician, Maltese, and Turkish.

latin4 The ISO Latin 4 encoding (ISO 8859-4) can represent languages such as Estonian, Latvian, and Lithuanian.

latin5 The ISO Latin 5 encoding (ISO 8859-9) is closely related to Latin 1 and replaces the rarely used Icelandic letters from Latin 1 with Turkish letters.

latin9 Latin 9 (or ISO 8859-15) is another small variation on Latin 1 that adds the euro currency sign as well as a few other characters, such as the œ ligature, that were missing for French and Finnish. It is becoming increasingly popular as a replacement for Latin 1.

cp437 IBM 437 code page (MS-DOS Latin but containing many graphical characters to draw boxes).

cp437de IBM 437 code page but with a “ß” (German sharp s) in place of a ö (Greek beta) as used with German keyboards.

cp850 IBM 850 code page (MS-DOS multilingual latin1).

cp852 IBM 852 code page (MS-DOS multilingual latin2).

cp858 IBM 858 code page (IBM 850 with the euro symbol added).

cp865 IBM 865 code page (MS-DOS Norway).

cp1250 Windows 1250 (Central and Eastern Europe) code page.

cp1252 Windows 1252 (Western Europe) code page.

cp1257 Windows 1257 (Baltic) code page.

ansinew Windows 3.1 ANSI encoding; a synonym for cp1252.

decmulti DEC Multinational Character Set encoding.

applemac Macintosh (standard) encoding.

macce Macintosh Central European code page.

next NeXT Computer encoding.

utf8 Unicode’s UTF-8 encoding support.

Most TeX installations accept 8-bit characters by default. Nevertheless, without further adjustments, like those performed by inputenc, the results can be unpredictable: characters may vanish, or you might get whatever character is present in the current font at the octet location being referred to, which may or may not be the desired glyph. This behavior was the default for a long time, so it was not changed in LaTeX2ε because some people rely on it. However, to ensure that such mistakes can be caught, inputenc offers the option ascii, which makes any character outside the range 32–126 illegal.

Image

Originally the inputenc package was written to describe the encoding used for a document as a whole—hence the use of options in the preamble. It is, however, possible to change the encoding in the middle of a document by using the command inputencoding. This command takes the name of an encoding as its argument. Processing is rather computing intensive, as typically more than 120 characters are remapped each time. Nevertheless, we know of applications that change the encoding several times within a paragraph yet seem to work reasonably well.

UTF-8 support

When inputenc was written, most LaTeX installations were on computers that used single-byte encodings like the ones discussed in this section. Today, however, another encoding is becoming popular as systems start to provide support for Uni-code: UTF-8. This variable-length encoding represents Unicode characters in one to four octets. Recently, some Linux distributions decided to use UTF-8 as the default encoding for the operating system, leaving their LaTeX users baffled that files written using the keys on the keyboard were suddenly no longer accepted by LaTeX. For this reason encoding support for UTF-8 was added to inputenc via the option utf8. Technically, it does not provide a full UTF-8 implementation. Only Unicode characters that have some representation in standard LaTeX fonts are mapped (i.e., mainly Latin and Cyrillic character sets); all others will result in a suitable error message. In addition, Unicode combining characters are not supported, although that particular omission should not pose a problem in practice.

7-5-7
Image

UTF-8 has the property that ASCII characters represent themselves and most Latin characters are represented by two bytes. In the verbatim text of the example, the two-byte representations of the German umlauts in UTF-8 are shown in TeX’s hexadecimal notation, that is with each octet preceded by ^^. In an editor that does not understand UTF-8, one would probably see them as similar to the output that is produced when they are interpreted as Latin 1 characters.

The UTF-8 support offered by inputenc at the moment1 is restricted to the character subset of Unicode directly supported by the inputenc mapping options (e.g., latin1, latin2) as described on page 359. A package with more comprehensive UTF-8 support (including support for Chinese, Korean, and Japanese characters), though consequently more complex in its set-up, is the ucs package written by Dominique Unruh. You may want to give it a try if the inputenc solution does not cover your needs.

1 This is more of a resource problem than a technical one and thus may change.

7.5.3. fontenc—Selecting font encodings

To be able to use a text font encoding with LaTeX, the encoding has to be loaded in the document class, a package, or in the document preamble. More precisely, the definitions to access the glyphs in fonts with a certain encoding have to be loaded. The canonical way to do this is via the fontenc package, which takes a comma-separated list of font encodings as a package option. The last of these encodings is automatically made the default document encoding. If Cyrillic encodings are loaded, the list of commands affected by MakeUppercase and MakeLowercase is automatically extended. For example,

Image

will load all necessary definitions for the Cyrillic T2A and the T1 (Cork) encodings and set the latter to be the default document encoding.

Image Multiple uses of fontenc allowed

In contrast to normal package behavior, one can load this package several times with different optional arguments to the usepackage command. This is necessary to allow a document class to load a certain set of encodings and enable the user to load still more encodings in the preamble. Loading encodings more than once is possible without side effects (other than potentially changing the document default font encoding).

If language support packages (e.g., those coming with the babel system) are used in the document, it is often the case that the necessary font encodings are already loaded by the support package.

7.5.4. textcomp—Providing additional text symbols

When the T1 font encoding was defined in Cork, it was decided that this encoding should omit many standard text symbols such as † and instead include as many composite glyphs as possible. The rationale was that characters that are subject to hyphenation have to be present in the same font, while one can fetch other symbols without much penalty from additional fonts. These extra symbols have, therefore, been collected in a companion encoding.

In 1995, a first implementation of this encoding (TS1) was developed by Jörg Knappen [78, 79]. With the textcomp package, Sebastian Rahtz provided a LaTeX interface to it.

Unfortunately, just as with the T1 encoding, the encoding design for TS1 was prepared based on glyph availability in the TeX world without considering that the majority of commercial fonts provide different sets of glyphs. As a result, the full implementation of this encoding is available for very few font families, among them EC and CM Bright fonts. For most PostScript fonts implementations of the encoding also exist, but half of the glyphs are missing and produce square blobs of ink.1 Table 7.6 on pages 363–364 shows the glyphs made available by textcomp and the commands to access them. Commands colored in blue indicate that the corresponding glyph is most likely not available when PostScript fonts are used.

1 The T1 encoding has the same problem when it comes to PostScript fonts, but fortunately only five (seldom used) glyphs are missing from most fonts; see Example 7-9-2 on page 417.

Image
Image

Table 7.6. Commands made available with textcomp

Subsets of the TS1 encoding

To help with these problems the textcomp package nowadays knows for many font families to what extent they implement the TS1 encoding. In addition, it offers a number of options that restrict the set of new commands for those font families it does not know about.

For any unknown font family, the option safe allows only commands available with the ISO-Adobe character set (except for extcurrency but adding a fake exteuro). The option euro replaces the fake euro symbol with a real glyph; hence if that glyph does not exist in the font, exteuro will produce a nasty blob of ink.

The package option full enables all commands for fonts textcomp does not know about. This means in particular that the perfectly valid LaTeX commands extcircled and will stop working the moment a document font is selected that does not contain the necessary glyphs in its TS1 encoding. For this reason, the default option almostfull leaves these two commands untouched, to avoid the situation shown in the next example.

7-5-8
Image

Since Times Roman is a font that textcomp knows about, specifying full will still produce correct output; to get the ink blobs we also had to add force in the previous example. This option directs textcomp to ignore all knowledge about individual font families and use the subset denoted by the additional option in all cases.1

1 This option is best avoided, as it can produce incorrect output without any warning.

When textcomp gets loaded (with or without restricting options), a large number of new commands are made available to access the new symbols. In addition, a number of symbols that have been (historically) taken by LaTeX from math fonts (e.g., extbullet, or extdagger) are now taken from the companion fonts; as a consequence, they now sometimes change their shapes when the font attributes (family, series, shape) are changed.

7-5-9
Image

While this is usually the right solution, it may result in changes in unexpected places. For example, the itemize environment by default uses extbullet to indicate first-level items. If the slightly bigger bullet is preferred, then we have to undo the change in the default setting by returning the default to the right math encoding (usually OMS1). Compare this to Example 7-5-9.

1 One has to look for the default declaration in LaTeX.ltx to find the right encoding.

7-5-10
Image

Of course, a more sensible solution in this case may be to adjust the definition for labelitemi (see Section 3.3.1). For example:

Image

Diacritical marks on uppercase letters are sometimes flattened in some font designs compared to their lowercase counterparts. The EC fonts follow this tradition. For example, the grave accents on ò and Ò are different (which is not the case with Lucida, the document font used in this book). This poses a problem if one needs an uncommon letter that is not available as a single glyph in the T1 encoding, but rather must be constructed by placing the diacritical mark over the base character. In that case the same diacritical mark is used, which can result in noticeable differences (see the Image in the next example). The capital... accents shown in Table 7.6 on page 363 solve this problem by generating diacritical marks suitable for use with uppercase letters.

7-5-11
Image

LaTeX offers a extcompwordmark command, an invisible zero-width glyph that can, for example, be used to break up unwanted ligatures (at the cost of preventing hyphenation). When the textcomp package is loaded, this glyph has a height of 1ex, which makes it possible to use it as the argument to an accent command, thereby placing an accent between two letters. In the next example this command is used to produce the German -burg abbreviation. With the textcomp package two additional compound word marks become available: extascendercompwordmark and extcapitalcompwordmark that have the height of the ascender or capitals in the font, respectively.

7-5-12
Image

The above example works only with T1-encoded fonts (textcomp is additionally needed for the extcapitalcompwordmark). The default definition for extcompwordmark in LaTeX does not use a real zero-width character, but rather (lacking such a glyph) a zero-width space.

As the $ sign is a glyph available in both the OT1 and T1 encodings, there is no point in removing its definition and forcing LaTeX to pick up the TS1 version if you are typesetting in this encoding. However, assume you want to use the variant dollar sign Image, for your dollars automatically. In that case you have to get rid of the declarations in other encodings so that LaTeX will automatically switch to TS1.

Image

Such redeclarations will, of course, work only if the document fonts contain the desired glyph in the TS1 encoding. In this book they would have failed, because Lucida Bright (the document font for this book) has only the restricted set of ISO-Adobe symbols available. So if you wonder where the Image and similar symbols shown in the book actually came from, the answer is simple: from the EC fonts.

What can you do if you want to use, say, extborn, but the current font family you use does not implement it? One possible solution is to overwrite the default provided by the textcomp package using DeclareTextCommandDefault. The idea is that the default switches to a font family that you know contains the desired symbol (for example, cmr if your main document font is a serifed font, or cmss if it is a sans serif one), and then you can use UseTextSymbol to pick up the symbol from the TS1 encoding in that family.1

1 For more abstract symbols this approach often gives an acceptable result; in case of accents your mileage may vary.

7-5-13
Image

You can use this approach for any symbol defined by the textcomp package. In case of accents the definition is similar. This time we declare the default to have an argument and in the definition we use UseTextAccent. For example:

Image

In fact, for symbols (but not for accents), textcomp attempts to resolve the problem of missing glyphs by locally switching to a font family stored in extcompsubstdefault (the default is Computer Modern Roman) and typesetting the symbol in this family, after having issued a suitable error message. Use the option warn to get only warnings instead of errors. Of course, such substitutions produce inferior results, especially for “textual symbols”, if the current font is visually incompatible with the substitution family. In the next example we use Computer Modern Sans as a substitute. Be careful to select a family that has full TS1 coverage; otherwise, your redefinition will produce endless errors!

7-5-14
Image

According to the specifications the TS1 encoding contains old-style digits as well as the punctuations period and comma. It allows one to typeset dates and other (positive) numbers with old-style numerals by simply switching to the TS1 font encoding. Unfortunately, old-style numerals are usually unavailable in most PostScript fonts (you must buy the “expert” font set in most cases), so that this method works correctly for only a few font families.1

1 If the glyphs are directly accessed by manually switching to the TS1 encoding, as is done in the example, a restricting option (e.g., safe) will have no effect.

7-5-15
Image

The textcomp package solves this problem by redefining the oldstylenums command to automatically use the old-style numerals in the TS1 encoding if the current font contains them. If not, it will issue a warning and produce lining numerals instead.

7-5-16
Image

If you own fonts that textcomp does not know about (or for some reason assumes that they implement a smaller subset than they actually do), you can inform the package about the font family in question by using the configuration file textcomp.cfg. For example, the commercial Lucida Blackletter originally contained only the basic ISO-Adobe glyphs, so textcomp takes a conservative approach and allows only these symbols. But nowadays it also contains the extohm symbol, so by using DeclareEncodingSubset after loading the package (or in the configuration file) you can typeset it in this font family as well.

7-5-17
Image

For details on the use of DeclareEncodingSubset and the subset numbers used, see the documentation in ltoutenc.dtx in the standard LaTeX distribution.

7.5.5. exscale—Scaling large operators

Normally the font employed for large mathematical symbols is used in only one size. This set-up is usually sufficient, as the font includes most of the characters in several different sizes and (La)TeX is specially equipped to automatically choose the symbol that fits best. However, when a document requires a lot of mathematics in large sizes—such as in headings—the selected symbols may come out too small. In this case, you can use the package exscale, which provides for math extension fonts in different sizes. The package only works for documents using Computer Modern math fonts. However, packages providing alternate math font set-ups often offer this functionality as a package option.

7.5.6. tracefnt—Tracing the font selection

The package tracefnt can be used to detect problems in the font selection system. This package supports several options that allow you to customize the amount of information displayed by NFSS on the screen and in the transcript file.

errorshow This option suppresses all warnings and information messages on the terminal; they will be written to the transcript file only. However, real errors will be shown on the terminal. Because warnings about font substitutions and so on can mean that the final result will be incorrect, you should carefully study the transcript file before printing an important publication.

warningshow When this option is specified, warnings and errors are shown on the terminal. This setting gives you the same amount of information as LaTeX2ε does without the tracefnt package loaded.

infoshow This option is the default when you load the tracefnt package. Extra information, which is normally only written to the transcript file, is now also displayed on your terminal.

debugshow This option additionally shows information about changes to the text font and the restoration of such fonts at the end of a brace group or the end of an environment. Be careful when you turn on this option because it can produce very large transcript files that can quickly fill up your disk space.

In addition to these “standard tracing” options,1 the package tracefnt supports the following options:

1 It is suggested that package writers who support tracing of their packages use these four standard names if applicable.

pausing This option turns all warning messages into errors to help in the detection of problems in important publications.

loading This option shows the loading of external fonts. However, if the format or document class you use has already loaded some fonts, then these will not be shown by this option.

7.5.7. nfssfont.tex—Displaying font tables and samples

The LaTeX distribution comes with a file called nfssfont.tex that can be used to test new fonts, produce font tables showing all characters, and perform similar font-related operations. This file is an adaption of the program testfont.tex, which was originally written by Donald Knuth. When you run this file through LaTeX, you will be asked to enter the name of the font to test. You can answer either by giving the external font name without any extension—such as cmr10 (Computer Modern Roman 10pt)—if you know it, or by giving an empty font name. In the latter case you will be asked to provide a NFSS font specification, that is, an encoding name (default T1), a font family name (default cmr), a font series (default m), a font shape (default n), and a font size (default 10pt). The package then loads the external font corresponding to that classification.

Next, you will be requested to enter a command. Probably the most important one is able, which produces a font chart like the one on page 434. Also interesting is ext, which produces a longer text sample. To switch to a new test font, type init; to finish the test, type ye or stop; and to learn about all the other possible tests (at the moment basically still tailored for the OT1 encoding), type help.

With a bit of care you can also use the program non-interactively, provided your LaTeX implementation supports input redirection. For example, if the file nfssfont.in contains

Image

then a call like LaTeX nfssfont < nfssfont.in (on UN*X implementations) would read all input from that particular file, first producing a glyph chart for the font cmr10 and then creating a text sample for T1/cmss/bx/n/10.

Two things are important here. First, the nfssfont.tex program issues an implicit init command, so the first input line either should contain a font name or should be completely empty (to indicate that an NFSS classification follows). Second, the input to init must appear on individual lines with nothing else (not even a comment, as that would mask the line ending), because the line ending indicates the end of the answer to a question like “Font encoding [T1]: encoding=” that you would get if you ran the program interactively.

7.6. PSNFSS—PostScript fonts with LaTeX

The PSNFSS bundle, originally developed by Sebastian Rahtz, offers a complete working set-up of the LaTeX font selection scheme for use with common PostScript fonts, covering the “Base 35” fonts (which are built into any Level 2 PostScript printing device and the ghostscript interpreter) and the free Charter and Utopia fonts.1 The current implementation of PSNFSS is maintained by Walter Schmidt and is part of the required set of support files for LaTeX that should be available with every LaTeX installation.

1 If the Utopia fonts are missing on your TeX installation they can be downloaded from the CTAN directory fonts/utopia. Consult the documentation of your TeX system on how to install them.

For normal use you will probably have to include only one (or more) of the packages listed in Table 7.7 on the next page to change the default Roman, sans serif, and/or typewriter typefaces. If you study this table you will notice that only two packages attempt to set up new fonts for math and that the first eight packages only change fonts in one of the three text font categories. Thus, to get Times as the Roman text font, Helvetica as the sans serif text font, and Courier as the typewriter text font, one would need to load mathptmx, helvet, and courier. So why is the times package, which does this all in one go, considered obsolete?

Image

Table 7.7. Fonts used by PSNFSS packages

Scale Helvetica to blend with surrounding fonts

One reason is that Helvetica, if loaded at its nominal size, is actually too large to blend well with Times or Courier. That does not matter so much in a design where Helvetica is used only for headings, say. But if these fonts are going to be mixed in running text (something that is made easy by LaTeX commands such as extsf), then using a package such as times will produce questionable results. The helvet package, on the other hand, offers the ability to scale the fonts by specifying the option scaled, which scales the fonts down to 95% of the requested size. This option is actually a keyword/value option, so that even finer control is possible—scaled=0.92 would load the fonts at 92% of their nominal size.

There is, however, one set of circumstances in which you might wish to use the times package after all: when you do not want to change the math font set-up, or you want to use some other set of fonts for math. In that case you can still load the helvet package afterwards to apply scaling.

Direct access to fonts

The PSNFSS bundle uses the Karl Berry naming scheme [19] throughout; the classification and the external font names are shown in Table 7.8 on the following page. Using this table, it is easy to access individual fonts without loading any package, such as via a call to usefont (see Example 7-6-1 below). Because these fonts can be easily scaled to any size, this method offers attractive possibilities when designing headings or title pages, as it facilitates the use of sizes different from those created with the standard LaTeX font size commands.

Image
Image

Table 7.8. Classification of font families in the PSNFSS distribution

7-6-1
Image

The PSNFSS collection contains only two packages that modify the math setup: mathptmx selects math fonts that blend with Times Roman (described in Section 7.6.2 on page 376) and mathpazo selects math fonts designed to work with Palatino (see Section 7.6.3 on page 377). The packages mathptm and mathpple are predecessors that are retained mainly for backward compatibility. Outside the PSNFSS collection a few other packages that change the math font set-up are available (in most cases involving commercial fonts). Some free packages are described in Section 7.7 on page 381, including one that uses Utopia for typesetting text and mathematics. A collection of sample pages with different text and math fonts appears in Section 8.8.3.

Adjusting the leading

Most document classes designed for use with Computer Modern set up a leading (aselineskip) of 10pt/12pt. This may appear to be too tight for several of the PostScript font families shown below, due to a larger x-height of the fonts. However, as this is a matter of document design and also depends on the chosen line width and other factors, the packages in the PSNFSS collection make no attempt to adjust the leading. For a given document class you can change the leading by a factor by issuing the declaration linespread{factor} in the preamble. For example, linespread{1.033} would change the leading from, say, 12pt to approximately 12.4pt. For best results, however, one needs to use a document class designed for the selected document fonts or, lacking such a class, to redefine the commands ormalsize, footnotesize, and so on (see page 343 for details). Also remember that changing the leading might result in a noticeable number of “Underfull vbox” warnings, if the extheight is no longer an integral number of text lines (see page 930 for further details).

Sans serif as document typeface

By default, LaTeX selects a Roman typeface as the document font. Packages like helvet or avant change the default sans serif typeface (by changing sfdefault) but do not change the default document font family. If such a typeface should be used as the document font, issue the line

Image

in the preamble of your document.

Besides supporting the common PostScript text fonts, the PSNFSS collection contains the interesting pifont package. It sets up various commands for use with the so-called Pi fonts (i.e., special symbol fonts like Zapf Dingbats and Symbol). It is described in Section 7.6.4 on page 378.

7.6.1. Font samples for fonts supported by PSNFSS

This section provides textual samples of the fonts supported by the PSNFSS collection. The examples were generated by explicitly selecting the font size and leading via a call to fontsize and then selecting the font with a usefont command. For example, the first sample was generated with fontsize{9}{13} usefont{T1}{pag}{m}{n}.

ITC Avant Garde Gothic 9pt/13pt (pag)

Avant Garde Gothic was designed by Herb Lubalin and Tom Carnase based on the distinctive logo designed for Avant Garde magazine. It is a geometric sans serif type with basic shapes built from circles and lines. Effective for headlines and short texts, but it needs generous leading. A (commercially available) condensed version that better retains legibility in lengthier texts was designed by Ed Benguiat.

Image

ITC Bookman 10pt/12pt (pbk)

Bookman was originally designed in 1860 by Alexander Phemister for the Miller & Richard foundry in Scotland (commercially available from Bitstream). The ITC revival by Ed Benguiat has a larger x-height and a moderate stroke contrast that is well suited for body text and display applications.

Image

Bitstream Charter 10pt/12.4pt (bch)

Bitstream Charter is an original design by Matthew Carter intended to work well on low-resolution devices; hence, it contains squared serifs and avoids excessive use of curves and diagonals. It is useful for many applications, including books and manuals.

Image

Courier 10pt/12pt (pcr)

Courier is a wide-running, thin-stroked monospaced font. It was designed by Howard Kettler of IBM and later redrawn by Adrian Frutiger. These days it is often used in combination with Times Roman, producing a striking contrast. One reason for the popularity of this combination is certainly its availability on any PostScript device. For alternatives see Section 7.7.4.

Image

Helvetica 10pt/13pt (phv)

Helvetica was originally designed by Max Miedinger for the Haas foundry of Switzerland, hence the name. It was later extended by the Stempel foundry, with further refinements being made by Mergenthaler Linotype in the United States. Helvetica is claimed to be the most popular typeface of all time.

Image

New Century Schoolbook 10pt/12.5pt (pnc)

The New Century Schoolbook typeface was designed at the beginning of the 20th century by Morris Benton of the American Type Founders. It was created in response to a publisher’s commission that sought a typeface with maximum legibility for elementary schoolbooks.

Image

Palatino 10pt/11.5pt (ppl)

Palatino, designed by Hermann Zapf, is one of the most widely used typefaces today. You can feel the brush that created it, which gives it a lot of elegance. Although originally designed as a display typeface, due to its legibility Palatino soon gained popularity as a text face as well.

Image

Times Roman 10pt/12pt (ptm)

Times Roman is Linotype’s version of Monotype’s Times New Roman, which was originally designed under the direction of Stanley Morison for the London Times newspaper. The Adobe font that is built into many PostScript devices uses Linotype’s 12-point design.

Image

Utopia 10pt/12.5pt (put)

Utopia, designed by Robert Slimbach, combines the vertical stress and pronounced stroke contrast of 18th-century Transitional types with contemporary innovations in shape and stroke details.

Image

ITC Zapf Chancery 10pt/12pt (pzc)

Zapf Chancery is a contemporary script based on chancery handwriting, developed during the Italian Renaissance for use by the scribes in the papal offices. Highly legible, it can be usefully applied for short texts and applications like invitations and awards.

Image

7.6.2. mathptmx—Times Roman in math and text

The mathptmx package makes Times the document text font and implements a math font set-up for use with such documents. It builds on freely available Type 1 PostScript fonts and is, therefore, somewhat inferior to some of the commercially available solutions that offer fonts especially designed for this purpose. Nevertheless, it has the advantage of being (at least potentially) available in every TeX installation.1

1 The TeX installation must support virtual fonts, which is the case for nearly every distribution.

The mathptmx package was co-authored by Alan Jeffrey, Sebastian Rahtz, and Ulrik Vieth. It was based upon earlier work by Alan Jeffrey [72], in particular the mathptm package (the predecessor to mathptmx) and, most importantly, the fontinst system [57, pp.393–404], which provided the initial breakthrough in making PostScript fonts generally available with TeX.

Technically, the mathptmx package uses a collection of virtual fonts that implement the math fonts needed for TeX by drawing them from several font resources—Times Roman, Times Italic, Symbol, various Computer Modern fonts (mainly for delimiters, big operators, arrows, and the like), and Ralph Smith’s Formal Script (RSFS). The RSFS fonts are a better solution for a script/calligraphic alphabet than Zapf Chancery, which is used in mathptm for this purpose.

7-6-2
Image

It has some features in common with the mathpazo package. First, when loaded with the option slantedGreek, uppercase Greek letters are slanted instead of being upright (the default). In either case the two extra commands upDelta and upOmega will print an upright Δ and , respectively. Second, the functionality of the exscale package is automatically provided: thus big operators and delimiters scale with the current font size.

Image Proper bold faces missing

On the downside, the package disables oldmath for the simple reason that no bold version of the Adobe Symbol font exists. You can get, of course, a bold math alphabet with mathbf, but this gives you only upright Latin characters and digits. In particular, using the bm package to make individual symbols bold will produce questionable results, as the best the m command can do is to produce “poor man’s bold” by overprinting the symbols with slight offsets.

7-6-3
Image

Another (small) potential problem is that the commands jmath, coprod, and amalg are unavailable. If either issue turns out to be a real problem, then alternatives to consider are the TX fonts (Section 7.7.5) and the commercial solutions MathTime (Professional) by Michael Spivak and TM-Math by MicroPress.

7.6.3. mathpazo—Palatino in math and text

A package named mathpple supporting Adobe Palatino with matching math fonts was originally developed by Walter Schmidt based on earlier work by Aloysius Helminck. It used the same approach as mathptm; that is, it was built on the virtual font mechanism, combining symbols from Palatino, Symbol, Euler, and CM Math. As these fonts only partly match the style of Palatino, Diego Puga developed a set of Type 1 PostScript fonts (Pazo Math) intended to repair the defects apparent in the mathpple solution. The Pazo Math fonts contain glyphs that are unavailable in Palatino and for which Computer Modern or glyphs from Symbol look odd when combined with Palatino. These include a number of math glyphs, the uppercase Greek alphabet (upright and slanted), a blackboard bold alphabet, as well as several other glyphs (such as the euro symbol) in regular and bold weights and upright and slanted shapes.

The fonts are accessible with the mathpazo package developed by Diego Puga and Walter Schmidt as part of the PSNFSS collection. It makes Palatino the document text font and provides a math set-up that works by using virtual fonts accessing Palatino Italic, the Math Pazo fonts, and CM fonts (for the remaining symbols).

7-6-4
Image

This package is very similar to the mathptmx package. In particular, it supports the option slantedGreek to make uppercase Greek letters slanted instead of upright (the default). In either case the two extra commands upDelta and upOmega will print an upright Δ and , respectively. Also, it provides the functionality of the exscale package.

However, in contrast to the mathptmx package, which uses the Adobe Symbol font, for which no bold-weight variant exists, the mathpazo package provides full access to symbols in a bold weight.

7-6-5
Image

As mentioned above, the Pazo Math fonts contain a blackboard bold alphabet, which can be accessed through the math alphabet identifier mathbb. The font contains the uppercase Latin letters and the digit “1”. Be careful, however: all other digits are silently ignored!

7-6-6
Image

If mathbb should select a different alphabet, provided by some other package, it is best to suppress the Pazo Math one by using the option noBBppl when loading the package.

Commercial Palatino fonts

The package also offers two additional options that deal with the use of commercially available Palatino fonts1 for the text font: sc selects Palatino with true small capitals (font family name pplx) and osf selects Palatino with small caps and old-style numerals (font family name pplj) instead of basic Palatino (ppl).

1 These fonts are commercially available and are not part of the Base 35 fonts.

7.6.4. pifont—Accessing Pi and Symbol fonts

Fonts containing collections of special symbols, which are normally not found in a text font, are called Pi fonts. One such font, the PostScript font Zapf Dingbats, is available if you use the pifont package originally written by Sebastian Rahtz and now incorporated as part of PSNFSS.

Accessing glyphs from Zapf Dingbats

The directly accessible characters of the PostScript Zapf Dingbats font are shown in Table 7.9 on the next page. A given character can be chosen via the ding command. The parameter for the ding command is an integer that specifies the character to be typeset according to the table. For example, ding{'46} gives Image.

Image

Table 7.9. Glyphs in the PostScript font Zapf Dingbats

The dinglist environment is a variation of the itemize list. The argument specifies the number of the character to be used at the beginning of each item.

7-6-7
Image

The environment dingautolist allows you to build an enumerated list from a sequence of Zapf Dingbats characters. In this case, the argument specifies the number of the first character of the sequence. Subsequent items will be numbered by incrementing this number by one. This makes some starting positions like '254, '266, '300, and '312 (i.e., in octal notation) in Table 7.9 on the preceding page very attractive, as differently designed circled number sequences (1–10) start there.

7-6-8
Image

You can fill a complete line (with 0.5 inch space at left and right) with a given character using the command dingline, where the argument indicates the desired character. For filling parts of a line, use the command dingfill. This command works similar to LaTeX’s dotfill command, but uses the specified glyph instead of dots.

7-6-9
Image

Besides providing direct support for the Zapf Dingbats font, the pifont package includes a general mechanism for coping with any Pi font that conforms to the NFSS classification U/family/m/n—for example, the Symbol font with the family name psy.

Accessing individual glyphs from a Pi font

To access individual glyphs from such a Pi font, use the Pisymbol command, which takes the family name as its first argument and the glyph position in the font as its second argument. Using this command one can readily access the characters in the Symbol font, shown in Table 7.10 on page 382. For example, Pisymbol{psy}{210} gives ®. In fact, ding (discussed earlier) is simply an abbreviation for Pisymbol with the first argument set to pzd.

Image

Table 7.10. Glyphs in the PostScript font Symbol

When only Greek letters are desired, you can use the Pifont command and consult the correspondence in Table 7.10. Clearly, this solution is no match for a properly designed font for the Greek language but it might serve in an emergency—for example, to typeset the text above the entrance of Plato’s Academy that states “Only geometers may enter”:

7-6-10
Image

You can also make itemized lists using Pilist or enumerated lists using the Piautolist environments as follows:

7-6-11
Image

The dingline and dingfill commands are also merely abbreviations for the more general commands Piline and Pifill, as shown below. The example reveals curious gaps in the last line. They are due to Piline and Pifill typesetting their symbols on an invisible grid so that symbols on different lines come out vertically aligned.

7-6-12
Image

7.7. A collection of font packages

So far we have discussed font-related packages that belong to core LaTeX—that is, packages that are either part of the base distribution or, as for PSNFSS, are part of the “required” additions. There are, however, many other packages that provide font customization possibilities. Nowadays most of them are part of a LaTeX distribution. If they are not available on your local system, you can obtain them from an electronic archive or from a TeX organization; see Appendix C.

The packages described in the current section modify the document text fonts (and sometimes the math font set-up). As the section title indicates, they represent merely a selection of what is available. Further pointers can be found in the online package catalogue [169] or in one of the FAQ documents on LaTeX [46, 141].

7.7.1. eco—Old-style numerals with Computer Modern

The original Computer Modern fonts contain a set of old-style digits (e.g., 1982) as part of their math fonts, not because old-style numerals have anything to do with math, but because Donald Knuth tried to use the limited font space available in the most economical way, using some free slots in the math fonts to deposit the glyphs there. As the EC font implementation only concerned itself with a new font encoding for text, this anomaly in the math fonts was unfortunately kept.1 Actually, the designers of the text companion encoding (TS1) added old-style numerals to that encoding, but so far this is of little practical relevance because too many font families implement only a subset of the TS1 encoding. See Section 7.5.4, page 367, for more information.

1 Justin Ziegler together with the LaTeX3 project team developed a rationalized font encoding design for 256-glyph math fonts [174]. Unfortunately, until now his theoretical work has not been implemented other than in a prototype using virtual fonts [40].

Basic LaTeX support for old-style numerals

For easy access to old-style numerals hidden in the math fonts, LaTeX provides the command oldstylenums, which can be used in text and within formulas. In its argument you should place the digits that you want to typeset as non-aligning digits. If the command is used in text, spaces in the argument are honored, but you should not try to put characters other than digits into it or the results will be unpredictable. One problem with the default definition of this command is that it will always generate old-style numerals from Computer Modern Roman, regardless of the surrounding fonts in use. For this reason the textcomp package contains a redefinition that produces the old-style numerals from the current font, provided they are available in the current font family; see Section 7.5.4 for details.

This approach for obtaining old-style numerals might be adequate if lining numerals are the norm and old-style numerals are required only once in a while. But in a document layout in which all text numerals are supposed to be presented in old-style it is not really acceptable to require the author to explicitly mark up every occurrence in this way. What is needed in such a case are text fonts that contain old-style instead of lining numerals in the standard slot positions.

The EC fonts contain both lining and old-style numerals (albeit in a somewhat inconvenient position), so it was just a matter of time until someone developed a series of virtual fonts that reencode the fonts to make old-style numerals be the default text numbers. The eco fonts by Sebastian Kirsch provide this reencoding and can be accessed by loading the eco package. Note that the package affects only the text numbers, so it is important to mark up mathematical digits properly. Otherwise, you will obtain a result like the one shown in the example.

7-7-1
Image

7.7.2. ccfonts, concmath—The Concrete fonts

For the text of his book Concrete Mathematics [59], Donald Knuth designed a new typeface [92] to go with the Euler mathematics fonts designed by Hermann Zapf [173]. This font family, called Concrete Roman, was created from the Computer Modern sources by supplying different parameter settings.

Starting from the work done for the EC fonts, it was relatively easy to create Concrete Roman fonts in T1 and TS1 encodings (original work by Frank Mittelbach; current version by Walter Schmidt). The fonts available in these families are shown in Table 7.11 on the following page. Ulrik Vieth used the construction method outlined by Knuth [92] to develop a companion set of Concrete Math fonts including the full range of AMS symbols (as provided by the amssymb or amsfonts package).

Image

Table 7.11. Classification of the Concrete font families

The first package that provided access to these font families for normal text was beton (by Frank Jensen). The following example shows the combination of Concrete text and Euler math fonts (see also Section 7.7.10 on page 396):

7-7-2
Image

A more recent development that also provides the use of Concrete fonts for math and supports the T1 and TS1 encodings is the ccfonts package (by Walter Schmidt). Both packages take care of small but important typographical details, such as increasing the value of aselineskip slightly (see discussion on the facing page). As the Concrete fonts have no boldface series, the ccfonts package offers the option boldsans to use the semibold series of the Computer Modern Sans fonts as a replacement. As a result, without any further adjustments, headings in standard classes will be typeset using this font series.

7-7-3
Image

Because the Concrete fonts are of considerably heavier weight than, say, Computer Modern, it is advisable to use them with a larger leading than most document classes provide by default. For this reason the package automatically enlarges the leading to 10/13 and similar ratios for other document sizes. If this adjustment is undesirable for some reason, it can be canceled with the option standard-baselineskips.

The feature provided by the exscale package is available as the package option exscale; see Section 7.5.5 on page 368 for details. The exscale package itself cannot be used because it is set up to work with only Computer Modern math fonts.

If the amssymb or amsfonts package is loaded, the ccfonts package automatically arranges to use the Concrete variants of the AMS symbol fonts.

Finally, the package offers the option slantedGreek to make uppercase Greek letters slanted instead of being upright (default). The two extra commands upDelta and upOmega will always typeset an upright Δ and , respectively.

7.7.3. cmbright—The Computer Modern Bright fonts

Another font family whose design is based on the sources of the CM fonts are the Computer Modern Bright (CM Bright) fonts by Walter Schmidt, shown in Table 7.12. This family of sans serif fonts is designed to serve as a legible body font. It comes with matching typewriter and math fonts, including the AMS symbols.

Image

Table 7.12. Classification of the Computer Modern Bright font families

Loading the cmbright package in the preamble ensures that these families are selected throughout the document. It is recommended that you combine this package with fontenc, as shown in the next example, to achieve proper hyphenation with languages other than English. All CM Bright fonts have fully implemented T1 and TS1 encoding support.

7-7-4
Image

By default, the package selects a slightly larger leading than the default classes to account for the use of sans serif fonts; this can be canceled by specifying the package option standard-baselineskips. Also in other respects, this package works similarly to other works by Walter Schmidt: the option slantedGreek produces slanted uppercase Greek letters, with upDelta and upOmega typesetting an upright Δ and , respectively. When the amssymb or amsfonts package is loaded, the cmbright package automatically arranges to use the CM Bright variants of the AMS symbol fonts.

The implementation of the fonts is freely available from CTAN archives; Type 1 format versions are commercially sold by MicroPress. Recently, a freely available Type 1 (although without manual hinting) was made available by Harald Harders under the name hfbright. Moreover, as mentioned in Section 7.5.1, the freely available CM-Super Type 1 fonts also cover parts of the CM Bright fonts.

7.7.4. luximono—A general-purpose typewriter font

The choice of monospaced (typewriter) fonts for use in program listings and other applications is not very wide. Of course, with the Computer Modern fonts a suitable typewriter family (cmtt) is included, but if the main document fonts are being replaced, freely available choices for typewriter fonts are few. Adobe Courier runs very wide and for that reason alone it is often a poor choice. While staying with cmtt might be an option, the font may not blend well with the chosen document font.

Recently, with the release of version 4.2 of XFree86, the free implementation of the X Window System, a new, freely distributable, monospaced font family, called LuxiMono, has become available. This Type 1 encoded Postscript font comes with bold, oblique, and bold oblique versions (see Table 7.13 on the facing page). In that respect, it differs from other monospaced fonts, which are often offered only in medium series and more rarely in italic or oblique shapes.

Image

Table 7.13. Classification of the LuxiMono font family

These fonts are original designs by Kris Holmes and Charles Bigelow (Bigelow and Holmes, Inc.), for which hinting and kerning tables have been added by URW++ Design and Development GmbH. The LaTeX integration is provided through the luximono package written by Walter Schmidt.

The following example compares LuxiMono (scaled down to 85% using the option scaled), Computer Modern Typewriter, and Adobe Courier. LuxiMono still has the largest x-height (fontdimen5) and, at the same time, the smallest width. Courier, running very wide, occupies the other end of the spectrum, with CM Typewriter being comfortably in between the two extremes.

7-7-5
Image

If the option scaled is given without a value, the fonts are scaled down to 87%, which gives them a running length approximately equal to that of Computer Modern Typewriter. To get exactly the same running length, 0.87478 should be used for 10pt fonts, while for an 11pt document 0.86124 would be the correct value. This is due to the fact that LuxiMono scales linearly, while Computer Modern fonts have different designs for different sizes. Without scaling LuxiMono has the same running length as Adobe Courier.

7-7-6
Image

Note that the LuxiMono fonts are supported only in the T1 encoding (see the use of fontenc in the examples). The subset of the textcomp symbols typically found in PostScript fonts is available—namely, those declared when loading textcomp with the option safe. However, since the euro symbol is available, it is best to load that package with the option euro.1

1 To see the euro symbol in the various TeX fonts, it is important to have the newest version of the file 8r.enc installed.

7.7.5. txfonts—Alternative support for Times Roman

With the mathptmx package, the PSNFSS bundle supports Times Roman as a document font for both text and math, primarily using Times Italic and the Adobe Symbol font for math characters (see Section 7.6.2). In 2000, Young Ryu released his own set of virtual fonts together with accompanying Type 1 fonts to provide math support for documents using Times Roman as the document font.

The extra fonts cover glyphs typically missing in PostScript fonts—for example, a full set of textcomp symbols, the full range of math symbols as implemented by AMS fonts (see Chapter 8), and others. Thus, these fonts are far more complete than their counterparts in the standard LaTeX PSNFSS package.

The fonts are accessed by loading the package txfonts in the preamble. When the package is loaded, it sets up Times Roman as the main document font and Adobe Helvetica (scaled down to 95%) as the sans serif font. For the typewriter font a monospaced font developed by the package author is used.

Compare the next example with Example 7-6-2 on page 376. The extra line at the end shows a few symbols from textcomp that are unavailable with mathptmx.

7-7-7
Image

The TX fonts (see Table 7.14 on the facing page) have support for the text font encodings OT1, T1, TS1, and LY1. However, the OT1 encoding is not faithfully implemented: some of the deficiencies in this encoding are (incorrectly) circumvented (for example, the fact that only either $ or £ is available in “real” OT1 fonts). Fixing these deficiencies means that the new definitions will not work with any other OT1-encoded font. As OT1 is still the default encoding with LaTeX this change can lead to serious problems.1

1 Strictly speaking, the fonts implement a new encoding that is similar to OT1 but not identical—and incorrectly call it OT1.

Image

Table 7.14. Classification of the TX font families

The following example illustrates the use of the problematic definitions. In OT1-encoded Computer Modern, all glyphs are wrong: the $ turns into a £ sign and all others are simply dropped. On the other hand, there is no problem with T1, so one should always combine txfonts with usepackage[T1]{fontenc}.2

2 As discussed in Section 7.3.5, T1 is the preferred encoding in any case.

7-7-8
Image

In addition, a more serious problem with the current release of the fonts is that the glyph side-bearings in math are extremely tight, up to the point that characters actually touch if used in subscripts or superscripts.

7-7-9
Image

It is possible that these problems will be fixed in a future release of the fonts. For comparison, we show the previous example using mathptmx:

7-7-10
Image

To summarize, the TX font families currently show some deficiencies in math typesetting, but offer a large range of symbols for math and text, including all symbols from the AMS math fonts and a full implementation of the textcomp symbols. If the focus is on having many symbols available in Type 1 fonts, such as when producing PDF documents, the fonts provide an interesting alternative.

7.7.6. pxfonts—Alternative support for Palatino

Young Ryu also developed a set of virtual fonts together with accompanying Type 1 fonts to provide math support for documents using Adobe Palatino as the main document font. The PX fonts (see Table 7.15 on the next page) are set up by loading the pxfonts package. For sans serif and typewriter fonts the package uses fonts from the txfonts set-up (scaled-down Helvetica and TX typewriter), so both font sets need to be installed.

Image

Table 7.15. Classification of the PX font families

The next example uses the same text as Example 7-7-7 on the preceding page but this time loads the pxfonts package.

7-7-11
Image

Since the PX fonts have the same font layout as the TX fonts, the OT1 problems shown in Example 7-7-8 on the previous page also arise with this family.

The typesetting in math is still very tight but not always so noticeable as in the TX fonts. Below, the Example 7-7-9 on the facing page is repeated for comparison.

7-7-12
Image

7.7.7. The Fourier-GUTenberg fonts

Adobe donated four fonts from the Utopia family (Utopia Regular, Utopia Italic, Utopia Bold, and Utopia BoldItalic) to the X-Consortium. Though not free software, these typefaces are available free of charge and basic support for them is available through the PSNFSS bundle (see Section 7.6).

The Fourier-GUTenberg bundle developed by Michel Bovani is a typesetting environment based on the Utopia typeface but complemented with the characters missing to provide a full T1 encoding (OT1 is not supported), a suitable set of math symbols, Greek sloped and upright letters, and a matching calligraphic and blackboard bold alphabet so that whole documents can be prepared without using any other typefaces. The font encoding is shown in Table 7.16 on the next page; a complete example page is given in Figure 8.4 on page 515.

Image

Table 7.16. Classification of the Fourier-GUTenberg font families

7-7-13
Image

The fourier package supports typesetting mathematics “à la French”, with Greek letters and Roman uppercase letters in upright style, by specifying the option upright. Compare the next example to the output in Example 8-4-1 on page 490.

7-7-14
Image

If you require extended math support from the amsmath package as in the previous example, load this package first, so that certain aspects of the math formatting tuned for typesetting in Utopia will not be overwritten. For the same reason, you should load amssymb first, though you will find that fourier already contains several symbols normally available only with amssymb. In fact, the fourier package offers a small set of mathematical symbols not found elsewhere (e.g., certain integral signs, some delimiters, and other symbols). Some are shown in the next example.

7-7-15
Image

Upright and slanted variants of the Greek letters can be used together in a single document by prefixing the command names with other. For example:

7-7-16
Image

Without the upright option (or with the default option sloped), the letters are sloped according conventional typesetting of mathematics—that is, upright uppercase Greek and everything else slanted. The meaning of the other... commands is swapped, accordingly.

7-7-17
Image

In the current implementation fourier does not support oldmath. Consequently, using the bm package will most often lead to “poor man’s bold”; see Section 8.8.2.

Support for the commercial expert fonts

To complement the freely available fonts Adobe offers a commercial expert set containing old-style digits, real small capitals, a semibold series, and an extra bold series. To support these typefaces, the fourier package offers additional options: expert provides extsb and extblack to select the extra font series and arranges to use real small capitals with extsc. The oldstyle option provides the same support but additionally uses old-style numerals in text (lining allows you to refer to lining numerals in that case). Finally, the fulloldstyle works like oldstyle but additionally arranges for old-style numerals to be used in formulas.

7.7.8. The URW Antiqua and Grotesk fonts

URW’s Antiqua Condensed 10pt/12pt (uaq)

The German company URW made two PostScript fonts, URW Antiqua Condensed and URW Grotesk Bold, freely available. LaTeX support in the form of virtual fonts and .fd files is available. They are accessed using the classification given in Table 7.17. The sample below was typeset by specifying fontfamily{uaq} selectfont.

Image

Table 7.17. Classification of the URW Antiqua and Grotesk fonts

Image

URW’s Grotesk Bold 10pt/12pt (ugq)

As its name indicates, the URW Grotesk Bold font is available only in a bold series (although within LaTeX selecting a medium series is supported for convenience but refers to the same bold font). As such, it is not suitable for general running text. Potential applications include headings and other display material.

Image

7.7.9. yfonts—Typesetting with Old German fonts

There exists a set of beautiful fonts for typesetting in Gothic, Schwabacher, and Fraktur designed in 1 after traditional typefaces by Yannis Haralambous [62]. These days Type 1 versions of the fonts are available as well. To use the fonts, load the yfonts package written by Walter Schmidt. This package internally defines some local encodings that reflect the special features found in the fonts and integrates them fully with LaTeX’s font management.

1 Compiling the fonts from the sources sometimes produces error messages, but generally produces usable fonts when is directed to ignore them. The collection also contains a font with baroque initials.

The commands gothfamily, swabfamily, and frakfamily switch to Gothic, Schwabacher, and Fraktur, respectively. If one wants to typeset a whole document in such a typeface, the corresponding command should be used directly after egin{document}. Because of the nonstandard encodings of the fonts, redefining the document defaults (e.g., familydefault) is not possible. In addition to the font switches, the usual ext.. commands for typesetting short fragments are provided.

7-7-18
Image

The fonts are available in the usual LaTeX sizes starting from 10pt, so that size-changing commands (e.g., ormalsize and larger) will work. There are, however, no further font series or shapes, so commands like emph, extit, and extbf have no effect other than producing a warning. Following historical practice you can use Schwabacher to emphasize something inside text typeset in Fraktur.

For accents one can use the standard LaTeX representations (e.g., "a for ä). To facilitate input, the fonts also contain ligatures that represent umlauts (e.g., "a). In Fraktur and Schwabacher there also exist alternate umlauts, which can be accessed with *a and similar ligatures. If the yfonts package is loaded with the option varumlaut, then " produces the variant glyphs automatically.

All three fonts contain a glyph for the “short s”, accessed through the ligature s:, and “sharp s”, accessed by ss, or through the ligature sz or "s.

7-7-19
Image

The font selected with gothfamily is not a copy of Gutenberg’s font used for his Bible (which had 288 glyphs altogether), but it follows Gutenberg’s guidelines on lowercase characters and implements as many ligatures as can be fit into a 7-bit font. For this reason many standard ASCII symbols are unavailable in this font.

The two other fonts also implement only a subset of visible ASCII. Problematic are the semicolon (which is missing in Schwabacher) and the characters +, =, ', [, ], /, *, @, &, and % (which are either missing or produce wrong or nonmatching shapes). Their omission is seldom a problem since typically they are not needed in documents using such fonts, but one needs to be aware that no warning or error message is issued if they are used—the only indication is missing or wrong glyphs in the printed output!

7-7-20
Image

The default line spacing of the standard classes is too large for the Old German fonts. For this reason the package implements the fraklines command, which selects a suitable aselineskip for Fraktur or Schwabacher. It must be repeated after every size-changing command.

The font collection also contains a font with decorative initials, as shown in the next example.

7-7-21
Image

The command yinipar used above starts a new paragraph without indentation, producing a baroque dropped initial. For this command to work, a full paragraph (up to and including the next blank line or par) must be typeset using fraklines. Otherwise, the space left for the initial will be either too large or too small.

As an alternative, you can access these initials with the extinit command or the font switch initfamily, in which case initials aligned at the baseline are produced. The example also used the command etc, which produces a once-popular symbol for “etc.”; it is available in Fraktur only.

The font collection contains a second Fraktur font that has slightly wider glyphs with at the same time slightly thinner stems. It can be selected by redefining frakdefault as shown in the next example. When compared to Example 7-7-21, the difference in running length can be clearly observed, resulting in an overfull box on the third line.

7-7-22
Image

7.7.10. euler, eulervm—Accessing the Euler fonts

As mentioned earlier, Hermann Zapf designed a beautiful set of fonts for typesetting mathematics—upright characters with a handwritten flavor—named after the famous mathematician Leonhard Euler [99]. These fonts can be accessed as (math) alphabets of their own, or you can generally modify the math font set-up, thus making LaTeX use Euler math fonts (rather than Computer Modern) by default.

The Euler fonts contain three math alphabets: Image, Image, and Image.1 The script alphabet can be used via the eucal package, which makes this math alphabet available under the name mathcal (obsolete alternate name EuScript). If the package is loaded with the mathscr option, the math alphabet becomes available through the command mathscr, with mathcal retaining its original definition.

1 None of these alphabets is suitable for typesetting text as the individual glyphs have side-bearings specially tailored for use in math formulas.

To access Euler Fraktur in formulas, you use the package eufrak, which defines the math alphabet mathfrak (obsolete alternate name EuFrak). There is no particular package to access the Euler Roman alphabet separately. The next example shows Computer Modern Calligraphic, Euler Script, and Euler Fraktur side by side.

7-7-23
Image

The NFSS classification for the fonts in these families is shown in Table 7.18. The fonts in the current distribution of the Euler math families are available only in encoding schemes that differ from all other encoding schemes for mathematics. For this reason, the fonts are all assigned the encoding U (unknown).

Image

Table 7.18. Classification of the Euler math font families

The uncommon encoding makes it difficult to simply substitute the Euler math alphabets for the default CM math fonts. Yet the euler package, written by Frank Jensen, went exactly this way, redeclaring most of LaTeX’s math font setup. In conjunction with the package beton, which sets up Concrete as the default text font family, it simulates the typography of Knuth’s book Concrete Mathematics [59], as shown in Example 7-7-2.

Virtual Euler fonts

One of the problems with extensive reencoding in macro packages, as done by the euler package, is that it is likely to break other packages that assume certain symbols in slot positions, as defined by more established font encodings. The eulervm package developed by Walter Schmidt attempts to avoid this problem by providing reencoded virtual fonts that follow as much as possible the standard math encodings OML, OMS, and OMX.

The eulervm package sets up a mathnormal alphabet, which is based mainly on Euler Roman, and a mathcal alphabet, which is based on Euler Script. It does not provide immediate support for the Euler Fraktur alphabet—to access this math alphabet one needs to additionally load the eufrak package. Also, the math symbols are taken from the Euler fonts, with a few exceptions coming from the Computer Modern math fonts. Compare the next example to Example 7-7-23 on the previous page and you will see that mathcal has changed and that sum and the indices are different, as they are now taken from the Euler fonts.

7-7-24
Image

The option small causes eulervm to load all Euler fonts at 95% of their normal size, thereby enabling them to blend better with some document fonts (e.g., Adobe Minion). This option also affects the Euler Fraktur fonts if they are loaded with eufrak and the AMS symbol fonts.

Neither the standard hbar command nor hslash (from the amssymb package) is really usable with the Euler fonts if it is used without modification (i.e., with euler), because hslash uses a Computer Modern style “h” and hbar gets the slash in a strange position.

7-7-25
Image

This issue restricts the usage of the euler package somewhat for physics and related fields. The eulervm package resolves this problem (partially) by providing a properly slashed “h” glyph built using the possibilities offered by the virtual font mechanism ([91] explains the concepts). It does, however, provide only a slashed version (hslash); if hbar is used, a warning is issued and the slashed glyph is used nevertheless.

7-7-26
Image

The functionality provided by the exscale package is automatically available. See Section 7.5.5 on page 368 for details.

In typical font set-ups the same digits are used in text and math formulas. The Euler fonts contain a set of digits that have a distinctive look and thus make digits in text and math look noticeably different.

By default, the digits of the main document font are used in formulas as well. To switch to the digits from Euler Roman, one has to explicitly request them by specifying the option euler-digits. It then becomes very important to distinguish between a number in a mathematical or a textual context. For example, one must watch out for omitted $ signs, as in the first line of the next example.

7-7-27
Image

Normally, the math accent hat is taken from the main document font, which might not be a good choice when text and math fonts are noticeably different. With the option euler-hat-accent, an alternative version from the Euler fonts is used instead. In the example we mimic that option and define the alternate accent under the name varhat manually to enable comparison of the two (neither looks really perfect).

7-7-28
Image

It is usually best to load the eulervm package after all the document fonts have been defined, because eulervm defines the math alphabets (e.g., mathsf) by evaluating the document’s default information that is current when the package is loaded. In the example below, the loading order is absolutely essential because the ccfonts package also tries to set up the math fonts and thus the one that comes last wins.

In the book Concrete Mathematics [59], where Euler and Concrete fonts were first used together, one can see that slanted Image and Image signs were once part of the Euler Math fonts. Somewhere along the way these two symbols got lost, though traces of their existence can be found in [92] and in macros that Donald Knuth developed for producing the book. With the help of the virtual font mechanism, Walter Schmidt brought them back in the eulervm package; compare the next example to Example 7-7-2 on page 384, which shows the straight ≤ sign.

7-7-29
Image
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.4.147