The Microtype Package an Interface to the Micro-Typographic Extensions of Pdftex
Total Page:16
File Type:pdf, Size:1020Kb
The microtype package An interface to the micro-typographic extensions of pdfTeX R Schlicht v2.3d [email protected] 2009/03/27 Abstract The microtype package provides aLaTeX interface to the micro-typographic extensions of pdfTeX: most prominently, character protrusion and font expansion, furthermore the adjustment of interword spacing and additional kerning, as well as hyphenatable letterspacing (tracking) and the possibility to disable all or selected ligatures. It allows to apply these features to customisable sets 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.20 or newer. Dis- abling ligatures requires pdfTeX 1.30, letterspacing and the adjustment of interword spacing and of kerning requires version 1.40. The package will by default enable protrusion and expansion if they can safely be assumed to work. These two features are also available with luaTeX. The microtype package does not work with X Te eX. The alternative package letterspace, which also works with plainTeX, provides the user commands for letterspacing only, omitting support for all other extensions (see section7). This package is copyright © 2004–2009 R Schlicht. It may be distributed and/or modified under the conditions of theLaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. This work has the LPPL mainten- ance status ‘author-maintained’. 1 Currently, this package provides protrusion settings for Computer Modern Roman, Palatino, Times, URW Garamond, Adobe Garamond and Minion, Bitstream Charter and Letter Gothic, the AMS symbols and Euler fonts, for various Euro symbol fonts, as well as some generic settings for unknown fonts (cf. table3 on page 21). Contributions are very welcome. CONTENTS 2 Contents 1 Micro-typography with pdfTeX4 2 Getting started5 3 Options6 3.1 Enabling the micro-typographic features.................6 3.2 Character protrusion.............................7 3.3 Font expansion.................................8 3.4 Tracking/letterspacing............................9 3.5 Miscellaneous options............................9 3.6 Changing options later............................ 10 4 Selecting fonts for micro-typography 10 5 Micro fine tuning 12 5.1 Character protrusion............................. 13 5.2 Font expansion................................. 14 5.3 Tracking..................................... 16 5.4 Interword spacing............................... 18 5.5 Additional kerning.............................. 19 5.6 Character inheritance............................ 20 5.7 Configuration files.............................. 20 6 Context-sensitive setup 22 7 Letterspacing revisited 24 8 Disabling ligatures 25 9 Hints and caveats 25 10 Contributions 28 11 Acknowledgments 28 12 References 29 13 Short history 30 14 Implementation 33 14.1 Preliminaries.................................. 34 Debugging [35] Requirements [37] Declarations [40] Auxiliary macros [41] Compatibility [48] 14.2 Font Setup................................... 52 Protrusion [57] Expansion [64] Interword spacing (glue) [66] Additional kerning [68] Tracking [69] Disabling ligatures [78] Loading the configuration [79] Translating characters into slots [83] Hook intoLaTeX’s font selection [88] Context-sensitive setup [91] LIST OF TABLES 3 14.3 Configuration................................. 93 Font sets [93] Variants and aliases [99] Disabling ligatures [100] Interaction with babel [100] Fine tuning [101] Character inheritance [107] Permutation [109] 14.4 Package options................................ 112 Declaring the options [112] Reading the configuration file [116] Hook for other packages [117] Changing options later [118] Processing the options [120] 15 Configuration files 128 15.1 Font sets..................................... 128 15.2 Font variants and aliases........................... 129 15.3 Interaction with babel ............................ 130 15.4 Note on admissible characters....................... 130 15.5 Character inheritance............................ 131 OT1 [131] T1 [131] LY1 [132] OT4 [132] QX [133] T5 [134] Euro symbols [134] 15.6 Tracking..................................... 135 15.7 Font expansion................................. 135 15.8 Character protrusion............................. 136 Default [137] Italics [145] Small caps [153] Italic small caps [156] Text companion [157] Computer Modern math [162] AMS symbols [166] Euler [170] Euro symbols [174] 15.9 Interword spacing............................... 175 Nonfrenchspacing [176] 15.10 Additional kerning.............................. 178 French [178] Turkish [179] 16 Auxiliary file for micro fine tuning 179 A Change history 182 B Index 189 C TheLaTeX Project Public License 197 List of Tables 1 Availability of micro-typographic features....................7 2 Predefined font sets.................................. 12 3 Fonts with tailored protrusion settings...................... 21 4 Order for matching font attributes........................ 81 MICRO-TYPOGRAPHY WITH PDFTEX4 1 Micro-typography with pdfTeX pdfTeX, theTeX extension written by Hàn Thê´ Thành, introduces a number of micro- typographic features that make it the tool of choice not only for the creation of electronic documents but also of works of outstanding time-honoured typography: most prominently, character protrusion (also known as margin kerning) and font expansion. Quoting Hàn Thê´ Thành’s thesis: AfterIf you you had have a PDF readviewer the textthat ‘Margin‘Margin kerning kerning is is the adjustments of of the the characters characters at at the the margins margins of of a a typeset typeset typeset text. text. onunderstands the right,PDF you1.5 can, you view A simplified employment of margin kerning is hanging punctuation. Margin kerning thecould effect view of the the effect features of the it is needed for optical alignment of the margins of a typeset typeset text, text, because because mechanical mechanical describesmicro-typographic by clicking features on the by justification of the margins makes them look rather ragged. ragged. Some characters characters can links:clicking on the links. make a line appear shorter to the human eye than others. Shifting such characters Protrusion onoff by an appropriate amount into the margins would greatly improve the appearance Expansion onoff of a typeset text. Both features are enabled Composing with with font font font expansion expansion expansion is is is the the the method method method to to touse use use a a wider awider wider or or narrower or narrower narrower variant variant variant of of a throughout this document. ofafont font a fontto to make maketo make interword interword interword spacing spacing spacing more moremore even. even. even.A font A font A in font ina loose a in loose a a line loose loose line can linecan line be besubstitutedcan can substituted be be substi- substi- by tutedbya wider a wider by variant a wider variant so variant the so interword the so the theinterword interword interword spaces spaces are spaces spaces stretched are are are stretched stretched stretched by a smaller by by by a a aamount. smaller smaller smaller Similarly, amount. amount. Similarly,a font in a a tight font line in a can tight be line replaced can be by replaced a narrower by avariant narrower to reduce variant the to amount reduce thethat amount the interword that the spaces interword are shrunk spaces by. are There shrunk is certainly by. There a potential is certainly danger a potential potential of font dangerdistortion of fontwhen distortion using such when manipulations, using such manipulations, thus they must thus be used they withmust extreme be used withcare. extreme The potentiality care. The to potentiality adjust a line to adjust width a by line font width expansion by font can expansion be taken can into be takenconsideration into consideration while a paragraph while a is paragraph being broken is being into lines, broken in intoorder lines, to choose in order better to choosebreakpoints.’ better [ breakpoints.’Thành 2000, [ p.Thành 323] 2000, p. 323] Both these features have been lacking a simpleLaTeX user interface for quite some time. Then, the pdfcprot package was released, which allowedLaTeX users to employ character protrusion without having to mess much with the internals. Font expansion, however, was still most difficult to utilise, since it required that the font metrics are available for all levels of expansion. Therefore, anybody who wanted to make use of this feature had to create multiple instances of the fonts in advance. Shell scripts to partly 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. In the summer of 2004, Hàn Thê´ Thành implemented a feature that has proven as a major facilitation forTeX andLaTeX 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. After this great leap in usability had been taken, the development did not stop. On the contrary, pdfTeX was extended with even more features: version 1.30 introduced the possibility to disable all ligatures, version 1.40 a robust letterspacing command,