The microtype package

10 downloads 145 Views 563KB Size Report
The microtype package provides an interface to the micro-typographic extensions ..... Using the optional argument, you can limit the application of the set to pro-.
The microtype package An interface to the micro-typographic extensions of pdfTEX R Schlicht

[email protected]

v1.7 — 2005/03/23

Abstract The microtype package provides an interface to the micro-typographic extensions of pdfTEX: character protrusion and font expansion. It allows to restrict font expansion and/or character protrusion to a customizable set of fonts, and to configure all micro-typographic aspects of the fonts in a straight-forward and flexible way. Settings for various fonts are provided.1 Note that font expansion and character protrusion will only work with pdfTEX, at least version 0.14f. Automatic font expansion requires version 1.20a or newer. The package will by default enable the features that can safely be assumed to work.

Contents 1 Micro-Typography with pdfTEX

3

2 Invoking the Package 2.1 General Options . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Option for Character Protrusion . . . . . . . . . . . . . . . . 2.3 Options for Font Expansion . . . . . . . . . . . . . . . . . .

4 4 6 6

3 User Command

7

4 Configuration 4.1 Declaring Font Sets . . . . . . . . . . . . . . . . . . . . . . . 4.2 Micro Fine Tuning . . . . . . . . . . . . . . . . . . . . . . .

7 7 9

[Character Protrusion – 9]

[Font Expansion – 11]

4.3 Character Inheritance . . . . . . . . . . . . . . . . . . . . . 4.4 Configuration Files . . . . . . . . . . . . . . . . . . . . . . .

12 13

1 Currently, this package provides settings for Computer Modern Roman, Palatino, Times, Adobe Garamond and Minion, and Bitstream Charter, as well as some generic settings for unknown fonts.

1

5 Caveats

14

6 Contributions

15

7 Acknowledgments

15

8 References

16

9 Short History

16

10 Implementation 10.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 10.2 Auxiliary macros . . . . . . . . . . . . . . . . . . . . . . . . 10.3 Setting up a font . . . . . . . . . . . . . . . . . . . . . . . .

18 19 23 27

[Protrusion – 30] [Expansion – 33] [Generic macros – 36] [Hook into LATEX’s font selection – 45]

10.4 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . .

47

[Font Sets – 47] [Declarations – 53] [Fine Tuning – 54] [Character Inheritance – 58] [Permutation – 60]

10.5 User Command . . . . . . . . . . . . . . . . . . . . . . . . . 10.6 Package Options . . . . . . . . . . . . . . . . . . . . . . . .

64 66

11 Configuration Files 11.1 Character Inheritance . . . . . . . . . . . . . . . . . . . . . 11.2 Font Expansion . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Character Protrusion . . . . . . . . . . . . . . . . . . . . . .

73 74 75 77

[Default – 77] [Italics – 82] [Small caps – 88] [textcomp – 92] [Math – 96]

12 Auxiliary File for Micro Fine Tuning

102

A Change History

104

B Index

108

List of Tables 1 Predefined font sets . . . . . . . . . . . . . . . . . . . . . . . . . 2 Fonts with tailored protrusion settings . . . . . . . . . . . . . . . 3 Order for matching font attributes . . . . . . . . . . . . . . . . .

9 13 39

MICRO-TYPOGRAPHY WITH PDFTEX

1

3

Micro-Typography with pdfTEX

´ Thành, introduces two feapdfTEX, the TEX extension written by Hàn Thê tures that make it the tool of choice not only for the creation of electronic documents but also of works of outstanding time-honoured typography: character protrusion (also known as margin kerning) and font expansion. ´ Thành’s thesis: Quoting Hàn Thê ‘Margin kerning is the adjustments of the characters at the margins of a typeset text. A simplified employment of margin kerning is hanging punctuation. Margin kerning is needed for optical alignment of the margins of a typeset text, because mechanical justification of the margins makes them look rather ragged. Some characters can make a line appear shorter to the human eye than others. Shifting such characters by an appropriate amount into the margins would greatly improve the appearance of a typeset text. Composing with font expansion is the method to use a wider or narrower variant of a font to make interword spacing more even. A font in a loose line can be substituted by a wider variant so the interword spaces are stretched by a smaller amount. Similarly, a font in a tight line can be replaced by a narrower variant to reduce the amount that the interword spaces are shrunk by. There is certainly a potential danger of font distortion when using such manipulations, thus they must be used with extreme care. The potentiality to adjust a line width by font expansion can be taken into consideration while a paragraph is being broken into lines, in order to choose better breakpoints.’ [Thành 2000, 323]

Both these features have been lacking a simple LATEX user interface for quite some time. Then, the pdfcprot package was published [pdfcprot], which allowed LATEX users to employ character protrusion without having to mess much with the internals. Font expansion, however, was still most difficult to utilize, since it required that the font metrics be available in all levels of expansion. Therefore, anybody who wanted to use this feature had to create multiple instances of the fonts in advance. Shell scripts to somewhat relieve the user from this burden were available – however, it remained a cumbersome task. Furthermore, all fonts were still being physically created, thus wasting compilation time and disk space. ´ Thành implemented a feature that In the summer of 2004, Hàn Thê can be expected to prove as a major facilitation for TEX and LATEX users: Font expansion can now take place automatically. That is, pdfTEX no longer needs the expanded font metrics but will calculate them at run-time, and completely in memory.

INVOKING THE PACKAGE

4

This package provides a simple interface to both font expansion and character protrusion.2 All micro-typographic aspects may be customized to your taste and needs in a straightforward manner. The next chapters will present a survey of all options and customization possibilities.

2

Invoking the Package

There is nothing surprising in loading this package: \usepackage{microtype}

This will be sufficient in most cases, and if you are not interested in fine-tuning the micro-typographic appearance of your document (which would seem unlikely, since using this package is proof of your interest in typographic issues), you may actually skip the rest of this document.

2.1

General Options

Like many other LATEX packages, the microtype package accepts options in the well known key=value syntax. In the following, you’ll find a description of all keys and their possible values (the underlined value may be omitted in the options list; some values are hplaceholdersi; multiple values, where allowed, must be enclosed in braces). protrusion true, false, compatibility, nocompatibility, hfont set namei expansion These are the main options to control the level of micro-typography that

should be applied to the fonts in your document. By default, the package is moderately greedy: Character protrusion will be enabled, font expansion will only be disabled in circumstances where pdfTEX cannot expand the fonts automatically, that is, if it is either too old (versions before 1.20) or if the output mode is DVI (see next option). Protrusion and expansion may be enabled or disabled independently from each other by setting the respective key to true resp. false. The activate activate option is a shortcut for setting both expansion and protrusion at the same time. So, the following lines all have the same effect (when creating PDF files with a new pdfTEX): \usepackage[protrusion=true,expansion=true]{microtype} \usepackage[protrusion,expansion]{microtype} \usepackage[activate={true,nocompatibility}]{microtype} \usepackage{microtype} 2 Therefore, it is an alternative, not a supplement, to the pdfcprot package.

INVOKING THE PACKAGE: General Options

5

When pdfTEX employs font expansion and character protrusion, line breaks (and consequently, page breaks) may turn out differently. If that is not desired, you may pass the value compatibility to the protrusion and/or expansion options. Typographically, however, the results may be suboptimal. Finally, you may also specify the name of a font set to which character protrusion and/or font expansion should be restricted. See section 4.1 for a detailed discussion. DVIoutput true, false

pdfTEX is not only able to generate PDF output but can also spit out DVI files.3 The latter can be ordered with the option DVIoutput, which will set \pdfoutput to zero. Note that this will confuse packages that depend on the value of \pdfoutput if they were loaded earlier, as they had been made believe that they were called to generate PDF output where they actually weren’t. These packages are, among others: graphics, color, hyperref, pstricks and, of course, ifpdf. Either load these packages after microtype or else issue the command \pdfoutput=0 earlier – in the latter case, the DVIoutput option is redundant. When generating DVI files, font expansion has to be enabled explicitly. Automatic font expansion will not work because dvips (resp. the DVI viewer) is not able to generate the expanded fonts on the fly. draft true, false final If the draft option is passed to the package, font expansion and character

protrusion will be disabled. The draft and final options may also be inherited from the class options; of course, you can override them in the package options. verbose true, false, errors

Information on the settings used for each font will be written into the log file if you enable the verbose option, which is disabled by default. When microtype encounters a problem that is not fatal (e. g., an unknown character in the settings, or non-existent settings), it will by default only issue a warning and try to continue. Loading the package with verbose=errors will turn all warnings into errors, so that you can be sure that no problem will go unnoticed.

3 TEX systems are beginning to switch to pdfTEX as the default engine even for DVI output.

INVOKING THE PACKAGE: Option for Character Protrusion

2.2

6

Option for Character Protrusion

factor hnumberi (1000)

Using this option, you can globally increase or decrease the amount that characters will be protruded. While a value of 1000 means that the full protrusion as specified in the configuration (see section 4.2) will be used, a value of 500 would result in halving all protrusion factors of the configuration. This might be useful if you are generally satisfied with the settings but prefer the margin kerning to be less or more visible (e. g., if you are so proud of being able to use this feature that you want everybody to see it, or – to mention a motivation more in compliance with typographical correctness – if you are using a large font that calls for more modest protrusion).

2.3

Options for Font Expansion

auto true, false

As noted in chapter 1, the expanded versions of the fonts may be calculated automatically. This option is true by default provided that pdfTEX’s version is found to be 1.20 or higher and the output mode is PDF; otherwise, it will be disabled. If auto is set to false, the fonts for all expansion steps must exist. stretch hnumberi (20) shrink You may specify the stretchability and shrinkability of a font, i. e. the maxi-

mum amount that a font may be stretched or shrunk. The numbers will be divided by 1000, so that a stretch factor of 10 means that the font may be expanded by up to 1%. The default stretch factor is 20. The shrink factor will by default be the same as the stretch factor. step hnumberi (min(stretch,shrink)/5)

Font expansion will be applied in discrete steps. For example, if step is set to 4 (which it is by default), pdfTEX may use up to eleven different expansion levels of a font (from −20 to 20). If you set stretch or shrink to something other than their default values but do not specify step, it will be set to 1/5th of the smaller value of the two. Therefore, the following lines are all equivalent: \usepackage[stretch=20,shrink=20]{microtype} \usepackage[stretch=20,step=4]{microtype} \usepackage{microtype}

CONFIGURATION

7

selected true, false

When applying font expansion, it is possible to restrict the expansion of some characters if they are more sensitive to deformation than others (e. g., the ‘O’, in contrast to the ‘I’). This is called selected expansion, and its usage allows to increase the stretch and shrink limits (to, say, 30 instead of 20); however, the gain is limited since at the same time the average stretch variance will be decreased. Beginning with version 1.5, where this option was introduced, it is by default set to false, so that all characters will be expanded by the same amount. See section 4.2.2 for a more detailed discussion.

3

User Command

\microtypesetup {hkey = value listi}

This command may be used anywhere in the document to change the general settings of the micro-typographic extensions. It accepts the keys: expansion, protrusion and activate, which in turn may receive the values true, false, compatibility or nocompatibility (but not the name of a font set). Thus, you could temporarily disable font expansion by saying: \microtypesetup{expansion=false}

4 4.1

Configuration Declaring Font Sets

By default, all text fonts that are being used in the document will be subjected to protrusion and a basic set of fonts to expansion. You may want to customize the set of fonts that should get the benefit of micro-typographic treatment. This can be achieved by specifying attributes of the font that have to be matched for them to be taken into account. \DeclareMicroTypeSet [protrusion|expansion] {hset namei} {hset of fontsi} \DeclareMicroTypeSet* This macro declares a new set of fonts to which font expansion or character

protrusion (or, if no optional argument is given, both) should be applied. This set can then be activated by calling: \UseMicroTypeSet[protrusion|expansion]{hset namei}

The starred version of the command declares and activates the font set at the same time.

CONFIGURATION: Declaring Font Sets

8

The set of fonts is specified by assigning values to the NFSS font attributes: encoding, family, series, shape, and size (cf. [LATEX 2ε font selection]). Let’s start with an example. This package defines a font set called ‘basictext’ in the configuration file as follows: \DeclareMicroTypeSet{basictext} { encoding = {T1,OT1,LY1}, family = {rm*,sf*}, series = {m}, shape = {}, size = {normalsize,footnotesize,small,large} }

If you now call \UseMicroTypeSet[expansion]{basictext}

in the document’s preamble, only fonts in the text encodings T1, OT1 or LY1, roman or sans serif families, normal (or ‘medium’) series, and in sizes called by \normalsize, \footnotesize, \small or \large, will be expanded. Math fonts, on the other hand, will not, since they are in another encoding. Neither will fonts in bold face, or huge fonts. Etc. (The ‘basictext’ font set will be activated for font expansion unless you choose a different one.) If an attribute list is left empty – be it by saying something like ‘shape={}’, as in the above example, or by not specifying it at all –, it does not constitute a restriction. In other words, this is equivalent to specifying all possible values for that attribute. Therefore, the predefined set ‘alltext’, declared like this: \DeclareMicroTypeSet{alltext} { encoding = {T1,OT1,LY1,TS1} }

is far less restrictive. The only condition for this set is that the encoding must match. (This is the default font set for character protrusion.) If a value is followed by an asterisk (like ‘rm*’ and ‘sf*’ in the example above), it does not designate a NFSS code, but will expand to the current \hvalueidefault, e. g. \rmdefault.4 For example, if you want to include the bold font, too, you should say ‘bf*’ instead of ‘b’ (\bfdefault for Computer Modern is ‘bx’, while for other fonts, it might be ‘b’ or even ‘sb’). A single asterisk means \hcharacteristicidefault, e. g. \encodingdefault, respectively \normalsize for the size axis. Sizes may be either specified as a dimension (10 or 10pt), or as a size selection command without the backslash. You may also specify ranges (e. g., small-large); while the lower boundary is included in the range, the upper boundary is not. Thus, 12-16 would match 12, 13.5, and 15.999 pt, e. g., but not 16 pt. You are allowed to omit the lower or upper bound (-10, large-). 4 Note that this expansion will take place immediately, so you should make all relevant changes before loading this package.

9

CONFIGURATION: Micro Fine Tuning

normalfont

basictext (basicmath)

alltext (allmath)

all

encoding

\encodingdefault

T1, OT1, LY1 (OML, OMS)

T1, OT1, LY1, TS1 (OML, OMS)



family

\familydefault





series shape size

\seriesdefault \shapedefault \normalsize

\rmdefault, \sfdefault m – \normalsize, \footnotesize, \small, \large

– – –

– – –

Table 1: Predefined font sets

Table 1 lists all predefined font sets. They may also be activated by passing their name to the expansion resp. protrusion option when loading the package, for example: \usepackage[protrusion=allmath,expansion=basicmath]{microtype} \UseMicroTypeSet [protrusion|expansion] {hset namei}

This macro activates a font set previously defined by \DeclareMicroTypeSet. Using the optional argument, you can limit the application of the set to protrusion or expansion only. The commands \DeclareMicroTypeSet and \UseMicroTypeSet may only be used in the preamble or in the main configuration file (cf. section 4.4).

4.2

Micro Fine Tuning

Every character asks for a particular amount of protrusion. It may also be desirable to restrict the maximum expansion of certain characters. Furthermore, since every font looks different, settings have to be specific to a font or set of fonts. This package offers flexible and straight-forward methods of customizing these finer aspects of micro-typography. 4.2.1

Character Protrusion

\SetProtrusion [hoptionsi] {hset of fontsi} {hprotrusion settingsi}

Using this macro, you can set the protrusion factors for each character of a font or a set of fonts. A very incomplete example would be the following: \SetProtrusion { encoding = T1, family = cmr } { A = { 50, 50}, \textquoteleft = {700, } }

CONFIGURATION: Micro Fine Tuning

10

which would result in the character ‘A’ being protruded by 5% of its width on both sides, and the left quote character by 70% of its width into the left margin. This would apply to all font shapes, series and sizes of the Computer Modern Roman family in encoding T1. The protrusion settings consist of hcharacteri = hprotrusion factorsi pairs. The hcharactersi may be specified either as a single character (‘A’), as a text symbol command (‘\textquoteleft’), or as a slot number: three digits for decimal notation, prefixed with " for hexadecimal, with ’ for octal (e. g., the ‘fl’ ligature in T1 encoding: 029, "1D, ’35). 8-bit characters may be entered directly or in the LATEX 7-bit way of defining them: both Ä and \"A are valid, provided the character is actually included in the encoding. You also have the possibility to declare sets of characters which should inherit protrusion or expansion factors (see section 4.3). The hprotrusion factorsi designate the amount that a character should be protruded into the left margin (first value) respectively into the right margin (second value), where 1000 means that the character should be kerned fully into the margin, while, for example, a value of 50 means that it should be protruded by 5% of its width. Negative values are admitted, as well as numbers larger than 1000 (but effectively not more than 1em of the font). You can omit either number if the character should not be protruded on that side, but must not drop the separating comma. The set of fonts to which the settings should apply are declared using the same syntax of hfont axisi = hvalue listi pairs as in the command \DeclareMicroTypeSet. To find the matching settings for a given font the package will try all combinations of font encoding, family, series, shape and size, with decreasing significance in this order. For instance, if both settings for the current family (say, OT1/cmr///) and settings for italic fonts in normal weight (OT1//m/it/) exist, those for the Computer Modern Roman font would be applied.5 The encoding must always match. Optional Options: name You may assign a name to the protrusion settings, so that you are able to load it by another list. load You can load another list (provided, you previously assigned a name to it), before the current list will be loaded, so that the fonts will inherit the values from the loaded list. factor This option can be used to influence all protrusion factors of the font or font set, overriding any global factor setting (see section 2.2). 5 For the interested, table 3 on page 39 presents the exact order.

CONFIGURATION: Micro Fine Tuning

11

The name and load options provide a way to simplify the configuration considerably. You can for instance create a default list for a font; settings for other shapes or series can then load these settings, and extend or overwrite them (since the value that comes last will take precedence). Font settings will be loaded recursively. 4.2.2

Font Expansion

\SetExpansion [hoptionsi] {hset of fontsi} {hexpansion settingsi}

By default, all characters of a font are allowed to be stretched or shrunk by the same amount. However, it is also possible to limit the expansion of certain characters if they are more sensitive to deformation. This is the purpose of the \SetExpansion macro. Note that it will only have an effect if the package has been loaded with the selected option. Otherwise, settings in \SetExpansion will be ignored. The expansion settings consist of hcharacteri = hexpansion factori pairs. You may specify one number for each character, which determines the amount that a character may be expanded. The numbers denominate thousandth of the full expansion. For example, if you set the expansion factor for the character ‘O’ to 500, it will only be expanded or shrunk by one half of the amount that the rest of the characters will be expanded or shrunk. While the default value for character protrusion is 0 – that is, if you didn’t specify any characters, none would be protruded –, the default value for expansion is 1000, which means that all characters would be expanded by the same amount. The set of fonts

is specified in the same way as in \SetProtrusion.

Options: Additionally to name, load and factor, the optional first argument accepts the following options: stretch, shrink, step, auto. Using these, you may override the global settings specified in the package options. If you don’t specify either one of stretch, shrink and step, their respective global value will be used (that is, no calculation will take place). You could for instance take advantage of these options in the following way: \SetExpansion [ load stretch { series encoding { }

= = = =

T1-default, 10 ] bf*, T1 }

CONFIGURATION: Character Inheritance

12

The bold font would thus inherit the settings defined in the list ‘T1-default’, but would only be allowed to be expanded by a maximum amount of 1%. However, since pdfTEX does not allow different expansion limits or steps within one paragraph, a different method is also provided with the factor option, using which you can influence the expansion factors of all characters (in contrast to the overall stretchability) of the font. The factor option can only be used to decrease the stretchability of the characters, that is, it may only receive values smaller than 1000. Also, it can only be used for single fonts or font sets; setting it globally in the package options wouldn’t make much sense – for that, you use the stretch etc. options. These options in the optional first argument will even be taken into account if the package has not been loaded with the selected option. If the selected option has been passed to the package (cf. section 2.3), and settings for a font don’t exist, font expansion will not be applied to this font at all. Should the extraordinary situation arise that you want to employ selected expansion in general but that all characters of a particular font (set) should be expanded or shrunk by the same amount, you have to declare an empty list for these fonts, e. g.: \SetExpansion { encoding = T1, family = {pkpx,pkpj} } { }

4.3

Character Inheritance

\DeclareCharacterInheritance [protrusion|expansion] {hfont seti} {hinheritance listi}

In most cases, accented characters should inherit the protrusion resp. expansion factors from the respective base character. For example, all ˘ should probably be proof the characters À, Á, Â, Ã, Ä, Å and A truded by the same amount as the character A. Using the command \DeclareCharacterInheritance, you may declare such lists of characters, so that you then only have to set up the base characters. With the optional argument you may confine the scope of the list to protrusion resp. expansion. The font set can be declared in the usual way, with the only exception that you must specify exactly one encoding. The inheritance lists are to be declared as pairs of hbase characteri = hlist of inheriting charactersi. Unless you are using a different encoding or a very peculiarly shaped font, there should be no need to change the default character inheritance settings. In the main configuration file microtype.cfg and the other font-specific configuration files, you can find examples of all these commands.

13

CONFIGURATION: Configuration Files

Font family (NFSS code)

Series

Shapes

TS1

Generic Computer Modern Roman (cmr)b Bitstream Charter (bch) Adobe Garamond (pad, padx, padj) Adobe Minion (pmnx, pmnj) Palatino (ppl, pplx, pplj) Times (ptm, ptmx, ptmj)

m m m m m m m

n, (it, sl, sc)a n, it (sl)c , sc n, it (sl)c , sc n, it (sl)c , sc n, it (sl)c , sc, si n, it (sl)c , sc n, it (sl)c , sc

(•)a

• • • • (•)a (•)a

Math



a Incomplete b Also used for: Latin Modern (lmr), ae (aer), zefonts (zer), eco (cmor), hfoldsty (hfor) c Settings taken from italic shape

Table 2: Fonts with tailored protrusion settings

4.4

Configuration Files

The default configuration, consisting of inheritance settings for OT1, LY1 and T1 encoding, declarations of font sets and alias fonts, and generic protrusion and expansion settings, will be loaded from the file microtype.cfg. You may extend this file with custom settings. If you are embarking on creating new expansion and protrusion settings for a font family, you should put them into a separate file, whose name must be: ‘mt-hfont familyi.cfg’ (e. g. ‘mt-pad.cfg’), and may contain the commands \SetProtrusion, \SetExpansion and \DeclareCharacterInheritance. These files will be loaded automatically if you are actually using the respective fonts. If the font name consists of four characters, the package will also try to find the file for the base font family by removing the suffix denoting the sub-family, so that you may put settings for the fonts padx (expert set), padj (oldstyle numerals) and pad (normal) into one and the same file. This package ships with configuration files for the fonts Computer Modern Roman, Palatino, the inescapable Times, Adobe Garamond and Minion6 and for Bitstream Charter. Table 2 lists them all. If you have created a file for another font and you are willing to share, don’t hesitate to send it to me so that it can be included in future releases of this package. \DeclareMicroTypeAlias {hfont namei} {halias fonti}

You may use this command for fonts that are very similar, or actually the same (for instance if you did not stick to the Berry naming scheme when installing the font). An example would be the Latin Modern fonts which are 6 By courtesy of Harald Harders ([email protected]).

CAVEATS

14

clones of the Computer Modern fonts, so that it is not necessary to create new settings for them – you could say: \DeclareMicroTypeAlias{lmr}{cmr}

which would make the package, whenever it encounters the font lmr and does not find settings for it, also try the font cmr. In fact, you will find this very line in the default configuration file, along with others for the virtual fonts provided by the packages ae, zefonts, eco and hfoldsty. \LoadMicroTypeFile {hfont namei}

In rare cases, it might be necessary to load a configuration file manually, for instance, from within another configuration file, or to be able to extend settings defined in a file that would otherwise not be loaded automatically, or would be loaded too late.7

5

Caveats

Use settings that match your font. Although the default settings should give reasonable results for most fonts, the particular font you happen to be using may have different character shapes that necessitate more or less protrusion or expansion. In particular italic letter shapes may differ wildly in different fonts, hence I have decided against providing default protrusion settings for them. The file test-microtype.tex might be of some help when adjusting the protrusion settings for a font. Don’t use too large a value for expansion. Font expansion is a feature that is supposed to enhance the typographic quality of your document by producing a more uniform greyness of the text block (and potentially reducing the number of necessary hyphenations). When expanding or shrinking a font too much, the effect will be turned into its opposite. Expanding the font by more than 2%, i. e. setting a stretch factor of more than 20, should be justified by a typographically trained eye. If you are so lucky as to be in the possession of multiple instances of a Multiple Master font, you may set expansion limits to up to 4%. Don’t use font expansion for web documents. Because each expanded instance of the font will be embedded in the PDF file, the file size may increase by quite a large factor (depending on expansion limits and step). Therefore, courtesy and thriftiness of bandwidth command it not to enable font expansion when creating files to be distributed electronically. 7 Font package authors might also want to have a look at the hook \MicroType@Hook, described in the implementation section.

ACKNOWLEDGMENTS

15

Compatibility. The package should work happily together with all other LATEX packages (except pdfcprot). However, life isn’t perfect, so problems are to be expected. Currently, I am only aware of the following issues concerning the loading order of packages: • All packages that change the default fonts and encodings (e. g. mathpazo, fontenc) should be loaded before microtype, so that variables used in the configuration file (e. g. ‘rm*’ for \rmdefault) don’t expand to a different value than in the body of the document (as explained in section 4.1). • The CJK package must be loaded before microtype.8

6

Contributions

I would be glad to include configuration files for more fonts. Preparing such configurations is quite a time-consuming task and requires a lot of patience. To alleviate this process, this package also includes a test file that can be used to check at least the protrusion settings (test-microtype.tex). If you have created a configuration file for another font, or if you have any suggestions for enhancements in the default configuration files, I would gratefully accept them: [email protected]

7

Acknowledgments

´ Thành hadn’t created the This package would be pointless if Hàn Thê pdfTEX program in the first place, which introduced the micro-typographic extensions and made them available to the TEX world. Furthermore, I thank him for helping me to improve this package. Harald Harders has contributed protrusion settings for Adobe Minion. I would also like to thank him for a number of bug reports and suggestions he had to make. Andreas Bühmann has suggested the possibility to specify ranges of font sizes, and resourcefully assisted in implementing this. He also came up with some good ideas for the management of complex configurations. The following people have reported bugs or helped otherwise (in chronological order): Ulrich Dirr, Tom Kink, Herb Schulz, Michael Hoppe, Gary L. Gray, Georg Verweyen, Christoph Bier, Peter Muthesius, and Bernard Gaulle. 8 And it might still not work. I simply don’t know, since I know nothing of CJK. Feedback on the interaction of both packages – positive or negative – would be appreciated. 9 Should you have lots of pdfcprot configuration files lying around, I can also provide you with a TEX conversion script. Just ask me.

SHORT HISTORY

8

16

References

Hàn Thê´ Thành, Micro-typographic extensions to the TEX typesetting system, Diss. Masaryk University Brno 2000, in: TUGBoat, vol. 21(2000), no. 4, pp. 317–434. (Online at http://www.tug.org/TUGboat/Articles/tb21-4/ tb69thanh.pdf) ´ Thành, Margin Kerning and Font Expansion with pdfTEX, in: TUGHàn Thê Boat, vol. 22(2001), no. 3 – Proceedings of the 2001 Annual Meeting, pp. 146–148. (Online at http://www.tug.org/TUGboat/Articles/tb22-3/ tb72thanh.pdf) LATEX3 Project Team, LATEX 2ε font selection, 10 February 2004. (Available from CTAN at /macros/latex/doc/fntguide.pdf) Carsten Schurig, The pdfcprot.sty package, 14 August 2002. (Available from CTAN at /macros/latex/contrib/pdfcprot/)

9

Short History

The comprehensive list of changes can be found in appendix A. The following is a list of all changes relevant in the user land; bug fixes are swept under the rug. 1.7 (23. 3. 2005) Possibility to specify ranges of font sizes in the set declarations and protrusion and expansion settings (see sections 4.1 and 4.2) Always take font size into account when trying to find protrusion resp. expansion settings for a given font (see section 4.2) New command \LoadMicroTypeFile to load a font configuration file (see section 4.4) New option ‘verbose=errors’ to turn all warnings into errors Compatibility with the chemsym and statex packages Disable expansion inside \showhyphens Warning when running in draft mode 1.6a (2. 2. 2005) Compatibility with the frenchpro package 1.6 (24. 1. 2005) New option ‘factor’ to influence protrusion resp. expansion of all characters of a font or font set (see sections 2.2 and 4.2) When pdfTEX is too old to expand fonts automatically, font expansion has to be enabled explicitly, automatic expansion will be disabled (see section 2.1) Protrusion settings of digits improved Use e-TEX extensions, if available

SHORT HISTORY

17

1.5 (15. 12. 2004) When output mode is DVI, font expansion has to be enabled explicitly, automatic expansion will be disabled (see section 2.1) New option ‘selected’ to enable selected expansion (see sections 2.3 and 4.2.2); default is: false New default for expansion option ‘step’: 4 (min(stretch,shrink)/5) (see section 2.3) Protrusion settings for Bitstream Charter Compatibility with Turkish babel 1.4b (26. 11. 2004) \UseMicroTypeSet requires the set to be declared (see section 4.1) Internal optimization 1.4 (12. 11. 2004) Set up fonts independently from LATEX font loading (therefore, no risk of overlooking fonts anymore, and the package may be loaded at any time) \microtypesetup now sets the correct level of character protrusion (see chapter 3) New option: ‘final’ 1.3 (27. 10. 2004) Compatibility with the german and ngerman packages 1.2 (3. 10. 2004) New font sets: ‘allmath’ and ‘basicmath’ (see section 4.1 and table 1) Protrusion settings for Computer Modern Roman math symbols Protrusion settings for TS1 encoding completed for Computer Modern Roman and Adobe Garamond If an alias font name is specified, it will be used as an alternative, not as a replacement (see section 4.4) More tests for sanity of settings and whether all fonts will be set up More robust parsing of sizes in font sets 1.1 (21. 9. 2004) Protrusion settings for Adobe Minion, contributed by Harald Harders New macro: \DeclareCharacterInheritance (see section 4.3) Characters may also be specified as octal or hexadecimal numbers (see section 4.2) Configuration file names in lowercase (see section 4.4) 1.0 (11. 9. 2004) First CTAN release

IMPLEMENTATION

10

18

Implementation

The docstrip modules in this file are: driver: The documentation driver (only visible in the dtx file). package: The code for the microtype package. debug: Code for additional output in the log file. Used for – surprise! – debugging purposes. config: Surrounds all configuration modules. m-t: The main configuration file (microtype.cfg). bch: Settings for Bitstream Charter (mt-bch.cfg). cmr: Settings for Computer Modern Roman (mt-cmr.cfg). pad: Settings for Adobe Garamond (mt-pad.cfg). ppl: Settings for Palatino (mt-ppl.cfg). ptm: Settings for Times (mt-ptm.cfg). pmn: Settings for Adobe Minion (mt-pmn.cfg). Contributed by Harald Harders. test: A helper file that may be used to create and test protrusion settings (test-microtype.tex). And now for something completely different. 1 h*packagei 2 \RequirePackage{keyval}[1997/11/10]

\MT@error \MT@warning \MT@warning@nl \MT@warn@err \MT@info \MT@info@nl \MT@vinfo

Communicate. 3 \def\MT@error{\PackageError{microtype}} 4 \def\MT@warning{\PackageWarning{microtype}} 5 \def\MT@warning@nl#1{\MT@warning{#1\@gobble}} 6 \def\MT@warn@err#1{\MT@error{#1}{% 7 This error message appears because you loaded the package\MessageBreak 8 with ‘verbose=errors’.}} 9 \def\MT@info{\PackageInfo{microtype}} 10 \def\MT@info@nl#1{\MT@info{#1\@gobble}} 11 h!debugi\let\MT@vinfo\@gobble 12 hdebugi\let\MT@vinfo\MT@info@nl

These are all commands for the outside world. We define them here as dummy commands, so that they won’t generate an error if we are not running pdfTEX. 13 \newcommand{\DeclareMicroTypeSet}[3][]{} 14 \newcommand{\UseMicroTypeSet}[2][]{} 15 \newcommand{\DeclareMicroTypeAlias}[2]{} 16 \newcommand{\SetProtrusion}[3][]{} 17 \newcommand{\SetExpansion}[3][]{} 18 \newcommand{\DeclareCharacterInheritance}[3][]{} 19 \newcommand{\LoadMicroTypeFile}[1]{}

IMPLEMENTATION: Requirements

19

20 \newcommand{\microtypesetup}[1]{}

This command also has a starred version. 21 \def\DeclareMicroTypeSet{% 22 \@ifstar 23 {\@ifnextchar[\MT@DeclareSet{\MT@DeclareSet[]}}% 24 {\@ifnextchar[\MT@DeclareSet{\MT@DeclareSet[]}}% 25 } 26 \def\MT@DeclareSet[#1]#2#3{}

Set declarations are only allowed in the preamble (resp. the main configuration file). \SetExpansion and \SetProtrusion, on the other hand, must be allowed in the document, too, since they may be loaded from font configuration files. 27 \@onlypreamble{\DeclareMicroTypeSet} 28 \@onlypreamble{\UseMicroTypeSet}

Debug. Cases for \tracingmicrotype: 0: almost none 1: + configuration 2: + heirs 3: + slots 4: + factors 29 h*debugi 30 \newcount\tracingmicrotype 31 \tracingmicrotype=2 32 \def\MT@dinfo#1#2{\ifnum\tracingmicrotype>#1\relax\MT@info{#2}\fi} 33 \def\MT@dinfo@nl#1#2{\ifnum\tracingmicrotype>#1\relax\MT@info@nl{#2}\fi} 34 h/debugi

10.1 \MT@pdftex@no

Requirements

pdfTEX’s features for which we provide an interface here haven’t always been available, and some specifics have changed over time. Therefore, we have to test which pdfTEX we’re using, if any. \MT@pdftex@no will be used throughout the package to respectively do the right thing. Currently, there are five cases: 0: not running pdfTEX 1: pdftex (0.14h) 4: + automatic font expansion; default \efcode = 1000 (>= 1.20a) 35 \let\MT@pdftex@no\z@

IMPLEMENTATION: Requirements

20

Old packages might have defined \pdftexversion to \relax. 36 \ifx\pdftexversion\@undefined \else 37 \ifx\pdftexversion\relax \else 38 hdebugi\MT@dinfo@nl{-1}{running pdftex \the\pdftexversion(\pdftexrevision)} 39 \def\MT@pdftex@no{4} 40 \ifnum\pdftexversion < 120 41 \let\MT@pdftex@no\thr@@ 42 \ifnum\pdftexversion = 14 43 \ifnum \expandafter‘\pdftexrevision < ‘h 44 \let\MT@pdftex@no\tw@ 45 \fi 46 \ifnum \expandafter‘\pdftexrevision < ‘f 47 \let\MT@pdftex@no\@ne 48 \fi 49 \else 50 \ifnum\pdftexversion < 14 51 \let\MT@pdftex@no\@ne 52 \fi 53 \fi 54 \fi 55 \fi 56 \fi 57 hdebugi\MT@dinfo@nl{-1}{pdftex no: \number\MT@pdftex@no}

\MT@exitornot

If we are not using pdfTEX or in case it is too old, we disable everything and exit here. 58 \let\MT@exitornot\relax 59 \ifnum\MT@pdftex@no ... a hexadecimal number: \Mt@char}% 980 \else 981 \if#1’\relax 982 \def\Mt@char{\number#1#2#3}% 983 hdebugi\MT@dinfo@nl{2}{> ... an octal number: \Mt@char}% 984 \else 985 \MT@ifnumber{#1#2#3}{% 986 \def\Mt@char{\number#1#2#3}% 987 hdebugi\MT@dinfo@nl{2}{> ... a decimal number: \Mt@char}% 988 }\relax 989 \fi 990 \fi 991 \ifnum\Mt@char > \@cclv 992 \MT@warning{% 993 Number \noexpand#1\noexpand#2\noexpand#3 in encoding 994 ‘\MT@encoding’ too large!\MessageBreak Ignoring it}% 995 \let\Mt@char\m@ne 996 \fi 997 \let\Mt@rest\@empty 998 \fi 999 \fi 1000 }

\MT@get@symbol

Fortunately, we can simply call \hencodingi\hcommandi instead of \hcommandi itself, which might expand to funny stuff, depending on context. 1001 \def\MT@get@symbol{% 1002 \edef\@tempa{\expandafter\expandafter\expandafter\expandafter 1003 \expandafter\expandafter\expandafter 1004 \meaning\expandafter 1005 \csname\expandafter 1006 \MT@encoding\expandafter 1007 \string\@tempa 1008 \endcsname}% 1009 \expandafter\expandafter\expandafter\Mt@isachar 1010 \expandafter\@tempa\Mt@charstring \relax\relax\relax 1011 \if@tempswa \else

Not all symbols have been defined by \DeclareTextSymbol, in which case

IMPLEMENTATION: Setting up a font

45

they won’t expand to \char"hhex numberi but to a letter (e. g. \i, when using frenchpro). 1012 1013 1014 1015 }

\MT@get@composite

\expandafter\expandafter\expandafter\Mt@isaletter \expandafter\@tempa\Mt@letterstring \relax\relax \fi

Here, we are dealing with accented characters, specified as two tokens. 1016 \def\MT@get@composite#1#2\relax{% 1017 \MT@ifempty{#2}\relax{%

We construct a control sequence of the form: \\hencodingi\haccenti-hcharacteri, e. g. \\T1\"-a, which will expand to a letter if it has been defined by \DeclareTextComposite. This should be robust, finally. 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 }

\edef\@tempa{\expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\expandafter \meaning\expandafter \csname\expandafter \string\csname\MT@encoding\endcsname \string#1-% \string#2% \endcsname}% \expandafter\expandafter\expandafter\Mt@isaletter \expandafter\@tempa\Mt@letterstring \relax\relax }%

10.3.4

Hook into LATEX’s font selection

We append \MT@setupfont to \pickup@font, which is called by LATEX every time a font is selected. We then check whether we’ve already seen this font, and if not, set it up for micro-typography. This ensures that we will catch all fonts, and that we will not set up fonts more than once. The whole package really hangs on this command. In contrast to the pdfcprot package, there is no need to declare the fonts in advance that should be subjected to micro-typography. Also, only those fonts that are actually being used will be set up for expansion and protrusion. For my reference: • \pickup@font calls \define@newfont. • \define@newfont may call – \wrong@fontshape, which in turn will call \pickup@font, and thus \define@newfont again, or – \extract@font. • \pickup@font is called by \wrong@fontshape, \selectfont, or \getanddefine@fonts (for math).

IMPLEMENTATION: Setting up a font

46

Up to version 1.3 of this package, we were using \define@newfont as the hook, which is only called for new fonts, and therefore seemed the natural choice. However, this meant that we had to take special care to catch all fonts: We additionally had to set up the default font, the error font (if it wasn’t the default font), we had to check for some packages that might have been loaded before microtype and were loading fonts, e.g. jurabib, ledmac, pifont (loaded by hyperref), tipa, and probably many more. Furthermore, we had to include a hack for the IEEEtran class which loads all fonts in the class file itself (to fine tune inter-word spacing). Then I discovered that even my favorite class, the memoir class, loads fonts. To cut this short: It seemed to get out of hand, and I decided that it would be better to use \pickup@font and decide for ourselves whether we’ve already seen that font. I hope the overhead isn’t too large. \MT@font@list (We use a comma-separated list.) 1030 \let\MT@font@list\@empty

First we check whether \pickup@font is defined as expected. The warning issued by \CheckCommand* would be a bit too generic. 1031 \def\MT@pickupfont{\expandafter\ifx\font@name\relax\define@newfont\fi} 1032 \ifx\pickup@font\MT@pickupfont \else 1033 \MT@warning@nl{% 1034 Command \string\pickup@font\space is not defined as expected.\MessageBreak 1035 Double-check whether micro-typography is indeed\MessageBreak 1036 applied to the document.\MessageBreak (Hint: Turn on ‘verbose’ mode)% 1037 }% 1038 \fi

Then we append our stuff. 1039 \g@addto@macro\pickup@font{% 1040 \begingroup 1041 \escapechar\m@ne 1042 \expandafter\MT@in@llist\expandafter 1043 {\font@name}\MT@font@list 1044 \ifMT@inlist@ \else 1045 \MT@setupfont 1046 \xdef\MT@font@list{\MT@font@list\font@name,}% 1047 \fi 1048 \endgroup 1049 }

\MT@pickupfont

We also test whether our definition has survived (at least CJK redefines \pickup@font)10 . 1050 \let\MT@pickupfont\pickup@font 1051 \AtBeginDocument{% 1052 \ifx\MT@pickupfont\pickup@font \else 1053 \MT@error{% 1054 Another package has overwritten the definition\MessageBreak 1055 of \string\pickup@font. I might not be able to\MessageBreak

10 Can anybody say something about how microtype and CJK work together?

IMPLEMENTATION: Configuration

47

1056 apply any micro-typography. Please find the\MessageBreak 1057 culprit, and load it before the microtype package 1058 }{% 1059 The microtype package appends the micro-typographic setup to\MessageBreak 1060 \string\pickup@font. If the other package has simply overwritten this\MessageBreak 1061 command, nothing will work. If, on the other hand, it has changed\MessageBreak 1062 the command in a cautious way, everything may be fine.\MessageBreak 1063 In either case, please send a report to . 1064 }% 1065 \fi 1066 }

10.4 10.4.1 \DeclareMicroTypeSet \DeclareMicroTypeSet*

Configuration Font Sets

Calling this macro will create a list for every font characteristic of the form: \MThex|prilist@hcharacteristici@hset namei. If the optional argument is empty, lists for both expansion and protrusion will be created. The third argument must be a list of key=value pairs. If a font characteristic is not specified, we define the corresponding list to \relax, so that it does not constitute a constraint. The internal list will be of the form \MT@lt{hvar1i} \MT@lt{hvar2i} . . . , where \MT@lt acts as the delimiter between the list entries. 1067 \def\DeclareMicroTypeSet{% 1068 \@ifstar 1069 {\@ifnextchar[%] 1070 \MT@DeclareSetAndUseIt 1071 {\MT@DeclareSetAndUseIt[]}}% 1072 {\@ifnextchar[%] 1073 \MT@DeclareSet 1074 {\MT@DeclareSet[]}}% 1075 }

\MT@DeclareSet 1076 \def\MT@DeclareSet[#1]#2#3{% 1077 \MT@DeclareSet@{#1}{#2}{#3}% 1078 }

\MT@DeclareSetAndUseIt 1079 \def\MT@DeclareSetAndUseIt[#1]#2#3{% 1080 \MT@DeclareSet@{#1}{#2}{#3}% 1081 \UseMicroTypeSet[#1]{#2}% 1082 }

\MT@DeclareSet@ 1083 \def\MT@DeclareSet@#1#2#3{% 1084 \KV@@sp@def\@tempa{#1}% 1085 \MT@ifempty\@tempa{% 1086 \MT@declare@sets{pr}{#2}{#3}% 1087 \MT@declare@sets{ex}{#2}{#3}% 1088 }{%

IMPLEMENTATION: Configuration

1089 1090 1091 1092 }

\MT@tmp@setname

48

\expandafter\MT@declare@sets\expandafter {\csname MT@abbrx@\@tempa\endcsname}{#2}{#3}% }%

We need to remember the name of the set currently being declared. 1093 \let\MT@tmp@setname\@empty

\MT@declare@sets

Define the current set name and parse the keys. 1094 \def\MT@declare@sets#1#2#3{% 1095 \KV@@sp@def\MT@tmp@setname{#2}% 1096 \global\MT@let@nc{MT@#1list@@\MT@tmp@setname}\@empty 1097 hdebugi\MT@dinfo{0}{declaring \@nameuse{MT@abbr@#1} set ‘\MT@tmp@setname’}% 1098 \setkeys{MT#1@set}{#3}% 1099 }

\MT@define@set@keys

Define the keyval keys for expansion and protrusion sets. 1100 \def\MT@define@set@keys#1{% 1101 \MT@define@set@key{#1}{encoding}% 1102 \MT@define@set@key{#1}{family}% 1103 \MT@define@set@key{#1}{series}% 1104 \MT@define@set@key{#1}{shape}% 1105 \MT@define@set@key@size{#1}% 1106 }

\MT@define@set@key

h#1i = [ex|pr], h#2i = font axis, 1107 \def\MT@define@set@key#1#2{% 1108 \define@key{MT#1@set}{#2}[]{% 1109 \@for\MT@val:=##1\do{%

Get rid of spaces. 1110 \MT@remove@spaces{\MT@val}% 1111 \MT@get@highlevel{#2}% 1112 \MT@escapechar{\MT@val}% 1113 \MT@addto@list{#1}{#2}{\MT@val}% 1114 }% 1115 hdebugi\MT@dinfo@nl{0}{-- #2: \@nameuse{MT@#1list@#2@\MT@tmp@setname}}% 1116 }% 1117 }

\MT@escapechar

Make sure that the escape char is set to -1, and characters have category code 12, as in the original font name, so that the comparison doesn’t fail. 1118 \def\MT@escapechar#1{% 1119 \begingroup 1120 \escapechar\m@ne 1121 \xdef\MT@val{\expandafter\string\csname #1\endcsname}% 1122 \endgroup 1123 }

\MT@addto@list

Append the value h#3i to the expansion or protrusion (= h#1i) list for font axis h#2i. 1124 \def\MT@addto@list#1#2#3{% 1125 \expandafter\MT@xadd\csname MT@#1list@#2@\MT@tmp@setname\endcsname 1126 {\noexpand\MT@lt{#3}}% 1127 }

IMPLEMENTATION: Configuration

\MT@get@highlevel

49

Saying, for instance, ‘family=rm*’ or ‘shape=bf*’ will lead to \rmdefault resp. \bfdefault being expanded/protruded. 1128 \def\MT@get@highlevel#1{% 1129 \expandafter\MT@test@ast\MT@val*\@nil 1130 \if@tempswa

And ‘family = *’ will become \familydefault. \MT@ifempty\@tempa{\def\@tempa{#1}}\relax \def\MT@val{\csname \@tempa default\endcsname}%

1131 1132

Beware that \rmdefault etc. might change after this package has been loaded! Therefore, we check (once for each characteristic/list) at the beginning of the document. 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 }

\MT@test@ast

\ifx\@nodocument\relax \else \expandafter\ifx \csname MT@check@\MT@tmp@setname @\@tempa\endcsname\@empty \else \global\MT@edef@n{MT@\MT@tmp@setname @\@tempa @default}{\MT@val}% \edef\x{{\MT@tmp@setname}{\@tempa}}% \expandafter\AtBeginDocument\expandafter{% \expandafter\MT@check@default\x }% \global\MT@let@nc{MT@check@\MT@tmp@setname @\@tempa}\@empty \fi \fi \fi

Test whether last character is an asterisk. 1147 \def\MT@test@ast#1*#2\@nil{% 1148 \def\@tempa{#1}% 1149 \MT@ifempty{#2}% 1150 \@tempswafalse 1151 \@tempswatrue 1152 }

\MT@check@default 1153 \def\MT@check@default#1#2{% 1154 \MT@let@cn\@tempa{MT@#1@#2@default}% 1155 \edef\@tempb{\csname #2default\endcsname}% 1156 \ifx\@tempa\@tempb\else 1157 \MT@warning@nl{\expandafter\noexpand\csname #2default\endcsname 1158 has changed (‘\@tempa’ ‘\@tempb’)!\MessageBreak 1159 This might affect the ‘#1’ font set.\MessageBreak 1160 Please make all relevant font changes *before*\MessageBreak 1161 loading the ‘microtype’ package}% 1162 \fi 1163 }

\MT@define@set@key@size

size requires special treatment. 1164 \def\MT@define@set@key@size#1{% 1165 \define@key{MT#1@set}{size}[]{% 1166 \@for\MT@val:=##1\do{% 1167 \MT@remove@spaces{\MT@val}%

IMPLEMENTATION: Configuration

50

1168 \expandafter\MT@get@range\MT@val--\@nil 1169 \ifx\MT@val\relax \else 1170 \expandafter\MT@xadd\csname MT@#1list@size@\MT@tmp@setname\endcsname 1171 {\noexpand\MT@range{\MT@lower}{\MT@upper}\relax}% 1172 \fi 1173 }% 1174 hdebugi\MT@dinfo@nl{0}{-- size: \@nameuse{MT@#1list@size@\MT@tmp@setname}}% 1175 }% 1176 }

Font sizes may also be specified as ranges. This has been requested by Andreas Bühmann, who has also offered valuable help in implementing this. Now, one may for instance set up different lists for fonts with optical sizes. (The MinionPro project is trying this for the OpenType version of Adobe’s Minion. See http://developer.berlios.de/projects/minionpro/.) Ranges are stored as \MT@range{hlower boundi}{hupper boundi}{hlist namei}. \MT@get@range For simple sizes, the upper boundary is -1. \MT@range

1177 \let\MT@range\relax 1178 \def\MT@get@range#1-#2-#3\@nil{% 1179 \MT@ifempty{#1}{% 1180 \MT@ifempty{#2}{% 1181 \let\MT@val\relax 1182 }{% 1183 \def\MT@lower{0}% 1184 \def\MT@val{#2}% 1185 \MT@get@size 1186 \edef\MT@upper{\MT@val}% 1187 }% 1188 }{% 1189 \def\MT@val{#1}% 1190 \MT@get@size 1191 \ifx\MT@val\relax \else 1192 \edef\MT@lower{\MT@val}% 1193 \MT@ifempty{#2}{% 1194 \MT@ifempty{#3}{% 1195 \def\MT@upper{-1}% 1196 }{% 1197 \def\MT@upper{2048}% 1198 }% 1199 }{% 1200 \def\MT@val{#2}% 1201 \MT@get@size 1202 \MT@ifgt\MT@lower\MT@val{% 1203 \MT@warning@nl{% 1204 Invalid size range (\MT@lower\space > \MT@val) in font set 1205 ‘\MT@tmp@setname’.\MessageBreak Swapping sizes}% 1206 \edef\MT@upper{\MT@lower}% 1207 \edef\MT@lower{\MT@val}% 1208 }{% 1209 \edef\MT@upper{\MT@val}% 1210 }% 1211 \MT@ifeq\MT@lower\MT@upper{%

IMPLEMENTATION: Configuration

1212 1213 1214 1215 1216 1217 }

\MT@get@size

51

\def\MT@upper{-1}% }\relax }% \fi }%

If it’s not specified as a dimension, we tackle the size selection command here. 1218 \def\MT@get@size{% 1219 \let\@tempa\relax

A single star means \sizedefault, which doesn’t exist, so we define it to be \normalsize. 1220 1221 1222 1223 1224 1225

\if*\MT@val\relax \def\@tempa{\normalsize}% \else \MT@let@cn\@tempa{\MT@val}% \fi \ifx\@tempa\relax\else

The relsize solution of parsing \@setfontsize does not work with the AMS classes, among others. I hope my hijacking doesn’t do any harm. We redefine \set@fontsize, and not \@setfontsize because some classes might define the size selection commands by simply using \fontsize (e. g. the a0poster class). 1226 1227 1228 1229 1230

\begingroup \def\set@fontsize##1##2##3##4\@nil{\gdef\MT@val{##2}}% \@tempa\@nil \endgroup \fi

Test whether we finally got a number or dimension so that we can strip the ‘pt’ (\@defaultunits and \strip@pt are kernel macros). 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 }

\setbox\z@=\hbox{\MT@count=1\MT@val\relax \ifnum\MT@count=\@ne \@tempswafalse \else \@tempswatrue \fi\expandafter}% \if@tempswa \@defaultunits\@tempdima\MT@val pt\relax\@nnil \edef\MT@val{\strip@pt\@tempdima}% \else \MT@warning{Could not parse font size ‘\MT@val’\MessageBreak in font set ‘\MT@tmp@setname’}% \let\MT@val\relax \fi

We have finally assembled all pieces to define \DeclareMicroTypeSet’s keys. 1246 \MT@define@set@keys{pr}

IMPLEMENTATION: Configuration

52

1247 \MT@define@set@keys{ex}

\UseMicroTypeSet

To use a particular set we simply redefine MT@hex|pri@setname. If the optional argument is empty, both \MT@ex@setname and \MT@pr@setname will be redefined. 1248 \renewcommand{\UseMicroTypeSet}[2][]{% 1249 \KV@@sp@def\@tempa{#1}% 1250 \MT@ifempty\@tempa{% 1251 \MT@use@set{pr}{#2}% 1252 \MT@use@set{ex}{#2}% 1253 }{% 1254 \expandafter\MT@use@set\expandafter 1255 {\csname MT@abbrx@\@tempa\endcsname}{#2}% 1256 }% 1257 }

\MT@use@set

Only use sets that have been declared. 1258 \def\MT@use@set#1#2{% 1259 \KV@@sp@def{\@tempa}{#2}% 1260 \MT@ifdefined@n{MT@#1list@@\@tempa}{% 1261 \global\MT@edef@n{MT@#1@setname}{\@tempa}% 1262 \MT@info{Using \@nameuse{MT@abbr@#1} set ‘\@tempa’}% 1263 }{% 1264 \MT@ifdefined@n{MT@#1@setname}\relax{% 1265 \global\MT@def@n{MT@#1@setname}{alltext}% 1266 }% 1267 \MT@warning{% 1268 The \@nameuse{MT@abbr@#1} set ‘\@tempa’ is undeclared.\MessageBreak 1269 Using set ‘\@nameuse{MT@#1@setname}’ instead}% 1270 }% 1271 }

\DeclareMicroTypeAlias

This can be used to set an alias name for a font, so that the file (and the settings) for the aliased font will be loaded. 1272 \renewcommand{\DeclareMicroTypeAlias}[2]{% 1273 \KV@@sp@def\@tempa{#1}% 1274 \KV@@sp@def\@tempb{#2}% 1275 \global\MT@edef@n{MT@\@tempa @alias}{\@tempb}%

If we encounter this command while a font is being set up, we also set the alias for the current font so that if \DeclareMicroTypeAlias has been issued in a configuration file, the configuration file for the alias font will be loaded, too. 1276 1277 1278 1279 }

\LoadMicroTypeFile

\MT@ifdefined@c\MT@family{% \global\let\MT@familyalias\@tempb }\relax

May be used to load a configuration file manually. 1280 \def\LoadMicroTypeFile#1{% 1281 \expandafter\MT@in@llist\expandafter 1282 {\csname MT@file@#1\endcsname}\MT@file@list 1283 \ifMT@inlist@

IMPLEMENTATION: Configuration

53

1284 \MT@vinfo{... Configuration file mt-#1.cfg already loaded}% 1285 \else 1286 \MT@begin@catcodes 1287 \MT@xadd\MT@file@list{\csname MT@file@#1\endcsname,}% 1288 \InputIfFileExists{mt-#1.cfg}{% 1289 \MT@vinfo{... Loading configuration file mt-#1.cfg}% 1290 }{% 1291 \MT@warning{... Configuration file mt-#1.cfg\MessageBreak 1292 does not exist}% 1293 }% 1294 \MT@end@catcodes 1295 \fi 1296 } 1297 h/packagei

10.4.2

Declarations

We now set up some default sets (in the main configuration file). 1298 h*config&m-ti 1299 1300 %%% ---------------------------------------------------------------------1301 %%% FONT SETS 1302 1303 \DeclareMicroTypeSet{all} 1304 {} 1305 1306 \DeclareMicroTypeSet{allmath} 1307 { encoding = {T1,OT1,LY1,TS1,OML,OMS} } 1308 1309 \DeclareMicroTypeSet{alltext} 1310 { encoding = {T1,OT1,LY1,TS1} } 1311 1312 \DeclareMicroTypeSet{basicmath} 1313 { encoding = {T1,OT1,LY1,OML,OMS}, 1314 family = {rm*,sf*}, 1315 series = {m}, 1316 size = {normalsize,footnotesize,small,large} 1317 } 1318 1319 \DeclareMicroTypeSet{basictext} 1320 { encoding = {T1,OT1,LY1}, 1321 family = {rm*,sf*}, 1322 series = {m}, 1323 size = {normalsize,footnotesize,small,large} 1324 } 1325 1326 \DeclareMicroTypeSet{normalfont} 1327 { encoding = *, 1328 family = *, 1329 series = *, 1330 shape = *, 1331 size = * 1332 }

IMPLEMENTATION: Configuration

54

1333

The Latin Modern fonts, the virtual fonts from the ae and zefonts, and the eco and hfoldsty packages (oldstyle numerals) all inherit the (basic) settings from Computer Modern Roman. 1334 %%% ---------------------------------------------------------------------1335 %%% FONT ALIASES 1336 1337 \DeclareMicroTypeAlias{lmr} {cmr} 1338 \DeclareMicroTypeAlias{aer} {cmr} 1339 \DeclareMicroTypeAlias{zer} {cmr} 1340 \DeclareMicroTypeAlias{cmor}{cmr} 1341 \DeclareMicroTypeAlias{hfor}{cmr} 1342 h/config&m-ti

10.4.3

Fine Tuning

The macros \SetExpansion and \SetProtrusion provide a similar interface for setting the character protrusion resp. expansion factors for a set of fonts. \SetProtrusion

This macro accepts three arguments: [options,] set of font characteristics and list of character protrusion factors. A new macro called \MT@pr@c@hnamei will be defined to be h#3i (i.e. the list of characters, not expanded). 1343 h*packagei 1344 \renewcommand{\SetProtrusion}[2][]{% 1345 \let\MT@pr@c@name\@undefined 1346 \let\MT@load\@undefined 1347 \let\MT@extra@factor\@undefined

Parse the optional first argument: 1348

\setkeys{MT@pr@c}{#1}%

If the user hasn’t specified a name, we will create one. 1349 \MT@get@codes@name{pr}% 1350 \MT@set@prot@opt 1351 hdebugi\MT@dinfo{0}{creating protrusion list ‘\MT@pr@c@name’}% 1352 \setkeys{MT@pr@c}{#2}%

\MT@permutelist

We have parsed the second argument, and can now define macros for all permutations of the font characteristics to point to \MT@pr@c@hnamei, . . . 1353 1354

\def\MT@permutelist{pr@c}% \MT@permute

. . . which we can now define to be h#3i. We want the catcodes to be correct even if this is called in the preamble. 1355 1356 1357 }

\MT@set@prot@list

\MT@begin@catcodes \MT@set@prot@list

Here, as elsewhere, we have to make the definitions global, since they will occur inside a group.

IMPLEMENTATION: Configuration

55

1358 \def\MT@set@prot@list#1{% 1359 \global\MT@def@n{MT@pr@c@\MT@pr@c@name}{#1}% 1360 \MT@end@catcodes 1361 }

\SetExpansion

\SetExpansion only differs in that it allows some extra options (stretch, shrink, step, auto). 1362 \renewcommand{\SetExpansion}[2][]{% 1363 \let\MT@ex@c@name\@undefined 1364 \let\MT@load\@undefined 1365 \let\MT@extra@factor\@undefined 1366 \let\MT@extra@stretch\@undefined 1367 \let\MT@extra@shrink\@undefined 1368 \let\MT@extra@step\@undefined 1369 \let\MT@extra@auto\@undefined 1370 \setkeys{MT@ex@c}{#1}% 1371 \MT@get@codes@name{ex}% 1372 \MT@set@exp@opt 1373 hdebugi\MT@dinfo{0}{creating expansion list ‘\MT@ex@c@name’}% 1374 \setkeys{MT@ex@c}{#2}% 1375 \def\MT@permutelist{ex@c}% 1376 \MT@permute 1377 \MT@begin@catcodes 1378 \MT@set@exp@list 1379 }

\MT@set@exp@list

Same story. 1380 \def\MT@set@exp@list#1{% 1381 \global\MT@def@n{MT@ex@c@\MT@ex@c@name}{#1}% 1382 \MT@end@catcodes 1383 }

\MT@get@codes@name

Simply use a roman number as the list name if the user didn’t bother creating one. 1384 \def\MT@get@codes@name#1{% 1385 \MT@ifdefined@n{MT@#1@c@name}{% 1386 \MT@ifdefined@n{MT@#1@c@\csname MT@#1@c@name\endcsname}{% 1387 \MT@warning{Redefining list ‘\@nameuse{MT@#1@c@name}’}% 1388 }\relax 1389 }{% 1390 \@tempcnta=\@ne 1391 \MT@loop 1392 \MT@ifdefined@n{MT@#1@c@#1-\romannumeral\@tempcnta}{% 1393 \advance \@tempcnta \@ne 1394 }{% 1395 \MT@edef@n{MT@#1@c@name}{#1-\romannumeral\@tempcnta}% 1396 \@tempcnta=\z@ 1397 }% 1398 \ifnum\@tempcnta > \z@ \MT@repeat 1399 }% 1400 \MT@let@cn\MT@tmp@setname{MT@#1@c@name}%

Now that we know the name, we can cater for any set to be loaded by this list.

56

IMPLEMENTATION: Configuration

1401 1402 1403 1404 }

\MT@set@prot@opt

\MT@ifdefined@c\MT@load{% \global\MT@let@nc{MT@#1@c@\MT@tmp@setname load}\MT@load }\relax

Only one extra option for protrusion: factor. 1405 \def\MT@set@prot@opt{% 1406 \MT@ifdefined@c\MT@extra@factor{% 1407 \global\MT@let@nc{MT@pr@c@\MT@pr@c@name @factor}\MT@extra@factor 1408 }\relax 1409 }

\MT@set@exp@opt

The extra options to \SetExpansion also have to be dealt with only after we know the name. 1410 \def\MT@set@exp@opt{% 1411 \MT@ifdefined@c\MT@extra@factor{% 1412 \global\MT@let@nc{MT@ex@c@\MT@ex@c@name 1413 }\relax 1414 \MT@ifdefined@c\MT@extra@stretch{% 1415 \global\MT@let@nc{MT@ex@c@\MT@ex@c@name 1416 }\relax 1417 \MT@ifdefined@c\MT@extra@shrink{% 1418 \global\MT@let@nc{MT@ex@c@\MT@ex@c@name 1419 }\relax 1420 \MT@ifdefined@c\MT@extra@step{% 1421 \global\MT@let@nc{MT@ex@c@\MT@ex@c@name 1422 }\relax 1423 \MT@ifdefined@c\MT@extra@auto{% 1424 \global\MT@let@nc{MT@ex@c@\MT@ex@c@name 1425 }\relax 1426 }

\MT@define@code@key

@factor}\MT@extra@factor

@stretch}\MT@extra@stretch

@shrink}\MT@extra@shrink

@step}\MT@extra@step

@auto}\MT@extra@auto

Define the keys for expansion and protrusion character code lists. 1427 \def\MT@define@code@key#1#2{% 1428 \define@key{MT@#1}{#2}[]{% 1429 \@tempcnta=\@ne 1430 \@for\MT@val:=##1\do{% 1431 \MT@remove@spaces{\MT@val}%

Here, too, we allow for something like ‘bf*’. It will be expanded immediately. 1432 1433 1434 1435 1436 1437 }

\MT@get@highlevel{#2}% \MT@edef@n{MT@temp#2\romannumeral\@tempcnta}{\MT@val}% \advance\@tempcnta \@ne }% }%

\MT@define@code@key@size 1438 \def\MT@define@code@key@size#1{% 1439 \define@key{MT@#1}{size}[]{% 1440 \@for\MT@val:=##1\do{% 1441 \MT@remove@spaces{\MT@val}% 1442 \expandafter\MT@get@range\MT@val--\@nil

IMPLEMENTATION: Configuration

1443 1444 1445 1446 1447 1448 1449 1450 1451 }

\ifx\MT@val\relax \else \expandafter\MT@xadd \csname MT@tempsize\endcsname {\noexpand\MT@range{\MT@lower}{\MT@upper}% {\csname MT@#1@name\endcsname}}% \fi }% }%

\MT@declare@codes 1452 \def\MT@declare@codes#1{% 1453 \define@key{MT@#1@c}{name}[]{% 1454 \MT@ifempty{##1}\relax{% 1455 \MT@def@n{MT@#1@c@name}{##1}% 1456 }% 1457 }% 1458 \define@key{MT@#1@c}{load}[]{% 1459 \MT@ifempty{##1}\relax{% 1460 \def\MT@load{##1}% 1461 }% 1462 }% 1463 \define@key{MT@#1@c}{factor}[]{% 1464 \MT@ifempty{##1}\relax{% 1465 \def\MT@extra@factor{##1 }% 1466 }% 1467 }% 1468 \MT@define@code@key{#1@c}{encoding}% 1469 \MT@define@code@key{#1@c}{family}% 1470 \MT@define@code@key{#1@c}{series}% 1471 \MT@define@code@key{#1@c}{shape}% 1472 \MT@define@code@key@size{#1@c}% 1473 } 1474 \MT@declare@codes{pr} 1475 \MT@declare@codes{ex}

\MT@define@expcodes@key

The first argument to \SetExpansion accepts some more options. 1476 \def\MT@define@expcodes@key#1{% 1477 \define@key{MT@ex@c}{#1}[]{% 1478 \MT@ifempty{##1}\relax{%

A space terminates the number. 1479 1480 1481 1482 }

\MT@def@n{MT@extra@#1}{##1 }% }% }%

1483 \MT@define@expcodes@key{stretch} 1484 \MT@define@expcodes@key{shrink} 1485 \MT@define@expcodes@key{step} 1486 \define@key{MT@ex@c}{auto}[]{% 1487 \MT@ifempty{#1}% 1488 {\def\@tempb{true}}% 1489 {\KV@@sp@def\@tempb{#1}}%

57

IMPLEMENTATION: Configuration

1490

58

\csname if\@tempb\endcsname

Don’t alter \MT@extra@auto for pdfTEX version older than 1.20. 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 }

\ifnum\MT@pdftex@no=4\relax \def\MT@extra@auto{autoexpand}% \else \MT@warning{% pdfTeX too old for automatic font expansion. Cannot\MessageBreak enable it in font set ‘\MT@ex@c@name’}% \fi \else \ifnum\MT@pdftex@no=4\relax \let\MT@extra@auto\@empty \fi \fi

10.4.4 \DeclareCharacterInheritance

Character Inheritance

This macro may be used in the configuration files to declare characters that should inherit protrusion resp. expansion values from other characters. Thus, there is no need to define all accented characters (e. g. \‘a, \’a, \^a, \~a, \"a, \r{a}, \k{a}, \u{a}), which will make the configuration files look much nicer and easier to maintain. If a single character of an inheritance list should have a different value, one can simply override it. 1504 \renewcommand{\DeclareCharacterInheritance}[2][]{% 1505 \MT@begin@catcodes 1506 \MT@set@inh@list{#1}{#2}% 1507 }

\MT@set@inh@list

Safe category codes in the third argument. 1508 \def\MT@set@inh@list#1#2#3{% 1509 \KV@@sp@def\@tempa{#1}% 1510 \MT@ifempty\@tempa{% 1511 \MT@declare@char@inh{pr}{#2}{#3}% 1512 \MT@declare@char@inh{ex}{#2}{#3}% 1513 }{% 1514 \expandafter\MT@declare@char@inh\expandafter 1515 {\csname MT@abbrx@\@tempa\endcsname}{#2}{#3}% 1516 }% 1517 \MT@end@catcodes 1518 }

\MT@declare@char@inh

The optional argument may be used to restrict the inheritance list to protrusion or expansion. 1519 \def\MT@declare@char@inh#1#2#3{% 1520 \MT@let@nc{MT@#1@inh@name}\@undefined 1521 \MT@get@inh@name{#1}% 1522 hdebugi\MT@dinfo{0}{creating inheritance list ‘\@nameuse{MT@#1@inh@name}’}% 1523 \global\MT@def@n{MT@#1@inh@\csname MT@#1@inh@name\endcsname}{#3}% 1524 \setkeys{MT@#1@inh}{#2}% 1525 \def\MT@permutelist{#1@inh}%

IMPLEMENTATION: Configuration

1526 1527 }

\MT@get@inh@name

59

\MT@permute

The inheritance lists cannot be named by the user. 1528 \def\MT@get@inh@name#1{% 1529 \@tempcnta=\@ne 1530 \MT@loop 1531 \MT@ifdefined@n{MT@#1@inh@#1-inh-\romannumeral\@tempcnta}{% 1532 \advance \@tempcnta \@ne 1533 }{% 1534 \MT@edef@n{MT@#1@inh@name}{#1-inh-\romannumeral\@tempcnta}% 1535 \@tempcnta=\z@ 1536 }% 1537 \ifnum\@tempcnta > \z@ \MT@repeat 1538 }

\MT@define@inh@key@encoding

Parse the first argument. \DeclareCharacterInheritance may also be set up for various combinations. 1539 \def\MT@define@inh@key@encoding#1{% 1540 \define@key{MT@#1}{encoding}[]{% 1541 \def\MT@val{##1}% 1542 \expandafter\MT@encoding@check\MT@val,\@nil 1543 \MT@get@highlevel{encoding}% 1544 \MT@edef@n{MT@tempencoding\romannumeral1}{\MT@val}% 1545 }% 1546 }

\MT@encoding@check

But we only allow one encoding. 1547 \def\MT@encoding@check#1,#2\@nil{% 1548 \MT@ifempty{#2}\relax{% 1549 \edef\MT@val{#1}% 1550 \MT@warning{You may only specify one encoding for character\MessageBreak 1551 inheritance lists. Ignoring encoding #2}% 1552 }% 1553 }

\MT@define@inh@keys 1554 \def\MT@define@inh@keys#1{% 1555 \MT@define@inh@key@encoding{#1@inh}%

For the rest, we can reuse the key setup from \SetProtrusion resp. \SetExpansion. 1556 \MT@define@code@key{#1@inh}{family}% 1557 \MT@define@code@key{#1@inh}{series}% 1558 \MT@define@code@key{#1@inh}{shape}% 1559 \MT@define@code@key@size{#1@inh}% 1560 } 1561 \MT@define@inh@keys{pr} 1562 \MT@define@inh@keys{ex}

\MT@inh@do

Parse the second argument, the inheritance lists. We define the commands \MT@inh@hnamei@hsloti@, containing the inheriting characters. They will also be translated to slot numbers here, to save some time. The following will be executed only once, namely the first time this inheritance list is

IMPLEMENTATION: Configuration

60

encountered (in \MT@set@prot@codes resp. \MT@set@exp@codes). 1563 \def\MT@inh@do#1,{% 1564 \ifx\relax#1\@empty\else 1565 \MT@inh@split #1==\relax 1566 \expandafter\MT@inh@do\fi 1567 }

\MT@inh@split

At the right time (viz. in MT@set@hexp|proti@codes), \MT@lt will be redefined to set the codes for the inheriting characters gathered here. 1568 \def\MT@inh@split#1=#2=#3\relax{% 1569 \def\@tempa{#1}% 1570 \ifx\@tempa\@empty\else 1571 \MT@get@slot 1572 \ifnum\MT@char > \m@ne 1573 \let\MT@val\MT@char 1574 \def\@tempb{#2}% 1575 \@for\@tempa:=\@tempb\do{% 1576 \ifx\@tempa\@empty\else 1577 \MT@get@slot 1578 \ifnum\MT@char > \m@ne 1579 \expandafter\MT@xadd 1580 \csname MT@inh@\MT@inh@name @\MT@val @\endcsname 1581 {\noexpand\MT@lt{\MT@char}}% 1582 \fi 1583 \fi 1584 }% 1585 hdebugi\let\MT@lt\@empty 1586 hdebugi\MT@dinfo@nl{1}{children of #1 (\MT@val): 1587 hdebugi \@nameuse{MT@inh@\MT@inh@name @\MT@val @}}% 1588 \fi 1589 \fi 1590 }

10.4.5 \MT@permute \MT@permute@ \MT@permute@@ \MT@permute@@@ \MT@permute@@@@ \MT@permute@@@@@

Permutation

Calling \MT@permute will define commands for all permutations of specified font characteristics of the form \MT@hlist typei@/hencodingi/hfamilyi/ hseriesi/hshapei/h|*i to be the expansion of \MT@hlist typei@name, i. e. the name of the currently defined list. Size ranges are held in a separate macro called \MT@hlist typei@/hfont axesi@sizes, which in turn contains the respective hlist nameis attached to the ranges. 1591 \def\MT@permute{% 1592 \let\MT@cnt@encoding\@ne 1593 \MT@permute@

Undefine commands for the next round. 1594 \MT@permute@reset 1595 } 1596 \def\MT@permute@{% 1597 \let\MT@cnt@family\@ne 1598 \MT@permute@@

IMPLEMENTATION: Configuration

61

1599 \MT@increment\MT@cnt@encoding 1600 \MT@ifdefined@n{MT@tempencoding\romannumeral\MT@cnt@encoding}% 1601 \MT@permute@ 1602 \relax 1603 } 1604 \def\MT@permute@@{% 1605 \let\MT@cnt@series\@ne 1606 \MT@permute@@@ 1607 \MT@increment\MT@cnt@family 1608 \MT@ifdefined@n{MT@tempfamily\romannumeral\MT@cnt@family}% 1609 \MT@permute@@ 1610 \relax 1611 } 1612 \def\MT@permute@@@{% 1613 \let\MT@cnt@shape\@ne 1614 \MT@permute@@@@ 1615 \MT@increment\MT@cnt@series 1616 \MT@ifdefined@n{MT@tempseries\romannumeral\MT@cnt@series}% 1617 \MT@permute@@@ 1618 \relax 1619 } 1620 \def\MT@permute@@@@{% 1621 \MT@permute@@@@@ 1622 \MT@increment\MT@cnt@shape 1623 \MT@ifdefined@n{MT@tempshape\romannumeral\MT@cnt@shape}% 1624 \MT@permute@@@@ 1625 \relax 1626 } 1627 \def\MT@permute@@@@@{% 1628 \MT@permute@define{encoding}% 1629 \MT@permute@define{family}% 1630 \MT@permute@define{series}% 1631 \MT@permute@define{shape}% 1632 \edef\@tempa{\MT@tempencoding/% 1633 \MT@tempfamily/% 1634 \MT@tempseries/% 1635 \MT@tempshape/% 1636 \MT@ifdefined@c\MT@tempsize *\@empty}%

Some sanity checks: an encoding must be specified (unless nothing else is); only one list should apply to a given combination. 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649

\def\@tempb{////}% \ifx\@tempa\@tempb\else \ifx\MT@tempencoding\@empty \MT@warning{You have to specify an encoding for \@nameuse{MT@abbr@\MT@permutelist} list\MessageBreak ‘\@nameuse{MT@\MT@permutelist @name}’. Ignoring it}% \else \ifx\MT@tempsize\@undefined \MT@ifdefined@n{MT@\MT@permutelist @\@tempa}{% \MT@warning{\@nameuse{MT@abbr@\MT@permutelist} list ‘\@nameuse{MT@\MT@permutelist @name}’ will override list\MessageBreak ‘\@nameuse{MT@\MT@permutelist @\@tempa}’ for font ‘\@tempa’}% }\relax

IMPLEMENTATION: Configuration

62

1650 hdebugi\MT@dinfo@nl{0}{initializing: use list for font \@tempa}% 1651 \else

Append the list of ranges to the current combination, after checking for any conflicts. 1652 \expandafter\MT@check@rlist\expandafter 1653 {MT@\MT@permutelist @\@tempa @sizes}\MT@tempsize 1654 \expandafter\MT@xadd 1655 \csname MT@\MT@permutelist @\@tempa @sizes\endcsname 1656 \MT@tempsize 1657 hdebugi\MT@dinfo@nl{0}{initializing: use list for font \@tempa,\MessageBreak 1658 hdebugi sizes: \csname MT@\MT@permutelist @\@tempa @sizes\endcsname}% 1659 \fi 1660 \global\MT@edef@n{MT@\MT@permutelist @\@tempa}% 1661 {\csname MT@\MT@permutelist @name\endcsname}% 1662 \fi 1663 \fi 1664 }

\MT@permute@define

Define and reset the commands. 1665 \def\MT@permute@define#1{% 1666 \expandafter\@tempcnta=\csname MT@cnt@#1\endcsname\relax 1667 \MT@ifdefined@n{MT@temp#1\romannumeral\@tempcnta}{% 1668 \MT@edef@n{MT@temp#1}{\csname MT@temp#1\romannumeral\@tempcnta\endcsname}% 1669 }{% 1670 \MT@let@nc{MT@temp#1}\@empty 1671 }% 1672 }

\MT@permute@reset 1673 \def\MT@permute@reset{% 1674 \MT@permute@reset@{encoding}% 1675 \MT@permute@reset@{family}% 1676 \MT@permute@reset@{series}% 1677 \MT@permute@reset@{shape}% 1678 \let\MT@tempsize\@undefined 1679 }

\MT@permute@reset@ 1680 \def\MT@permute@reset@#1{% 1681 \@tempcnta=\@ne 1682 \MT@loop 1683 \MT@let@nc{MT@temp#1\romannumeral\@tempcnta}\@undefined 1684 \advance\@tempcnta\@ne 1685 \MT@ifdefined@n{MT@temp#1\romannumeral\@tempcnta}% 1686 \@tempswatrue 1687 \@tempswafalse 1688 \if@tempswa \MT@repeat 1689 }

\MT@check@rlist

For every range item in h#2i, test whether it overlaps with items in list h#1i. 1690 \def\MT@check@rlist#1#2{% 1691 \MT@ifdefined@n{#1}{%

IMPLEMENTATION: Configuration

1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 }

\MT@check@range

63

\begingroup \def\MT@range##1##2##3{% \def\@tempb{##1}% \def\@tempc{##2}% \MT@check@range{#1}% }% #2% \endgroup }\relax

Recurse through the list of existing ranges. 1702 \def\MT@check@range#1{% 1703 \expandafter\expandafter\expandafter\MT@check@range@ 1704 \csname #1\endcsname\relax\@nil 1705 }

\MT@check@range@

\@tempb and \@tempc are lower resp. upper bound of the new item, h#2i and h#3i those of the existing item. 1706 \def\MT@check@range@#1#2#3#4#5\@nil{% 1707 \@tempswafalse 1708 \MT@ifeq{#3}\m@ne{% 1709 \MT@ifeq\@tempc\m@ne{%

Both items are simple sizes. \MT@ifeq\@tempb{#2}\@tempswatrue\relax

1710 1711

}{%

Item in list is a simple size, new item is a range. 1712 1713 1714 1715 1716 1717 1718 1719 1720

\MT@ifgt\@tempb{#2}\relax{% \MT@ifgt\@tempc{#2}{% \@tempswatrue \edef\@tempb{#2 (with range: \@tempb\space to \@tempc)}% }\relax }% }% }{% \MT@ifeq\@tempc\m@ne{%

Item in list is a range, new item is a simple size. 1721 1722 1723 1724

\MT@iflt\@tempb{#3}{% \MT@iflt\@tempb{#2}\relax\@tempswatrue }\relax }{%

Both items are ranges. 1725 1726 1727 1728 1729 1730 1731 1732 1733

\MT@iflt\@tempb{#3}{% \MT@ifgt\@tempc{#2}{% \@tempswatrue \edef\@tempb{#2 to #3 (with range: \@tempb\space to \@tempc)}% }\relax }\relax }% }% \if@tempswa

IMPLEMENTATION: User Command

1734 1735 1736 1737

64

\MT@warning{\@nameuse{MT@abbr@\MT@permutelist} list ‘\@nameuse{MT@\MT@permutelist @name}’ will override\MessageBreak list ‘#4’ for font \@tempa,\MessageBreak size \@tempb}% \else

If we’ve already found a conflict with this item, we can skip the rest of the list, otherwise we call this macro again. 1738 1739 1740 1741 1742 }

10.5 \microtypesetup \MT@define@optionX

\ifx#5\relax\else \MT@check@range@#5\@nil \fi \fi

User Command

This command may be used anywhere in the document. It accepts the options: protrusion, expansion and activate. Specifying font sets is not allowed. 1743 \def\microtypesetup{\setkeys{MTX}} 1744 \def\MT@define@optionX#1{% 1745 \define@key{MTX}{#1}[true]{% 1746 \KV@@sp@def\@tempb{#1}% 1747 \@for\MT@val:=##1\do{% 1748 \MT@remove@spaces{\MT@val}% 1749 \edef\@tempb{\csname MT@abbrx@\@tempb\endcsname}% 1750 \MT@ifempty\MT@val\relax{% 1751 \@tempcnta=\m@ne 1752 \def\@tempa{false}% 1753 \ifx\MT@val\@tempa 1754 \@tempcnta=\z@ 1755 \MT@info{Disabling #1}% 1756 \let\MT@val\relax 1757 \fi

Enabling micro-typography in the middle of the document is not allowed if it has been disabled in the package options since fonts might already have been loaded and hence wouldn’t be set up. 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772

\def\@tempa{true}% \ifx\MT@val\@tempa \MT@checksetup{\@tempb}% \if@tempswa \expandafter\@tempcnta=\csname MT@\@tempb @level\endcsname\relax \MT@info{Enabling #1\space (level \number\csname MT@\@tempb @level\endcsname)}% \let\MT@val\relax \fi \fi \def\@tempa{compatibility}% \ifx\MT@val\@tempa \MT@checksetup{\@tempb}% \if@tempswa \@tempcnta=\@ne

IMPLEMENTATION: User Command

1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 }

65

\MT@let@nc{MT@\@tempb @level}\@ne \MT@info{Setting #1\space to level 1}% \let\MT@val\relax \fi \fi \def\@tempa{nocompatibility}% \ifx\MT@val\@tempa \MT@checksetup{\@tempb}% \if@tempswa \@tempcnta=\tw@ \MT@let@nc{MT@\@tempb @level}\tw@ \MT@info{Setting #1\space to level 2}% \let\MT@val\relax \fi \fi \ifx\MT@val\relax\else \MT@warning{% Value ‘\MT@val’ for key ‘#1’ not recognized.\MessageBreak Use any of ‘true’, ‘false’, ‘compatibility’ or\MessageBreak ‘nocompatibility’}% \fi \ifnum\@tempcnta>\m@ne \def\@tempa{ex}% \ifx\@tempa\@tempb \pdfadjustspacing\@tempcnta \else \pdfprotrudechars\@tempcnta \fi \fi }% }% }%

\MT@checksetup 1806 \def\MT@checksetup#1{% 1807 \expandafter\csname ifMT@\csname MT@abbr@#1\endcsname\endcsname 1808 \@tempswatrue 1809 \else 1810 \MT@warning{% 1811 You cannot enable \@nameuse{MT@abbr@#1} if it was disabled\MessageBreak 1812 in the package options,}% 1813 \let\MT@val\relax 1814 \@tempswafalse 1815 \fi 1816 } 1817 \MT@define@optionX{protrusion} 1818 \MT@define@optionX{expansion} 1819 \define@key{MTX}{activate}[]{% 1820 \setkeys{MTX}{protrusion={#1}}% 1821 \setkeys{MTX}{expansion={#1}}% 1822 }

IMPLEMENTATION: Package Options

66

Disable everything – may be used as a work-around in case setting up fonts doesn’t work in certain environments. (Undocumented.) 1823 \def\MT@gobblethree#1#2#3{} 1824 \let\MT@saved@setupfont\MT@setupfont 1825 \define@key{MTX}{disable}[]{% 1826 \MT@info{Inactivate microtype package}% 1827 \let\MT@setupfont\MT@gobblethree 1828 } 1829 \define@key{MTX}{enable}[]{% 1830 \MT@info{Reactivate microtype package}% 1831 \let\MT@setupfont\MT@saved@setupfont 1832 }

10.6 \ifMT@opt@protrusion

Package Options

Keep track of whether the user explicitly set these options.

\ifMT@opt@expansion 1833 \newif\ifMT@opt@protrusion \ifMT@opt@auto 1834 \newif\ifMT@opt@expansion 1835 \newif\ifMT@opt@auto \MT@define@option

expansion and protrusion may be true, false, compatibility, nocompatibility and/or a hset namei. 1836 \def\MT@define@option#1{% 1837 \define@key{MT}{#1}[true]{% 1838 \csname MT@opt@#1true\endcsname 1839 \@for\MT@val:=##1\do{% 1840 \MT@remove@spaces{\MT@val}% 1841 \edef\@tempb{\csname MT@abbrx@#1\endcsname}% 1842 \MT@ifempty\MT@val\relax{% 1843 \csname MT@#1true\endcsname 1844 \def\@tempa{false}% 1845 \ifx\MT@val\@tempa 1846 \csname MT@#1false\endcsname 1847 \let\MT@val\relax 1848 \fi 1849 \def\@tempa{compatibility}% 1850 \ifx\MT@val\@tempa 1851 \MT@let@nc{MT@\@tempb @level}\@ne 1852 \let\MT@val\relax 1853 \fi 1854 \def\@tempa{nocompatibility}% 1855 \ifx\MT@val\@tempa 1856 \MT@let@nc{MT@\@tempb @level}\tw@ 1857 \let\MT@val\relax 1858 \fi 1859 \ifx\MT@val\relax\else 1860 \def\@tempa{true}% 1861 \ifx\MT@val\@tempa 1862 \else

If everything failed, it must be a set name. 1863

\MT@ifdefined@n{MT@\@tempb list@@\MT@val}{%

IMPLEMENTATION: Package Options

1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 }

67

\global\MT@edef@n{MT@\@tempb @setname}{\MT@val}% \MT@info@nl{Using #1 set ‘\MT@val’}% }{% \global\MT@def@n{MT@\@tempb @setname}{alltext}% \MT@warning@nl{% The #1 set ‘\MT@val’ is undeclared.\MessageBreak Using set ‘\@nameuse{MT@\@tempb @setname}’ instead}% }% \fi \fi }% }% }%

1878 \MT@define@option{protrusion} 1879 \MT@define@option{expansion}

activate is a shortcut. 1880 \define@key{MT}{activate}[]{% 1881 \setkeys{MT}{protrusion={#1}}% 1882 \setkeys{MT}{expansion={#1}}% 1883 }

\MT@def@bool@opt

The true/false options: DVIoutput, draft (may be inherited from the class options), auto, selected. 1884 \def\MT@def@bool@opt#1{% 1885 \define@key{MT}{#1}[true]{% 1886 \def\@tempa{##1}% 1887 \def\@tempb{true}% 1888 \ifx\@tempa\@tempb \else 1889 \def\@tempb{false}% 1890 \ifx\@tempa\@tempb \else 1891 \MT@warning@nl{% 1892 Unrecognized value for option ‘#1’.\MessageBreak 1893 Assuming ‘false’}% 1894 \fi 1895 \fi 1896 \csname MT@#1\@tempb\endcsname 1897 }% 1898 } 1899 \@tfor\MT@val:={DVIoutput}{draft}{auto}{selected}\do{% 1900 \expandafter\MT@def@bool@opt\expandafter{\MT@val} 1901 }

final is the opposite to draft. 1902 \define@key{MT}{final}[true]{% 1903 \MT@draftfalse 1904 \def\@tempa{#1}% 1905 \def\@tempb{true}% 1906 \ifx\@tempa\@tempb 1907 \else 1908 \def\@tempb{false}%

IMPLEMENTATION: Package Options

1909 1910 1911 1912 1913 1914 1915 1916 1917 }

\ifx\@tempa\@tempb \MT@drafttrue \else \MT@warning@nl{% Unrecognized value for option ‘final’.\MessageBreak Assuming ‘true’}% \fi \fi

For verbose output, we simply redefine \MT@vinfo. 1918 \define@key{MT}{verbose}[true]{% 1919 \let\MT@vinfo\MT@info@nl 1920 \def\@tempa{#1}% 1921 \def\@tempb{true}% 1922 \ifx\@tempa\@tempb 1923 \else

Take problems seriously. 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 }

\MT@def@num@opt

\def\@tempb{errors}% \ifx\@tempa\@tempb \let\MT@warning\MT@warn@err \let\MT@warning@nl\MT@warn@err \else \let\MT@vinfo\@gobble \def\@tempb{false}% \ifx\@tempa\@tempb \else \MT@warning@nl{% Unrecognized value for option ‘verbose’.\MessageBreak Assuming ‘false’}% \fi \fi \fi

Options with numerical keys: factor, stretch, shrink, step. 1939 \def\MT@def@num@opt#1{% 1940 \define@key{MT}{#1}[]{% 1941 \MT@ifempty{##1}% 1942 {\MT@let@cn\@tempa{MT@#1@default}}% 1943 {\def\@tempa{##1 }}%

No nonsense in \MT@factor et al.? A space terminates the number. 1944 1945 1946 1947 1948 1949 1950 1951 1952 }

\MT@ifnumber\@tempa{% \MT@edef@n{MT@#1}{\@tempa}% }{% \MT@warning@nl{% Value ‘##1’ for option ‘#1’ is not a number.\MessageBreak Using default value of \number\@nameuse{MT@#1@default}}% }% }%

1953 \@tfor\MT@val:={factor}{stretch}{shrink}{step}\do{% 1954 \expandafter\MT@def@num@opt\expandafter{\MT@val}%

68

IMPLEMENTATION: Package Options

69

1955 }

The package should just work if called without any options. Therefore, expansion will be switched off by default if output is DVI, since it isn’t likely that expanded fonts are available. (This grows more important as TEX systems are switching to the pdfTEX engine even for DVI output, so that the user might not even be aware of the fact that she’s running pdfTEX.) 1956 \MT@protrusiontrue 1957 \ifnum\pdfoutput=\z@\else

Also, we only enable expansion by default if pdfTEX can expand the fonts automatically. 1958 \ifnum\MT@pdftex@no=4\relax 1959 \MT@expansiontrue 1960 \MT@autotrue 1961 \fi 1962 \fi

Load the local configuration file before processing the package options. 1963 \MT@info@nl{Trying to load main configuration file ...} 1964 \IfFileExists{microtype.cfg}{% 1965 \MT@begin@catcodes 1966 \let\MT@begin@catcodes\relax 1967 \let\MT@end@catcodes\relax 1968 \input{microtype.cfg}% 1969 \endgroup 1970 \MT@info@nl{... main configuration file loaded successfully}% 1971 }{% 1972 \MT@warning@nl{% 1973 Could not find configuration file ‘microtype.cfg’!\MessageBreak 1974 This will almost certainly cause undesired results.\MessageBreak 1975 Please fix your installation}% 1976 }

\MicroType@Hook

This hook may be used by font package authors, e. g. to declare alias fonts. If it is defined, it will be executed here, i. e., after the main configuration file has been loaded, and before the package options are evaluated. This hook overcomes the situation that (1) the microtype package should be loaded after all font defaults have been set up (hence, using \@ifpackageloaded in the font package is not viable), and (2) checking \AtBeginDocument might be too late, since fonts might already have been loaded, and consequently set up, in the preamble. Package authors should check whether the command is already defined so that existing definitions by other packages aren’t overwritten. Example: \def\MinionPro@MT@Hook {\DeclareMicroTypeAlias{MinionPro-LF}{MinionPro}} \@ifundefined{MicroType@Hook} {\let\MicroType@Hook\MinionPro@MT@Hook} {\g@addto@macro\MicroType@Hook{\MinionPro@MT@Hook}} 1977 \MT@ifdefined@c\MicroType@Hook\MicroType@Hook\relax

IMPLEMENTATION: Package Options

\ProcessOptionsWithKV

70

Parse options. 1978 \def\ProcessOptionsWithKV#1{% 1979 \let\@tempc\relax 1980 \let\KVo@tempa\@empty 1981 \@for\CurrentOption:=\@classoptionslist\do{% 1982 \MT@ifdefined@n{KV@#1@\CurrentOption}{% 1983 \edef\KVo@tempa{\KVo@tempa,\CurrentOption,}% 1984 \@expandtwoargs\@removeelement\CurrentOption 1985 \@unusedoptionlist\@unusedoptionlist 1986 }\relax 1987 }% 1988 \edef\KVo@tempa{% 1989 \noexpand\setkeys{#1}{% 1990 \KVo@tempa\@ptionlist{\@currname.\@currext}% 1991 }% 1992 }% 1993 \KVo@tempa 1994 \AtEndOfPackage{\let\@unprocessedoptions\relax}% 1995 \let\CurrentOption\@empty 1996 } 1997 \ProcessOptionsWithKV{MT}

Now we can take the appropriate actions: pdfTEX can create DVI output, too. However, both the DVI viewer and dvips need to find actual fonts. Therefore, expansion will only work if the fonts for different degrees of expansion are readily available. Some packages depend on the value of \pdfoutput and will get confused if it is changed after they have been loaded. These packages are, among others: color, graphics, hyperref, crop, contour, pstricks and of course ifpdf. Instead of testing for each package (that’s not our job), we issue a different message if \pdfoutput is actually changed by DVIoutput. That must be sufficient! 1998 \ifMT@DVIoutput 1999 \ifnum\pdfoutput=\z@ 2000 \MT@info@nl{Generating DVI output} 2001 \else 2002 \pdfoutput\z@ 2003 \MT@info@nl{Changing output mode to DVI}

For DVI output, the user must have explicitly passed the expansion option to the package. 2004 \ifMT@opt@expansion\else 2005 \MT@expansionfalse 2006 \fi 2007 \fi 2008 \else 2009 \MT@info@nl{Generating \ifnum\pdfoutput=\z@ DVI \else PDF \fi output} 2010 \fi

Tell the log file which options the user has chosen (in case it’s interested). We disable most of what we’ve just defined in the 2010 lines above if we

IMPLEMENTATION: Package Options

71

are running in draft mode. 2011 \ifMT@draft 2012 \MT@warning@nl{‘draft’ option active.\MessageBreak 2013 Disabling all micro-typographic features} 2014 \MT@protrusionfalse 2015 \MT@expansionfalse 2016 \let\MT@setupfont\relax 2017 \let\microtypesetup\@gobble 2018 \renewcommand{\UseMicroTypeSet}[2][]{} 2019 \renewcommand{\SetProtrusion}[3][]{} 2020 \renewcommand{\SetExpansion}[3][]{} 2021 \else 2022 \ifMT@protrusion 2023 \MT@info@nl{% 2024 Character protrusion enabled (level \number\MT@pr@level)% 2025 \ifnum\MT@factor=\@m\else,\MessageBreak factor: \number\MT@factor\fi}

We have to make sure that font sets are defined at the end of the package. If the user didn’t activate any, we use the ‘alltext’ set for protrusion and the ‘basictext’ set for expansion. They can be overridden later on, of course. 2026 2027 2028 2029 2030 2031 2032 2033

\MT@ifdefined@n{MT@pr@setname}\relax{% \MT@info@nl{Using default protrusion set ‘alltext’}% \gdef\MT@pr@setname{alltext}% } \else \MT@info@nl{No character protrusion} \fi \ifMT@expansion

Set up the values for font expansion: If stretch has not been specified, we take the default value of 20. 2034 2035 2036

\ifnum\MT@stretch=\m@ne \let\MT@stretch\MT@stretch@default \fi

If shrink has not been specified, it will inherit the value from stretch. 2037 2038 2039 2040 2041 2042 2043

\ifnum\MT@shrink=\m@ne \ifnum\MT@stretch>\z@ \let\MT@shrink\MT@stretch \else \let\MT@shrink\MT@shrink@default \fi \fi

If step has not been specified, we will set it to min(stretch,shrink)/5, rounded off, minimum value 1. 2044 2045 2046 2047 2048 2049 2050

\ifnum\MT@step=\m@ne \ifnum\MT@stretch>\MT@shrink \ifnum\MT@shrink=\z@ \@tempcnta=\MT@stretch \else \@tempcnta=\MT@shrink \fi

IMPLEMENTATION: Package Options

2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063

\MT@auto

72

\else \ifnum\MT@stretch=\z@ \@tempcnta=\MT@shrink \else \@tempcnta=\MT@stretch \fi \fi \divide\@tempcnta 5 \relax \else \@tempcnta=\MT@step \fi \ifnum\@tempcnta=\z@ \@tempcnta=\@ne \fi \edef\MT@step{\number\@tempcnta\space}

Automatic expansion of the font? This new feature of pdfTEX 1.20 makes the hz-algorithm really usable. It must be either ‘autoexpand’ or empty (or ‘1000’ for older versions of pdfTEX). 2064 2065 2066

\let\MT@auto\@empty \ifMT@auto \ifnum\MT@pdftex@no=4\relax

We turn off automatic expansion if output mode is DVI. 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078

\ifnum\pdfoutput=\z@ \ifMT@opt@auto \MT@warning@nl{% Automatic font expansion only works for PDF output.\MessageBreak However, you are creating a DVI file. I will switch\MessageBreak automatic font expansion off and hope that expanded\MessageBreak fonts are available} \fi \MT@autofalse \else \def\MT@auto{autoexpand} \fi

Also, if pdfTEX is too old. 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089

\else \ifMT@opt@auto \MT@warning@nl{% The pdftex you are using is too old for automatic\MessageBreak font expansion. I will switch it off and hope that\MessageBreak expanded fonts are available on your system.\MessageBreak Install pdftex version 1.20 or newer} \fi \MT@autofalse \def\MT@auto{1000 } \fi

No automatic expansion. 2090 2091 2092 2093 2094

\else \ifnum\MT@pdftex@no