Забыли?

?

# Digital Typography Using Latex. 2003

код для вставкиСкачать
Apostolos Syropoulos, Antonis Tsolomitis, Nick Sofroniou
DIGITAL TYPOGRAPHY USING LaTeX
Apostolos Syropoulos Antonis Tsolomitis Nick Sofroniou
Springer
D igital Typogr aphy Using WKX.
Springer
New York
Berlin
Heidelberg
Hong Kong
London
Milan
Paris
Tokyo
Apostolos Syropoulos Antonis Tsolomitis Nick Sofroniou
D igital Typogr aphy Using WTeX
With 68 Illustrations
Includes a CD-ROM J
Springer
Apostolos Syropoulos 366, 28th October St.
GR-671 00 Xanthi GREECE
[email protected]
Nick Sofroniou Educational Research Centre St. Patrick's College Drumcondra, Dublin 9 IRELAND
[email protected]
Antonis Tsolomitis Dept, of Mathematics University of the Aegean GR-832 00 Karlobasi, Samos GREECE
[email protected]
Library of Congress Cataloging-in-Publication Data Syropoulos, Apostolos.
Digital typography using LaTeX / Apostolos Syropoulos, Antonis Tsolomitis, Nick Sofroniou. p. cm.
Includes bibliographical references and indexes.
ISBN 0-387-95217-9 (acid-free paper)
1. LaTeX (Computer file) 2. Computerized typesetting. I. Tsolomitis, Antonis. Π.
Sofroniou, Nick. III. Title.
Z253.4.L38 S97 2002
686.2'2544—dc21 2002070557
ACM Computing Classification (1998): H.5.2,1.7.2,1.7.4, K.8.1 ISBN 0-387-95217-9 (alk. paper) Printed on acid-free paper.
Printed on acid-free paper.----------------------------------------------------------------------------------------------------------------------
© 2003 Springer-Verlag New York, Inc.
All rights reserved. This work may not be translated or copied in whole or in part without the written permission of the publisher (Springer-Verlag New York, Inc., 175 Fifth Avenue, New York, NY 10010, USA), except for brief excerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storage and retrieval, electronic adaptation, computer software, or by similar
or dissimilar methodology now known or hereafter developed is forbidden.-----------------------------------------
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they
are not identified as such, is not to be taken as an expression of opinion as to whether they are subject
to proprietary rights.
Printed in the United States of America.
9876 5 4321 __________ SPTN 10791970___________________________________________________________
Typesetting: Pages created by the authors using I^TgX www. springer-ny. com
Springer-Verlag New York Berlin Heidelberg
A member of BertelsmannSpringer Science+Business Media GmbH____________________________________________
Dedicated to the fond memory of Mikhail Syropoulos, my beloved brother; io my parents,
Georgios and Vassiliki, and to my son, Demetrios-Georgios.
— AS.
♦
To my parents,
Panagiotis and Evangelia, and to my wife,
Angeliki.
— A.T.
♦
To my father,
Andreas Sofroniou, who introduced me to computers when they were few and far between.
— N.S.
C o n t e n t s
Foreword by Yannis Haralambous xv
Preface xxv
1 Introduction 1
1.1 What Is Te*? ............................................................................................................ 1
1.2 Logical versus Visual D e s i g n............................................................................... 3
1.3 Preparing a Document with I^TgX...................................................................... 4
1.4 How Does T^X Typeset?......................................................................................... 10
2 The File Structure 13
2.1 The Characters We Type......................................................................................... 13
2.2 Document Classes and Packages......................................................................... 17
2.3 Sectioning Commands............................................................................................ 20
2.4 The Document Title ................................................................................................ 26
2.5 Basic L o g o s................................................................................................................ 28
2.6 Article Preparation................................................................................................... 29
2.7 Letter Preparation................................................................................................... 31
2.8 Producing Proceedings Articles ......................................................................... 33
2.9 Combining Individual 1?TeX Files ...................................................................... 34
3 Fonts and Their Use 39
3.1 Classification of F o n t s............................................................................................ 39
3.2 Accessing more G l y p h s......................................................................................... 46
3.2.1 Euro F o n t...................................................................................................... 50
3.2.2 Hie wasysym F o n t s..................................................................................... 50
3.2.3 Phonetic Fonts ............................................................................................ 52
3.3 Automated Special Glyphs Selection.................................................................. 53
3.4 Size-Changing Commands.................................................................................. 56
ν ι π -φ- Con ten ts
3.5 Advanced A c c e n t s................................................................................................... 59
4 Lists and Catalogs 61
4.1 Units oi Measure...................................................................................................... 61
4.2 Typesetting P o e t r y................................................................................................... 63
4.3 L i s t s............................................................................................................................. 64
4.3.1 Customizing the Standard Lists............................................................... 66
4.4 Qgotations ................................................................................................................ 68
4.5 F o o t n o t e s................................................................................................................... 69
4.5.1 Customizing Footnotes ............................................................................ 71
4.5.2 Endnotes......................................................................................................... 73
4.6 Simulating Typed Text............................................................................................. 74
4.6.1 Advanced Typed Text Simulation ........................................................ 75
4.7 Centering and Flushing T e x t................................................................................ 77
4.8 Alignment................................................................................................................... 78
4.8.1 The tabbing Environment......................................................................... 79
4.8.2 The tabular Environment......................................................................... 80
4.9 More on Alignment ................................................................................................ 84
5 Typesetting Mathematics 93
5.1 The Mathematics M o d e........................................................................................ 93
5.2 Font Selection in Mathematics Mode.................................................................. 94
5.3 Symbols for the Mathematics M o d e................................................................... 95
5.3.1 Special Latin A l p h a b e t s............................................................................ 95
5.3.2 The Greek Letters........................................................................................... 96
5.3.3 Accents in Math M o d e................................................................................. 97
5.3.4 Binary Operators.........................................................................................— 98
5.3.5 Variable-Size Operators............................................................................ 99
5.3.6 Delimiters...................................................................................................... 99
5.3.7 Arrows............................................................................................................ 99
5.3.8 Relational Operators......................................................................................100
5.3.9 Miscellaneous Symbols ...............................................................................102
5.3.10 More Math S y m b o l s......................................................................................103
5.3.11 Other Mathematics Font Families...............................................................107
5.4 The Art of Typesetting Mathematical Text............................................................107
5.4.1 Exponents, Indices, Fractions, and Roots ...............................................107
5.4.2 Functions .........................................................................................................109
5.4.3 One Above the Other......................................................................................l li r
5.4.4 Horizontal S p a c e............................................................................................113
5.4.5 Integrals and Series.........................................................................................113
5.4.6 Matrices, Arrays, and Nonanalytically Defined Functions .... 115
5.4.7 Theorems .........................................................................................................117
5.4.8 Customizing the t heorem Environme n t.............................................. 119
C on ten ts ·φ· ιχ
5.4.9 Eq uati ons.......................................................................................................124
5.4.10 Size Selection in Math M o d e s...................................................................126
5.4.11 Commutative Diagrams.............................................................................126
5.5 The Am.S Classes and Packages................................................................................128
5.5.2 Accents in Math.............................................................................................129
5.5.3 Dots .................................................................................................................130
5.5.4 Nonbreaking Da s he s....................................................................................130
5.5.5 Over and Under Arrows.............................................................................131
5.5.6 Multiple Integral Signs................................................................................131
5.5.7 Ra d i c a l s..........................................................................................................131
5.5.8 Extensible A r r o w s.......................................................................................132
5.5.9 Affixing Symbols to Other S y m b o l s......................................................132
5.5.10 Fractions and Related Constructs.............................................................132
5.5.11 The \smash Command................................................................................133
5.5.12 Operator N a m e s..........................................................................................133
5.5.13 The \mod Command and its R e l a t i v e s...................................................134
5.5.14 The \t e x t Command....................................................................................134
5.5.15 Integrals and S u m s.......................................................................................134
5.5.16 Commutative Diagrams.............................................................................135
5.5.17 Displayed Equations and Aligned Structures......................................135
5.5.18 Numbering Equations and Referencing................................................138
5.5.19 Matrices..........................................................................................................140
5.5.20 Boxed Formulas.............................................................................................140
5.5.21 Customizing Theorems .............................................................................141
5.5.22 Options of the amsmath Package.............................................................142
5.5.23 Converting from Standard I^rgX to the A ^\S Packages ...................143
5.5.24 The amsart Top Matter Commands..........................................................143
5.6 From A to Ma t h M L...................................................................................................144
5.7 Generating OMDoc Files ..........................................................................................148
6 More on the Core 151
6.1 Labels and References................................................................................................151
6.2 Hyper-references..........................................................................................................155
6.3 Horizontal and Vertical Space ................................................................................163
6.3.1 Length Variables..........................................................................................163
6.3.2 Horizontal S p a c e..........................................................................................164
6.3.3 Vertical S p a c e.................................................................................................166
6.4 Counters..........................................................................................................................168
6.5 Floating Objects.............................................................................................................170
6.6 Marginal N o t e s.............................................................................................................178
6.7 Page Layout...................................................................................................................179
χ -φ- Con ten ts
6.8 Page Styles .................................................................................................................182
6.9 The Preparation oi S l i d e s.......................................................................................185
6.10 Boxes..............................................................................................................................196
6.10.1 Fancy B o x e s.....................................................................................................199
6.11 New Commands.......................................................................................................203
6.12 New Environments .................................................................................................207
6.13 New L i s t s....................................................................................................................208
6.14 File I n p u t....................................................................................................................211
6.15 LT^X a l'interactive....................................................................................................213
7 Miscellaneous Packages 215
7.1 The calc P a c k a g e.......................................................................................................215
7.2 The ifthen P ack a ge....................................................................................................216
7.3 Syntax Checki ng.......................................................................................................217
7.4 Typesetting CD Covers ..........................................................................................218
7.5 Drop Capitals..............................................................................................................220
7.6 Preparing a Curriculum Vitae .............................................................................222
7.7 Multicolumn Typesetting.......................................................................................225
7.8 Hyphenatable Letter Spacing.................................................................................225
8 Bibliography and Index 229
8.1 Preparing the Bibliography....................................................................................229
8.2 Using BibT^X ..............................................................................................................231
8.2.1 The BibTeX F i e l d s............................................................................................236
8.2.2 Typesetting a Bibliographic D a t a b a s e.....................................................237
8.2.3 Multiple Bibliographies in One Document ............................................237
8.2.4 Bibliography in a Multilingual Environment........................................238
8.3 Preparing the I n d e x.................................................................................................241
8.4 ma KEiNDExin a Multilingual Environment.......................................................244
8.5 Customizing the Index..............................................................................................245
8.6 Glossary Preparation.................................................................................................247
Graphics 253
9.1 Drawing with the picture Environment..........................................................253
9.1.1 Invisible and Framed B o x e s.........................................................................254
9.1.2 Lines and Arrows............................................................................................255
9.1.3 Circles and Curved Shapes.........................................................................256
9.1.4 The Construction of Patterns .....................................................................256
9.1.5 An Example of the Calculation of the Area of a S q u a r e.....................257
9.1.6 A Diagram for the Calculation of the Area of a C i r c l e........................258
9.1.7 Box-and-Whisker Plots in the Style of John W. T u k e y........................259
9.1.8 A Scatter Plot of Temperature.....................................................................261
C on ten ts <>- x i
9.1.9 picture-Related Packages and S ys t em s................................................264
9.2 The Gnuplot S y s t e m.................................................................................................266
9.3 The graphicx Package.................................................................................................266
9.3.1 Playing with Words ....................................................................................268
9.4 Images that Can Be Loaded to a Ι^ΤβΧ File..........................................................270
9.5 Image Inclusion with pdfl^T^X..............................................................................271
9.6 Images in the Background........................................................................................271
9.7 The rotating Package.................................................................................................272
9.8 Mathematics Drawing..............................................................................................274
9.9 The PiCT^X Package.....................................................................................................275
9.9.1 The PPCHjex Package....................................................................................285
9.9.2 The PSTricks Packages................................................................................286
9.10 Graphs with METRPOST ........................................................................................289
9.11 Color Information.....................................................................................................293
9.11.1 Color in our Documents.............................................................................293
9.11.2 Coloring Tables.............................................................................................295
9.11.3 Color and the Printing Industry .............................................................299
9.12 Printing in Landscape M o d e.................................................................................299
10 Multilingual Typesetting 301
10.1 The babel Package .....................................................................................................302
10.2 The Ω Typesetting Engine........................................................................................304
10.3 The ε-Τ^Χ Typesetting Engine.................................................................................314
10.4 The Greek Language.................................................................................................315
10.4.1 Writing Greek Philological T e x t s.............................................................317
10.4.2 Working with Thesaurus Linguae Grecae.............................................318
10.5 The Latin Language.................................................................................................319
10.6 The Dutch Language.................................................................................................319
10.7 The Esperanto Language ........................................................................................320
10.8 The Italian Language.................................................................................................321
10.9 The Irish and "British" Languages........................................................................321
10.10 The German Language..............................................................................................321
10.11 The French L a n g u a g e..............................................................................................322
10.12 The Breton Language ..............................................................................................323
10.13 The Nordic Languages..............................................................................................323
10.14 The Thai Language.....................................................................................................324
10.15 The Bahasa Indonesia Language...........................................................................326
10.16 The Slovenian Language...........................................................................................326
10.17 The Romanian L a n g u a g e........................................................................................327
10.18 The Slovak Language ..............................................................................................327
10.19 The Czech Language.................................................................................................327
10.20 The Tibetan Language..............................................................................................327
x n -Φ- C o n t e n t s
10.21 The Japanese L a n gua ge...........................................................................................329
10.22 The Spanish Language..............................................................................................332
10.23 Other Iberian L a n g u a g e s........................................................................................333
10.24 The Estonian L a n g u a g e...........................................................................................334
10.25 The Korean Language..............................................................................................334
10.26 The Hebrew Language..............................................................................................336
10.27 The Cyrillic Script .....................................................................................................338
10.28 The Armenian Language ........................................................................................340
10.29 The Polish Language.................................................................................................342
10.30 The Georgian Language...........................................................................................343
10.31 The Ethiopian Language...........................................................................................344
10.32 The Serbian Language..............................................................................................346
10.33 The Sorbian L a n g u a g e s...........................................................................................347
10.34 The Croatian L a n g u a g e...........................................................................................347
10.35 The Perso-Arabic La n guages.................................................................................348
10.36 India's L an g ua g e s.....................................................................................................351
10.37 The Cherokee Language...........................................................................................355
10.38 The Hungarian Language........................................................................................357
10.39 The Turkish Language..............................................................................................358
10.40 The Mongolian Language........................................................................................358
10.40.1 Modem Mongolian—C y r i l l i c.................................................................359
10.40.2 Classical Mongolian —U i g h u r..............................................................360
10.40.3 Classical Mongolian —Horizontal Square Writing..........................362
10.40.4 Classical Mongolian - Soyombo ..............................................................363
10.41 The Vietnamese Language........................................................................................365
10.42 The Manchu Language..............................................................................................366
10.43 The Inuktitut Lan guag e...........................................................................................367
10.44 Archaic Writing Systems...........................................................................................368
11 To Err Is Human 375
11.1 I^TeX's Error Locator.................................................................................................377
11.2 Error Messages...........................................................................................................378
11.2.1 Errors found by I^TeX ................................................................................381
11.2.2 Errors in LT^X Packages.............................................................................384
11.2.3 Errors Found by TgX...................................................................................384
11.3 Warnings .....................................................................................................................387
11.3.1 Warnings Generated by I4TeX....................................................................387
11.3.2 Warnings Generated by T^X........................................................................390
11.4 The Last S t r a w...........................................................................................................390
C o n t e n t s -φ- x m
12 Installing New Type 393
12.1 Installing METRFONT Fonts...................................................................................393
12.2 Installing Type 1 Text Fonts in Έ^Τ^Χ...................................................................394
12.2.1 Extracting Metric Information....................................................................394
12.2.2 Encoding Vectors...........................................................................................395
12.2.3 Creating Virtual Fonts and Metric F i l e s.................................................398
12.2.4 Creating More Fonts from a Type 1 Font.................................................400
12.3 Virtual Property List F i l e s......................................................................................400
12.3.1 Two Applications...........................................................................................405
12.4 Creating Support Packages and Font Definition F i l e s..................................408
12.5 Systemwide Installation of Prepared F o n t s......................................................411
12.6 Installing Scalable Fonts for pdfI£[£X...............................................................411
12.7 Installing Scalable Fonts for Λ............................................................................413
12.8 OpenType F o n t s......................................................................................................415
12.9 Installing Math Fonts for LT^X............................................................................415
12.10 Installing Math Fonts for A....................................................................................420
Appendix A Using dvips 425
Appendix B Visual Editing 433
Appendix C Typesetting XML 439
Appendix D Web Publishing 445
D.l LTeX2HTML .............................................................................................................445
D.2 t e x 4 h t..........................................................................................................................447
Appendix E N e w Features Introduced to Ω 1.23 451
Appendix F Solutions to All Exercises 455
Bibliography 469
Name Index 471
Subject Index 475
Fo r e w o r d
This book explores a great number of concepts, methods, technologies, and tools-in one word resources-that apply to various domains of typesetting. These resources have been developed and are used by the members of a very special community of people, which is also a community of very special people: the T^X community. To understand the motivation that led these special people to develop and use these resources, I believe it is necessary to make a short flashback. Since it is true that the past (uniquely?) determines the present and the future, I decided to divide this foreword into three parts: The Past, The Present, and The Future.
At this point, I am asking the readers to excuse my tendency of sometimes becoming autobiographic. This is very hard to avoid when talking about people and events important to one's life, and, after all, avoiding it could mean betraying the subject I would like to talk about.
The Past
Back in the 1980s, when I started working on my Ph.D. thesis, people in my department at the time (the Math Department, University of Lille, Northern France) were using a piece of software called "ChiWriter." This DOS program produced a very ugly low- resolution output of text and mathematical formulas. Others preferred to use IBM's Selectric II typewriter machines, spending hours and hours switching balls between Roman, Italic, and Symbol characters. Then came the day when the department finally bought a Macintosh Plus (with 1 MB of RAM and a 20 MB external hard drive!) and we installed Textures (a Macintosh implementation of TgX) on it. That day, my thesis advisor gave me a photocopy of the TfcXbook, which I spent the whole night reading.
The last appendix chapter of that book was called "Joining the TgX community" and talked about TUG (the T^X Users Group), TUGboat (the newsletter of TUG) and so on. But the reader must realize that at that time things were quite different from today: computers were of course unfriendly, expensive, and slow, but the main difference was that there was as yet no Internet. Without the Internet, distances were more real than today, and for people like me who had not yet traveled to the States, places such as
χ ν ι -φ F oreword
"Stanford" or "Princeton" were infinitely far away and seemed to exist only for the privileged few. This is probably hard to understand today, but at that time, imagining the "T^X community" for me was like seeing a Star Trek episode or an old Hollywood movie: it was about people knowing and communicating with each other and acting together, but in a totally different place, time, and context—there could de facto be no interaction between them and myself.
That was in 1986, and then came the day when, during a stay at the Freie Universitat Berlin, two things happened: I met and became friends with Klaus Thull (one of the European T^X veterans), and I opened my first TUGboat. By a coincidence so strong that one would be tempted to consider it as paranormal, the first TUGboat page I read was exactly page 22 of volume 9 (1), namely the one containing Silvio Levy's examples of Kazantzaki's text typeset in Silvio's Computer Modern Greek. Here is a translation of that text, reminiscent of the storm in Beethoven's sixth symphony:
"At this moment I understand how heavy the mystery of confession is. Until now no one knows how I spent my two years at Mount Athos. My friends think I went there to see Byzantine icons, or because of a secret longing to live a bygone era. And now, look, I feel embarrassed to speak.
How shall I put it? I remember a late afternoon in the spring, when a storm overtook me as I was coming down Mount Taygetos, near Pentavli. The whirlwind was so fierce I fell flat on the ground so I wouldn't be blown off the mountain. Lightning encircled me from everywhere and I closed my eyes to keep from being blinded and waited, face down, on the bare earth. The whole towering mountain shook and two fir trees next to me snapped in the middle and crashed to the ground. I felt the thunderbolt's brimstone in the air, and suddenly the deluge broke, the wind died down, and thick warm drops of rain struck the trees and soil. It pelted the thyme, oregano, and sage, and they shook off their odors and scented the whole earth."
Goethe (and Beethoven) wanted to communicate "von Herzen zu Herzen"; well, this is exactly what happened to me: altogether, the marvelous inebriating contents of this text which I had not read before, its appearance (which at that time I also found marvelous), and its context were quite a shock. That same day, I was able to communicate with Silvio (at that time still at Princeton) through e-mail. A few days later, Klaus and I had written our first joint TUGboat paper and submitted it to Barbara Beeton, again through e-mail. Suddenly, there were no frontiers anymore: the ΤβΧ community was quite real, and a new world opened in front of me. It is obvious that without traveling to Freie Universitat Berlin, without Klaus, without e-mail, without TUGboat, none of these would happen.
In the summer of 1990, just a month after I defended my Ph.D. thesis, Tereza (who later became my wife) and I went to the TgX Users Group meeting in Cork, Ireland, and we had the chance to meet there all those mythical people who made T^X-the pioneers of the TgX community-except Donald Knuth himself, whom I met two years later, in Stockholm, in the pure Bergmanian atmosphere of the late Roswitha Graham's house. The occasion was the ceremony where Donald Knuth was conferred
F o r e w o r d -φ- χ ν π
an honorary doctor's degree at the Kungl Tekniska Hogskolan. Roswitha cashed in on that opportunity and organized a small but very interesting Nordic TUG meeting.
In the late 1980s and early 1990s many wonderful things happened (to name only one: the fall of the Berlin wall while Klaus spent the whole night cycling from East to West Berlin and back). At the same time, using communication tools such as mailing lists and ftp, the Tp;X community was able to communicate more and more and became wider and more powerful.
But who were these people and where did they come from? The twenty-first century reader should realize that in the 1980s and early 1990s, when Linux was in the mind of its creator and GNU software was not widely known, public domain software did not have the same degree of popularity and reputation as it has today. Qn the other hand, computers and commercial software were horribly expensive. The psychology of computer users was different as well: there was a tremendous psychological gap between "users" and "programmers"; especially, Macintosh and Windows users would be shocked if they had to type something that even vaguely looked like programming code, and writing T^X was indeed "programming," even if learning ΤβΧ was far more pleasant than learning, for example, Fortran IV or 8086 Assembler-not to mention the frightening task of implementing TgX on different platforms, which was, at that time, sometimes still unavoidable for people who simply wanted to use T^X for their documents. In France, in the early 1980s, there were Ph.D.s written on the process of implementing ΤβΧ on specific platforms.
It is not surprising that most members of the T^X community were students or scientists from computer science, mathematics, or physics departments. Because they had a reason to use TgX (writing their reports and publications), and because they had the means to communicate with each other, many of them contributed to T^X by writing code, and surprisingly enough, the T^X code that they wrote was very often not connected to the subject of their studies and research. Some projects were linguis­
tic (extending T^X's capabilities to other languages and scripts), others typographical (facing the challenges of book typesetting), others artistic, ludic, or educational. In fact, what happened was, on a smaller scale, the same phenomenon as with Web pages some years later: students and scientists suddenly had the possibility to include their private life and hobbies in their work context and to share them with the community. The human dimension of ΤβΧ (and later of the Web) was flexible enough to allow input from various areas of human activities and interests. TUGboat was a wonderful mirror of that activity.
There were also the human needs of creativity and commitment: many TgX users wrote some code for their own needs, realized then that such code could be useful to others, extended it and wrapped it into a package with documentation and examples, and finally committed themselves to supporting it. By doing that, others became inter­
ested and communicated with them to express gratitude and suggestions for further development, which in turn resulted in reinforcing that commitment even more, and so on. Years before the widespread use of the Internet, the TgX community was already
χ ν ι π -φ- F oreword
what we now call a virtual community, providing a positive and creative identity to people.
That identity was—and still i s —one of the most charming aspects of T ^X.
The Present
In the years that followed, the emergence of the Web brought big changes to the TgX community and to the perception of TgX by computer users in general. Thanks to HTML, it is quite natural today for everybody to be able to read and write "code." On the other hand, Adobe's PDF file format has bridged the gap between TgX output and electronic documents (and there is indeed a version of TgX producing PDF output directly). DVI was defined as a "device independent" and "typographically correct" file format: it was abstract enough to be usable on any platform and at the same time precise enough to be able to describe a printed page without loss of information. This was, more or less, also the case for the PDF format, which has the enormous advantage of being self-contained in the sense that it contains all resources (images, fonts, etc.) necessary for displaying and printing the document.
Finally, thanks to Linux and GNU, public domain software is nowadays very well- reputed, and, quite naturally, TgX is still part of every public domain operating system. That is why it gained popularity among computer gurus who used it to prepare their documents with other tools.
For every new T^X user, the contact with the TgX community (which has been such a big deal for me) has become instantaneous, since nowadays almost everybody is connected to the Web. ΤβΧ code can be distributed to the whole community—and this includes people in places unimaginable ten years ago—in a few minutes or hours. Even better, collaborative development tools such as sourcef o r g e. n e t allow people to work simultaneously on an arbitrary number of different versions of the same software, however extensive and complicated this software may be.
The Web was very profitable for TgX for a number of reasons. Besides providing the T^X community with the means to be a true virtual community, it also made the principle of the dual nature of a document (source code versus compiled result) to become completely natural: when you write HTML code and preview it in your browser, you see two different representations of the same document. In other words, the "WYSIWYG" principle (which in the 1980s was quite an annoyance to ΤβΧ) has, at last, lost its supremacy.
Also, thanks to the Web and to political changes, there are no frontiers anymore,
and standards such as Unicode have emerged to allow communication in all languages. T]hX has always been a pioneer in multilingual typesetting, a feature that becomes more and more important today. As we will see in a while, a successor to T^X is one of the few (if not the only) software packages nowadays allowing true multilingual typesetting.
But are all things really well in the best of all possible worlds?
Talking of free software, let us return to one of the biggest achievements in the public domain, namely the Linux operating system, developed by hundreds of people
Fo rew o rd <>- χ ι χ
all around the world. The obvious question to ask is: can T^X be compared to Linux? Unfortunately not, for several reasons.
First of all, is the absence of a Linus Torvalds for T^X: in fact, the author of ΤβΧ, Donald Knuth, one of the biggest computer scientists of the twentieth century and indeed a fabulous person with interests far beyond computer science, unfortunately decided to stop working on ΤβΧ once a certain number of goals were achieved. This happened in 1992, when version 3 of TgX was released. New versions after that were just bug fix releases. There are some small groups of people working on specific TgX- related projects (such as the LT^X group, the Ω group, the Λf'f S group, etc.) and some institutions maintaining specific TgX packages (such as the A^[S). But outside of these, there is no coordination of the individual programming efforts.
Secondly, the goal to be reached in further developing TgX is not quite clear. ΤβΧ is a program dedicated to typography, a craft that very few people actually have studied, some people have learned by themselves^nainly by actually making books—and most people are generally unaware of. To continue our comparison with Linux, the latter is an operating system and hence deals with the global use of the computer: it is easy to imagine improvements, and if you lack imagination, you can always look into commercial operating systems to get ideas. ΤβΧ is the only piece of software dedicated to typography, and it does a very good job. Some people even believe that T^X is already perfect and hence there is no need for further improvement. But what is the ultimate goal of ΤβΧ, its raison d'etre?
For years now, pessimists have been predicting T^X's extinction, but T^X is still alive and kicking! Maybe the most important reason for that is that T^X bridges the gap between the cultural heritage of the precomputer era and us today. Typography is both a craft and an art 500 years old, and Donald Knuth actually learned it and encoded his knowledge to TgX so that ΤβΧ is a "typographer-in-your-machine." Using just standard T4Tp<, people unaware of typography can produce decent documents by including in their text some markup reminiscent of XML. With a little more effort, and using a little more than standard LT^X, people aware of typography can produce brilliant documents. This degree of proficiency at attaining the sublime is cruelly missing from contemporary commercial software where the goal is not really commitment to our cultural heritage. TgX is a craftsman's tool like in the good old days: using such a tool, a novice can produce decent results and a master can make works of art. And, as always with Donald Knuth, a work of art in the context of TgX is both beautiful typesetting and efficient programming.
This book presents some of the achievements of the ΤβΧ community in the last two decades. For reasons inherent to the T^X users community, the tools presented are of various degrees of quality, efficiency and compatibility. There are so many tools (or packages, in LTgX parlance) available from the Comprehensive TgX Archive Network that there are strong chances you will find a package for any of your potential needs.
χ χ -φ F oreword
But how efficient will that package be, or how compatible with other packages written by other authors? This is an important question because improvements or resolutions of conflicts require a good knowledge of Ι^ΤβΧ. Often, there is a high level of support by the author of the package. But what happens when the author is hard to reach, or even unknown? Others in the T^X community may help you, but, as always in the public domain, there is no guarantee that you will get the help you need precisely when you need it.
This situation may seem frightening to people who expect absolute efficiency and immediate compatibility from software they use. There is a working scheme that is better fit to TgX and I5TeX, namely that of small groups of people sharing the same computer resources and being assisted by a "system administrator" (or "guru"). The "guru" is supposed to know ΤβΧ and Ι^ΤβΧ sufficiently well and to have the necessary time and energy to solve problems for the rest of the group, which can then smoothly use the software. Unfortunately, this organizational scheme does not fit individual personal computer users, who have to be simultaneously users and administrators.
So, how does one deal with problems in L5TgX packages? Well, experience shows that if you are a convinced Ι^ΤβΧ/Τ^Χ user, then you always manage to get by the problems, either by searching in literature (and books such as this one are very important for that very reason) by diving into the code and trying to "make it work," or, finally, by contacting other members in the community, even if the developers of the package are unreachable. A combination of these three methods actually works best. What is important is to realize that you are extremely lucky to be able to do all three: you have valuable books (such as this one and others), you can indeed dive into the code since it is open and freely distributed, and you can indeed contact others since there is a virtual—and furthermore friendly and united—community. Commercial software does not offer these opportunities.
The reader may have noticed that this book often mentions Ω and A. Where do these mysterious names come from and how do they fit in the "T^X and friends" context?
Ω, one of the major current TgX projects, is an effort by two people (John Plaice and myself) to develop a successor to ΤβΧ. It started two years after Donald Knuth's decision to freeze TgX. The philosophy of Ω is to take TgX as a starting point and to progressively add techniques and tools allowing the resolution of specific typesetting problems one at a time. The first major goal was to achieve typesetting in all languages of the world in the most natural and efficient way. In particular, one of the tasks that Ω seeks to accomplish is Unicode compliance (as explained in the book, Unicode is a standard 21-bit encoding for information interchange).
But Ω has other goals as well and is in fact an open platform for enhancements and additions to TgX. The name Ω has been chosen because traditionally the last letter of the Greek alphabet stands for ultimacy, "the ultimate tool," and also probably because 50% of Ω'β development team is Greek. Finally, because choosing a Greek letter as the
Fo rew o rd <> χχι
invariable and nontranslatable name and logo of a program is an additional argument for using the Unicode encoding (just as the fact of lowering the letter Έ' in the TgX logo was a very clever way to show the absolute need of using T^X to typeset even its own name).
Contrarily to Ω, which is existing, and quite extensive software, A is just a nickname, a kind of parody of the T^TgX name: In fact, the "La" in Ι^ΤβΧ comes from "Lamport", as in Leslie Lamport, the author of pre-1992 T£T]hX. The word "Lambda" also starts with "La", but has no relationship whatsoever with "Lamport" and is a Greek letter just like "Omega." A stands (as explained in this book) for the current DT^X (an achievement of the LT^X team, headed by Frank Mittelbach) when used in conjunction with the Ω engine.
It is quite probable that future versions of I^TeX (for instance, version 3) will either be entirely written for Ω or at least have parts dedicated to Ω, in which case the Λ nickname will be useless. Also, due to the fact that the greatest part of Ω resources has not yet been released publicly, and that the Ω team still has to make a certain number of important global decisions, some information on Ω contained in this book may undergo minor changes in the future. In particular, there is (at the time this text is being written in March 2002) still no standard user-level I£TeX interface for Ω.
Nevertheless, the basics of Ω will not change, and this book has the merit of being the first one to describe some of the very fundamental aspects of Ω, such as Ω translation processes, Ω virtual property lists, and so on and to illustrate them by examples.
The Future
The "future of TgX" (including the question of whether there is a future for it at all) has been a popular discussion subject for years in the ΤβΧ community. In fact, TgX is the sum of a big variety of different things, and for each one of them one can more or less predict its destiny, but one can hardly do this for the sum of them.
For example, TgX is both a programming language and a program (a "compiler" for that language): one could imagine that the program survives (for example as a typesetting or "rendering" engine inside a bigger system, and rumors circulate that
this is already the case in Adobe InDesign); on the other hand, one could imagine Ω or some other successor to TgX becoming more and more different from TgX but^or reasons of upward compatibility—keeping the same programming language for input.
Besides being a programming language and a program, T^X is also a popular no­
tation for mathematical formulas: mathematicians worldwide use T^X notation when
writing formulas in, for example, e-mail messages: x~2 + y~2 < 1 with or without dollars is a natural choice for expressing the formula x 2 + y 2 < 1 in a text-only context. For writing mathematical formulas, ΤβΧ is exhaustive, clear, unambiguous, and short enough-all of the qualities of a good notation.
In recent years, the computer industry has become more and more involved in type­
setting engine projects: the context in which source code of some kind has to produce more or less rigid formatted output becomes more and more important. After the first
χ χ ι ι -φ F oreword
enthusiastic years of explosion of the Web, people realized that HTML (even combined with CCS) was definitely not sufficient for formatting documents. XML provided the necessary standard for structuring documents in an arbitrarily fine way, but still there was no "standard" way to represent an XML document. In October 2001, a new stan­
dard filled that gap: XSL-FO. The tools provided by XSL-FO for formatting documents are a quite serious challenge, and a new generation of XSL-FO-compliant typesetting engines is slowly emerging.
More generally, the current trend is to use XML as the basis of every kind of file format. For example, the SVG standard is, in some sense, an "XML-ized version of PostScript." One could very well imagine all file formats involved in ΤβΧ becoming XML-compliant: the input file could be pure XML "processing instructions" for in­
cluding code in the TgX language the DVI file format could be replaced by SVG, the font metrics could be expressed in XML, illustrations could be in SVG instead of EPS, and so on. In that case, ΤβΧ (or Ω, or some other successor to ΤβΧ) would simply transform one XML document into another one. The fact that XML document transfor­
mation is nowadays an increasingly popular and important concept is by no means a coincidence.
Another area where Ω can be applied to revolutionize the electronic document is that of adaptive documents. A research project in that area deals with vario-documents, namely documents that contain a big number of page descriptions and display the right one according to context parameters, just as HTML browsers reflow text when their display window is resized. Only here each page description of the document has been compiled in advance by a "super-Ω," always with the same high typesetting quality standards.
Yet another area of drastic improvement of Ω'β capabilities would be an on-the-fly interaction between typesetting and dynamic fonts. Already, in Vector TjiX (a commer- cial ΤβΧ for Windows platform), Dimitri Vulis has included METRFONT capabilities into TgX. By using more modern font formats, such as OpenType, one could obtain a dialog between the font and T^X's typesetting engine so that each one instructs the other on constraints and context parameters and so that the final result is optimal for both.
There is also the more global, operating system-oriented point of view: Ω could very well become a server, and arbitrary client applications could send requests with text extracts and macros or parameters and receive in return small parts of page descriptions.
All of these "mutation" scenarios could be compared with the common skeleton of many science-fiction stories, where humans mutate to become less and less organic. Usually sci-fi authors want to express the fact that despite and beyond the changes of the human body (including an artificial brain), a core of humanity will always emerge as a fundamental quality of mankind. This is exactly the case for ΤβΧ: I am convinced that however drastically TgX (and its successors) will change in the future, its fundamental quality, which is the love of one man—and not just any man! -^or good typography and good programming will always prevail and will always be the ultimate guarantee for the survival of this magnificent tool.
F o r e w o r d -φ- χ χ ι π
Ii this book succeeds in transmitting the fundamentally human quality of T^X and its successors, due to the love, sweat, and tears of Don Knuth and the hundreds of members of the active T^X community, then it will have reached its goal. I sincerely hope it does.
Yannis Haralambous Brest, France
March, 2002
P r e f a c e
Our era is characterized as the "information era" mainly because computers (i.e., machines that manipulate information) are used in virtually all aspects of human life. One particularly interesting aspect of this phenomenon is that computers are used in areas where people traditionally thought that these machines had no use. One such area is fine arts (music, typography, painting, etc.).
Strictly speaking, typography is both an art and a craft. Typography is an art because it exists to honor content, and consequently, it can be deliberately misused. On the other hand, it is a craft, by which the meaning of a text (or its absence of meaning) can be clarified, honored, and shared, or knowingly disguised.
Many computer programs provide the means by which one is able to produce printed matter (books, leaflets, etc.). Most of them strive to provide a user-friendly interface that sometimes tries to guess the writer's intentions. However, it is a fact that all of these systems fail to produce the result that a traditional typographer would produce. There are many reasons for this serious drawback. For example, when the writer uses a friendly user interface, he or she is provided with a quite limited set of formatting tools that cannot handle all possible cases. This is quite evident when it comes to the typesetting of mathematical text, which is very demanding.
However, if one is provided with a programming notation specifically designed for typesetting purposes, then one loses the friendly user interface, but this is usually compensated by the output quality. In this book we make every possible effort to show that it is worthwhile to go to the trouble of learning such a programming notation. The programming notations we present are I^TpX (and its variant, pdfLM^X) and A. They are markup languages specifically designed to ease the creation of scientific and
nonscientific documents alike. Currently, the only evident difference between I5T^X and Λ is the fact that I^TpX operates on top of the TpX typesetting engine and Λ on top of the Π typesetting engine. Otherwise, there is no obvious difference between the two notations. Virtually any document produced with ΙίΤβΧ can be produced with Λ.
χχν ι <> P r e f a c e
T^X in general and in particular are programming notations, and many newcomers wonder whether they can master the basics of the systems easily. Regarding LMgX, the answer is yes! I^TgX has been designed so that even uninitiated people can produce excellent documents with the least possible effort, and this is exactly one of the goals of this book: to teach the novice all that is necessary so that he or she can be able to create high quality documents quickly with the tools described in this book.
A
This book contains many text blocks that are marked with the symbol that marks this paragraph and are narrower than the usual text. These text blocks go into the details of the various typesetting tools and describe ways that allow users to customize them. Consequently, they should be read only by readers who have a good understanding of IATgX basics. Naturally, all novice readers will reach this level of understanding once they carefully study the rest of the text and try to do all the exercises (solutions to all exercises are provided at the end of the book).
So, this book is for novice as well as advanced IiT^X users. Therefore, the book is suitable for everyone who wants to learn to use the system and its variations. Although L?TeX and A are excellent typesetting tools for all sorts of documents, many people still think that they are the tools of choice only for mathematical typesetting. By presenting the multilingual capabilities and the other capabilities of these systems, we hope to make clear that these tools are just the best typesetting tools for all kinds of documents and all kinds of users!
The Book in Detail
Let us now describe the contents of each chapter.
The first chapter explains what I^TgX/A is in general. We discuss the advantages
of the logical document preparation versus the visual document preparation. Next, we provide information regarding the document preparation cycle and the various tools that are involved. The chapter concludes with general information regarding the programming notation.
In the second chapter we discuss various things that are essential for the preparation of even the simplest document. More specifically, we present the various characters that have a predefined meaning and the sectioning commands. We also discuss how one can prepare the title or the title page of a document. Next, we explain how one produces the various logos (e.g., how one can get the L?TeX logo). Then, we discuss the preparation of articles, letters, and proceedings articles. We conclude by presenting a tool that allows us to combine many different documents into a single one.
P r e f a c e -φ χ χ ν π
In the third chapter we discuss various issues related to fonts, such as font shapes, series, and families. We continue with the presentation of the various font selection commands as well as the various symbol access commands. Also, we present ways that one can get important symbols such as the € symbol, the letters of the phonetic alphabets, astronomical symbols, and more, and since accented letters are found in most languages, we conclude the chapter by presenting tools that facilitate the placement of accents over letters.
The fourth chapter presents tools that can be used to typeset lists and catalogs, as well as poems, quotations, and more. In addition, we give all of the details that are necessary for the customization of these tools.
In chapter five we describe how one can typeset mathematical content using I^TeX. We present the available symbols and the symbol access commands. In addition, we present the necessary tools that the creation of complete mathematical texts. The last two-thirds of this chapter are for those who will use this chapter for reference for demanding mathematical text, and it can safely be skipped on first reading. The chapter concludes with a presentation of how one can generate M a t h M L content from Λ sources. In addition, we discuss how it is possible to generate hypertext content from Λ sources.
Chapter six presents all of the core ΐ£ΓβΧ features that have not been described in the previous five chapters. Topics covered in this chapter include references and hyperreferences, commands that generate white space, floats, page styles, and layout, slide preparation, and the definition of new commands and environments.
The seventh chapter presents a number of very useful packages (i.e., "systems" that extend the functionality of Ι^ΤβΧ) and do not comfortably fit in any other place.
Chapter eight shows how we can prepare the bibliography and the index of a document. We also show how we can prepare multilingual bibliographies and how we can create a simple package that can assist us in the generation of glossaries.
In chapter nine, we present a number of tools that allow I^T^X users to create simple drawings. These tools include the picture environment, the PiCT^X package, and METRPOST. We also discuss ways to include images in Ι^Τ^Χ and pdfETEX files, and since color and graphics are two closely related issues, we also discuss how we can create colorful documents.
_______________
Not many years ago, the English language dominated scientific writing, and this was reflected in most books on ^Τ^Χ; these books assumed that their readers would typeset their documents in English. However, this situation has changed, and nowadays most people prefer to use their mother tongue in their writings. Naturally, all of these people need typesetting tools to prepare their documents in their native languages. The tenth chapter describes all of the currently available tools for typesetting documents in a variety of languages. The first part of the chapter is devoted to the description of the typesetting tools, while the second part presents the typesetting facilities that are available for around forty languages or groups of languages.
χ χ ν ι ι ι -φ P r e f a c e
To err is human, and this is the subject of the eleventh chapter, where we present common errors and error recovery strategies.
Chapter twelve is devoted to a description of the steps necessary for successfully installing new fonts (particularly scalable fonts) in an existing TgX installation.
The book concludes with five appendices that describe the generation of PostScript files from I^TfiX files, visual editing with x d v i and e m a c $the typesetting of XML files with I^T]hX, the transformation of LT^X files to HTML files, and the new features that will be introduced to the the Ω typesetting engine. The bibliography mentions only material published in some journal, periodical, or newsletter or as a book. Program manuals and "system" documentation usually accompany the corresponding software and in general are available from the CTAN (see page 12). There are two indexes: a name index and a subject index. In the subject index, a boldfaced page number denotes the page where the subject is discussed in detail (or defined). If for some subject there is no such page number, this means that the subject is considered well-known stuff. The T^XLive CD-ROM that is included with this book offers a complete T^X system for Linux, Solaris 8 x86/SPARC, and Win32 platforms. This encompasses programs for typesetting and printing of Μ^Χ/Λ documents, all of the packages described in this book, plus many other useful packages and extensive font libraries. The CD-ROM includes a large amount of general documentation about T^X, as well as the documents that accompany specific software packages. In addition, the CD-ROM contains all the book examples plus a number of selected exercises in the directory omegabook. The CD-ROM was compiled by Sebastian Rahtz. Typographic Conventions For most programs we use their respective logos when we are referring to them in the text. In case there is no such logo, we use small caps to write the program name (e.g., d v i p s ). But the reader is warned to enter the program name with lowercase letters when attempting to use them. So, for example, the reader must type l a t e x and dvips in order to use LTgX and d v i p s. Acknowledgments In this book, we present formatting tools for very many languages, and naturally we do not speak most of them. So we had to ask for help from native speakers (or flu­ ent speakers, in the worst case) to verify the linguistic accuracy of the corresponding sections. We thank the following people for providing us with comments and sug­ gestions that substantially improved the corresponding language sections: Takanori P r e f a c e -φ- χ χ ι χ Uchiyama (Japanese language), Jazier Bezos (Spanish language), Jin-Hwan Cho (Ko­ rean language), Serguei Dachian (Armenian language), Oliver Corff (Mongolian lan­ guage), and Chakkapas Visavakul (Thai language). We also would like to thank the following people for their help, suggestions, and constructive comments: Ichiro Matsuda, Norbert Preining, Koaunghi Un, Nguyen Due Kinh, Olaf Kummer, Denis Girou, Andrea Tomkins, Sivan Toledo, Georgios Tsapogas, Vassilis Metaftsis, Harald H. Soleng, and Sebastian Rahtz for his excellent work on the TgXLive CD-ROM. Special thanks go to the Data Analysis Lab of the Department of Electrical Engi­ neering of the Democritus University of Thrace and to the Department of Mathematics of the University of the /Egaean for providing the necessary resources for the creation of this book. Also, the first author of this book wishes to thank Sotirios Kontogiannis, Osman Osmanoglou, Georgios Toptsidis, and Kostantinos Sotiriadis for many stimulat­ ing and thought-provoking late-night discussions! The third author wishes to thank the Educational Research Centre at Saint Patrick's College for enabling him to contribute to this project. We also thank the anonymous reviewers who helped us to substantially improve the text of the book; and John Plaice for sharing with us his vision for Ω. Last but not least, we thank Wayne Yuhasz, executive editor of Springer-Verlag N.Y.; his assistant, Wayne Wheeler; Frank Ganz, the Springer T^X evaluations manager for his help with some PostScript Type 1 fonts; Hal Henglein, the copyeditor; and Lesley Poliner the Spinger production editor. The writing of a book is not an easy task at all, and of course this book is no exception. But in certain cases it is far easier if there is a starting point. For this book we used many ideas and the presentation style of [23]. The present book contains references to many web sites, but since it is a fact that web sites change web hosts rather frequently, we provide a web page with all the Web links of this book. The page also contains some other information regarding this book and it is located at h t t p: //oceanl. e e. duth. g r/ LaTeXBook/ and mirrored at http: //i r i s .math. aegean.gr/LaTeXBook/. Apostolos Syropoulos Xanthi, Greece Antonis Tsolomitis Samos, Greece Nick Sofroniou Dublin, Ireland I n t r o d u c t i o n 1 ----- Computer Science is a fast growing discipline that rapidly engulfs exciting new disci­ plines such as Digital Typography and Mathematical Typesetting. Indeed, today Digital Typography is an active research field of Computer Science. In this chapter we introduce the fundamental concepts related to digital typesetting with T^X. We briefly present all of the relevant ideas that are necessary for the rest of this book. 1.1 W h a t I s T E X? The term "Digital Typography" refers to the preparation of printed matter by using only electronic computers and electronic printing devices, such as laser-jet printers. Since electronic printing devices are widely available, one often needs a digital typesetting system. ΤβΧ is a digital typesetting system designed by Donald E. Knuth. He designed TeX [19] mainly because, as he was struggling to finish the books of The Art of Computer Programming, he became disappointed with the computer technology available at the time. According to its creator, the idea for TgX was actually bom on February 1,1977, when Knuth accidentally saw the output of a high-resolution typesetting machine [16] (this article has been reprinted in [17]). He was told that this fine typography was produced by entirely digital methods (unfortunately, we are not aware of these methods), yet he could see no difference between the digital type and "real" type. At that moment he realized that the central aspect of printing had been reduced to bit manipulation. By February 13, he had changed his plan to spend the next year in South America; instead of traveling to some exotic place and working on Volume 4 of The Art of Computer Programming, he decided to stay at Stanford and work on digital typography. It is interesting to note that the 4th Volume of The Art of Computer Programming has not been published yet. By August 14,1979, Knuth felt that T^X was essentially complete and fairly stable. In the meantime, he worked also on METRFONT [18], the companion program of TgX that he used to create the Computer Modem typefaces [15] that are now the standard font for T^X. Later on, he rewrote both T^X and METRFONT using 2 i I n t r o d u c t i o n the literate programming methodology that he also developed [17]. The product of this work was a system that is now known as TgX82. Knuth further developed his systems, and both of them are now frozen, in the sense that no further improvements will be done by him apart from some bug fixes. Since Knuth wants people to help him to find all possible remaining errors in his programs, he is offering the amount$327.68 to anyone who finds a bug. For more information on this offer, we suggest you to read the first few lines of the files t e x. web1 and mf. web2 that contain the source code of both systems. The present version of ΤβΧ is 3.14159 and that of METRFONT is 2.718. Readers with a mathematical background will realize that the version numbers are identical to the first few digits of the numbers π (i.e., the circumference of a circle whose diameter is one) and e (i.e., the base of the natural logarithms). It is Knuth's wish to name the final version of TgX the version n and the final version of METRFONT version e by the day he dies. Although TgX and METRFONT are free software, they are trademarks of the American Mathematical Society (or ΑχψS for short) and of Addison-Wesley Publishing Company, respectively.
Since Tj?X and METRFONT are frozen, one is not allowed to extend these systems and call them T^X and METRFONT, respectively. However, Knuth has encouraged researchers to extend his systems and to produce new systems. So, we now have many systems that have evolved from the original work by Knuth. The most notable T|hX extensions are Ω, pdfTgX, ε-TgX, and N j'S (A'T' <S stands for New Typesetting System). Ω is a Unicode version of TgX that provides all of the necessary tools for real multilingual typesetting and has been developed by Yannis Haralambous and John Plaice. The program pd fTgX [26], a version of ΤβΧ capable of directly producing PDF
f
output, originally developed by Han The Thanh, is currently being further developed by its original developer, Hans Hagen and Sebastian Rahtz. ε-Τ^Χ [25], a T^X extension that can handle languages written from left to right and languages written from right to left, has been developed by the team that now develops Afq~S, a ΤβΧ extension currently written in Java that will one day replace ΤβΧ (at least that is what the designers hope) and is being developed by Karel Skoupy with assistance by Phil Taylor. Qn the other hand, METRPOST by John Hobby is a reimplementation of METRFONT that produces PostScript output instead of bitmaps, which METRFONT produces.
TgX is a typesetting language (i.e., a programming language specifically designed to ease the generation of beautiful documents). The language has a wide range of commands that allow users to take into account every possible detail of the generated document. However, even expert computer programmers would have a really hard time if they were to produce even a simple document without additional help. Since TpX is a programming language, it offers the ability to define macros (i.e., to define new keywords that will have the combined effect of primitive commands when used). Moreover, T^X is designed in such a way that one can create a collection of macros designed to facilitate the document preparation process. Such macro collections are
1. Available from ftp: //
ftp.dante
.de/pub/tex/systems/knuth/tex.
2. Available from ftp: //
ftp.dante
.de/pub/tex/systems/knuth/mf._______________________________
i.2 L o g i c a l v e r s u s V i s u a l D e s i g n -Φ- 3
known as formats. Knuth himself has designed the plain format, which was quite popular for some time.
Although the plain format is quite useful, there are many things that the casual user has to master in order to write even simple documents. This remark and the fact that the casual user wants to write a letter, a simple article or report, or even a simple book led Leslie Lamport to create the LT^X format. I^TgX allows its user to write very quickly a letter, an article, a report, or even a book. Moreover, when compared to usual word-processing systems, L'TgX has many other advantages, which are the subject of the next section. The present version of LT^X is called LTeX 2g and it is the one that we will present in this book. LT^X 2ε has been developed by a team lead by Frank Mittelbach. When one uses Ω, LTjnX becomes Λ (pronounced lambda), while when one uses pdfTgX it becomes pdfLTEX. Unlike ΤβΧ, L'TgX is not frozen and is the subject of continuous development. The next version of W]hX will be called 1?T]hX3 and will be a substantial improvement of the current version. The main advantages over its predecessor include the unified approach to multilingual typesetting, the simplification of the font access process, and more. For more information regarding the LT^X3 project, the interested reader should consult the LTjiX project Web page at h t t p: //www. l a t ex-pro j e c t. org.
The reader may wonder why the name of the TgX system is written in this way and, moreover, how one should pronounce the name of the system. First of all the system's name is written this way to avoid confusion with TEX, an editor that was very popular by the time ΤβΧ was developed. Second, the letters that make up the TgX logo are the first three letters of the common root of the Greek words τέχνη (art, craft) and τεχνολογία (technology). Consequently, TgX should be pronounced "tekh," where the "kh" is pronounced as in the name Mikhail, and Ι^ΤβΧ might be pronounced "latekh." The letter ε in the Ι^Τ^Χ 2g logo comes from the word έκδοση (edition), so the logo actually means Ι^ΤβΧ second edition. The "La" part in the Ι^ΤβΧ logo comes from the last name of its creator: La(mport)TE>(.
1.2 Logical versus Visual Design
Contrary to common belief, the preparation of a good document is a difficult task. By using an ordinary document preparation system, one is forced to make important decisions about the layout and the structure of the document. Thus, one has to decide on the page format and its general appearance and, at the same time, the text must be organized so that readers will not have any difficulty understanding it. Most common
systems force their users to work on both aspects of the docu- ment preparation process. Certainly, this is not a severe restriction when it comes to the preparation of a nondemanding text. But, if someone has to prepare either a long document or a really demanding document, then this document preparation process may become a nightmare! Hence, it is extremely important for a document prepara­
tion system to assist its users in at least the visual design of their documents. In this
4 ^ 1 In t r o d u c t i o n
way, the writer will concentrate on the logical design of the document and will let the document preparation system do the visual design. The advantage of this approach is that the visual design reflects the logical structure of the document. Systems that have this property are called markup languages. LTgX is a system that pays more attention to the logical design than to the visual design, so it is a markup language. We will now give a simple example by which we hope things will become clearer.
Suppose that Michael wants to write an article about mathematics that will contain formulas and proofs based on these formulas. It is common practice in mathematical text to put a unique number at the end of each equation and to refer to it by this number. If Michael uses an ordinary document preparation system, then he has to manually enter the number for each equation since these systems treat equation numbers as an ordinary piece of text and nothing more. On the other hand, LJTfiX assigns to each equation a number by incrementing the value of a counter (i.e., a computer storage location). Moreover, it provides a facility by which one can easily refer to any number that has been assigned to an equation, a page, and so forth. So, if Michael has the following equation in his article
ein + 1 = 0 (1.1)
and for some reason he decides to insert another equation before it, LT^X will auto­
matically renumber all equations and, more importantly, it will produce the correct references in his text. Of course, if he had opted to use an ordinary document prepara­
tion system, he would have to manually change all references, something that is really error-prone. But things can get even worse. Suppose that Michael submits his article for publication to some journal and they accept it but want him to number equations with Latin numerals. Then he would have to manually change everything, and it is obvious what that means. But if he had opted to use LT^X, he could have made the change by adding just a couple of lines of code.
By emphasizing the logical design of the document preparation process, I^TeX makes its users more productive and, consequently, allows them to concentrate on their real work (i.e., the writing of their text). Moreover, since T^X, as well as all typesetting engines based on TgX, is free software and available for virtually any computing system, ϊ£ΓεΧ gives its users the rare chance to be able to switch between computing systems without any problem.
Web page h t t p: //r i c a r d o. ec n. wf u. e d u/“ c o t t r e l l/w p. html. This Web page is main­
tained by Allin Cottrell.
1.3 Preparing a Document with MgX
The preparation of a document with I^TeX is usually done in two steps. The first involves the use of a text editor by which the user types a manuscript. This usually disappoints newcomers, who are accustomed to the so-called WYSIWYG (What You See Is What
1.3 P r e p a r i n g a D o c u m e n t w i t h -Φ- 5
Y o u G e t ) d o c u m e n t p r e p a r a t i o n s y s t e m s ( i.e., s y s t e m s w h e r e t h e u s e r d i r e c t l y t y p e s t h e t e x t i n t o a s o - c a l l e d g r a p h i c a l u s e r i n t e r f a c e, o r G U I f o r s h o r t ). B u t, a s w e h a v e a l r e a d y e x p l a i n e d, t h i s h a s t h e b i g d r a w b a c k t h a t i t d o e s n o t a l l o w t h e u s e r s t o e a s i l y d o w h a t t h e y r e a l l y w a n t t o d o. H o w e v e r, l e t u s c o n t i n u e w i t h t h e d e s c r i p t i o n o f t h e d o c u m e n t p r e p a r a t i o n p r o c e s s w i t h ETeX. Since ETgX is a markup language, one has to type not only text but also commands, or "tags," that will assist I^TgX in the formatting process. It is important to note that our text must be saved in a plain text file; in other words, the resulting file must contain only the characters that we have typed and nothing more. Thus, users can use even a fancy word processing system to type their text and not just a simple text editor, perhaps because they want to use its spell-checking capabilities, but they must always remember to save their text in a plain text file. Once we have created a text file that contains the ΕΤβΧ source of our document, we are ready to feed it to the ΤβΧ typesetting engine with the I^T]hX format preloaded. If there are no errors in our input file, then ΤβΧ will generate a DVI (DeVice Independent) file, which will contain all of the information that is necessary to either print or view, on our computer screen, the resulting formatted document. However, since this file does not contain the fonts necessary to print or view the document, one has to use a driver program. This program will automatically use the font information contained in the DVI file to correctly produce the formatted output. The viewing program is not standard and depends on the particular ΤβΧ installation. For example, on Unix, people usually view DVI files with a program called x d v i, originally developed by Eric Cooper and modified for X by Bob Scheifler, for XI1 by Mark Eichin, and currently being maintained by Paul Vojta. On the other hand, many TgX installations provide their users with a printing program, but it is common practice to transform the DVI file into PostScript, by using the program d v i p s by Tomas Rokicki, and to print it either on a PostScript printer or on any printer using a PostScript driver such as Ghostscript by L. Peter Deutsch. The following diagram presents the basic document preparation cycle with IATjhX:
The diagram above omits various aspects of the document preparation cycle. For exam­
ple, it does not present the bibliography generation as well as the index and glossary generation. Moreover, it does not present the generation of the various font-associated files. TgX uses the so-called TgX Metric Files (or TFM for short), files that contain the dimensions of each glyph as well as kerning and ligature information for a font, in order to correctly typeset a TgX source file. On the other hand, when one wants to view or print a file, the driver must either generate the so-called packed bitmap files (or PK for short), which contain resolution-dependent bitmaps of each glyph, or include the font outlines. (There will be more on fonts in the relevant chapters.)
6 -φ- ί I n t r o d u c t i o n
In the case where the typesetting engine is pdfETEX, the output file can be either a DVI or a PDF file. If it is a PDF file, this means that we can print or view it directly with Acrobat Reader by Adobe, Inc. Moreover, one can also use Ghostscript since this program can handle PDF files as well. But, now it is time to pass from theory into practice.
On most computing systems, a filename consists of two parts ^the main filename and the filename extension. Usually, these two parts are separated by a period (for ex­
ample, t e x t. doc or t e x t. txt). When one creates a text file that contains L?TeX markup, it is customary to have tex as the filename extension. This way, the user does not have to type the complete filename when the file is fed to TeX. N o w, we are ready to create our first ETeX file.
Using your favorite text editor, create a text file that will contain the following four lines:
\documentc l a s s { a r t i c l e }
\begin{document}- Hello from \LaTeXe!
\end{document}
For the moment, you should not pay any attention to what you have typed. Now, suppose that the resulting text file is called example. tex. If we enter the following command at the prompt (e.g., an MS-DOS prompt of Microsoft Windows or a Unix xterm), ETeX will process our file and it will generate, among others, a DVI file:
$l a t e x example This i s TeX, Version 3.14159 (Web2C 7.3.1 ) (example.t e x LaTeX2e <2000/06/01> Babel <v3.6k> and hyphenation p a t t e r n s f o r american, e n g l i s h, greek, loaded. (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/a r t i c l e.e l s Document Cl ass: a r t i c l e 2000/05/19 v l.4 b Standard LaTeX document c l a s s (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/s i z e 1 0.c l o ) ) (example.aux) [1] (example.aux) ) Output w r i t t e n on example.dvi (1 page, 368 b y t e s ). T r a n s c r i p t w r i t t e n on example.log. Note that the$ sign indicates the system prompt; for example, in MicroSoft Windows this might be C: \. So what follows this sign, on the same line, is what the user enters. Moreover, the program output has been slightly modified so that it can fit the page, and this applies to all of the program output that follows. In the program output above, we can easily identify the versions of both TeX and ETeX that we are using. Furthermore, the system lets us know that it has created three files with main filename example and
1.3 P r e p a r i n g a D o c u m e n t w i t h -Φ- 7
f i l e n a m e e x t e n s i o n s a u x, d v i, a n d l o g. T h e a u x f i l e c o n t a i n s a u x i l i a r y i n f o r m a t i o n t h a t c a n b e u s e d f o r t h e c r e a t i o n o f t h e t a b l e o f c o n t e n t s, a m o n g o t h e r t h i n g s. T h e d v i f i l e i s t h e D V I f i l e t h a t T g X h a s j u s t g e n e r a t e d, a n d t h e l o g f i l e c o n t a i n s l o g i n f o r m a t i o n t h a t i s u s e f u l f o r d e b u g g i n g p u r p o s e s i n c a s e t h e r e i s a n e r r o r i n o u r ETeX source file. TgX indicates its progress by printing a left square bracket and the number of the page that it will start to process. When the page is shipped out to the DVI file, it prints a right square bracket. The total number of pages successfully processed as well as the total size of the DVI file appear at the end.
Since we have managed to successfully generate the DVI file, it is now possible to create a PostScript file from it by using the d v i p s driver:
$dvips example This i s dvips(k) 5.86 Copyright 1999 Radical Eye Software ( www.r a d i c a l e y e.com ) ’ TeX output 2000.10.08:0100’ -> example.ps <texc.pro>. [ 1] In cases where the d v i p s driver cannot find the necessary PK files, it will try to generate them:$ dvips example
www.r a d i c a l e y e.com
)
’ TeX output 2000.10.10:1241’ -> example.ps kpathsea: Running mktexpk —mfmode l j f o u r —bdpi 600 —mag 1+0/600 —dpi 600 cmrlO
mktexpk: Running mf \mode:= l j f o u r; mag:=1+0/600; nonstopmode; i nput cmrlO
This i s METAFONT, Version 2.7182 (Web2C 7.3.1 )
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/c m r l O.m f (/u s r/l o c a l/te T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/c m b a s e.m f ) (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m a n.m f (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m a n u.m f [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78]
[79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m a n l.m f [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109]
[110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120]
[121] [122])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/g r e e k u.m f [ 0 ]
[1] [2])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m a n d.m f [ 4 8 ] [ 4 9 ] [ 5 0 ] [ 5 1 ] [ 5 2 ] [ 5 3 ] [ 5 4 ] [ 5 5 ] [ 5 6 ] [ 5 7 ] )
8 -φ- ί I n t r o d u c t i o n
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/fo n t s/s o u r c e/p u b l i c/c m/r o m a n p.m f [36] [38] [63] [62])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m s p l.m f [16] [17] [25] [26] [27] [28])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m s p u.m f [29] [30] [31])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/p u n c t.m f
[33] [60] [35] [37] [39] [40] [41] [42] [43] [44] [46] [47] [58] [59]
[61] [64] [91] [93] [96])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/a c c e n t.m f [18] [19] [20] [21] [22] [23] [24] [32] [94] [95] [125] [126] [127])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/r o m l i g.m f [11] [12] [13] [14] [15])
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/f o n t s/s o u r c e/p u b l i c/c m/c o m l i g.m f
[34] [45] [92] [123] [124]) ) )
Font m e t r ic s w r i t t e n on cmrlO.tfm.
Output w r i t t e n on cmrl0.600gf (128 c h a r a c t e r s, 24244 b y t e s ), mktexpk: /v a r/t m p/t e x f o n t s/p k/l j f o u r/p u b l i c/c m/c m r l O.600pk: s u c c e s s f u l l y gen erat ed.
<texc.pro>. [ 1]
As we see from the program screen output, d v i p s could not find the PK at the re­
quested resolution for the font cmrlO. So, d v i p s calls METflFONT to generate the missing font. Once the PK file is successfully generated, d v i p s resumes and generates the final PostScript file. In case we want to generate a resolution-independent PostScript file, we have to configure the file psf ont s. map so that the d v i p s will embed the outline font files into the final PostScript file (details will be discussed later);
$dvips example This i s dvi ps(k) 5.86 Copyright 1999 Radical Eye Software ( www.r a d i c a l e y e.com ) ’ TeX output 2000.10.10:1241’ -> example.ps <texc .p r o X t exps . p r o>. <cmmilO. pfb><cmr7 .pf b X cmrlO. pf b> [1] The PFB file is a binary PostScript outline font file. The corresponding nonbinary or ASCII files are called PFA files. Sometimes, the driver fails to embed the outline font files, although it has been configured to do so and the files are part of our T^X installation. In this case, the - j 0 switch for d v i p s usually resolves the problem. If we want to view a DVI file that uses PostScript fonts, then x d v i calls g s f t o p k by Paul Vojta to generate PK files from the font outlines since x d v i can handle only PK files. Note that the latest versions of x d v i are capable of rendering PostScript fonts directly without using GSFTOPK. 1.3 P r e p a r i n g a D o c u m e n t w i t h -Φ- 9 I i w e h a d o p t e d t o u s e 6- T £ TeX, t h e r e s u l t i n g D V I f i l e w o u l d h a v e b e e n i d e n t i c a l t o t h e o n e p r o d u c e d b y I^T^X since ε-ΤβΧ operates identically to TgX if we do not use its extended capabilities:$ e l a t e x example.tex
This i s e-TeX, Version 3.14159-2.1 (Web2C 7.3.1 )
(example.tex LaTeX2e <2000/06/01>
Babel <v3.6k> and hyphenation p a t t e r n s f o r american, e n g l i s h, greek, loaded.
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/a r t i c l e.e l s Document Class: a r t i c l e 2000/05/19 v l.4 b Standard LaTeX document c l a s s
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/s i z e l O.c l o ) )
No f i l e example.aux.
[1] (example.aux) )
Output w r i t t e n on example.dvi (1 page, 368 b y t e s ).
T r a n s c r i p t w r i t t e n on example.log.
If we had opted to use pd ίΙ^ΤβΧ, the output would be a PDF file:
$p d f l a t e x example This i s pdfTeX, Version 3.14159-13d (Web2C 7.3.1 ) (example.t e x [/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/p d f t e x/b a s e/p d f t e x.c f g ] LaTeX2e <2000/06/01> Babel <v3.6k> and hyphenation p a t t e r n s f o r american, e n g l i s h, greek, loaded. Configured f o r p d f t e x use [1997/11/26] (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/a r t i c l e.e l s Document Class: a r t i c l e 2000/05/19 v l.4 a Standard LaTeX document c l a s s (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/s i z e l O.c l o ) ) (example.aux) [ 1 [/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/p d f t e x/b a s e/s t a n d a r d.m a p ] ] (example . aux) ) CcmmilO .pfb><cmr7 .pfbXcmrlO .pfb> Output w r i t t e n on example.pdf (1 page, 15680 b y t e s ). T r a n s c r i p t w r i t t e n on example.log. Since pd ίΙ^ΤβΧ embeds the necessary fonts into the resulting PDF file, the screen output lets us know which fonts pd fl^T^X has embedded into the PDF file. Of course, it is possible to create PDF files from PostScript files directly by using the program p s 2 p d f. This program is actually an application of Ghostscript and can only be used on a command line. ίο ·φ· ί I n t r o d u c t i o n In the case where we are using A, the source file can be a Unicode file and not just an extended ASCII file. In any extended ASCII file, we are allowed to type up to 256 different characters, while in a Unicode file we are allowed to type up to 65,536 different characters. So, we can directly type text in any possible language. We will elaborate on this subject in Chapter 10, which presents the multilingual capabilities of l^T^X/A. Let us see now what the screen output will be when we use A:$ lambda example
This i s Omega, Version 3.14159—1.8 (Web2C 7.3.1 )
Copyright (c) 1994—1999 John P l a i c e and Yannis Haralambous (example.t e x LaTeX2e <2000/06/01>
Hyphenation p a t t e r n s f o r american, e n g l i s h, greek, loaded. (/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/a r t i c l e.e l s Document Cl ass: a r t i c l e 2000/05/19 v l.4 b Standard LaTeX document c l a s s
(/u s r/l o c a l/t e T e X/s h a r e/t e x m f/t e x/l a t e x/b a s e/s i z e 10.c l o ) )
(example.aux)
[1] (example.aux) )
Output w r i t t e n on example.dvi (1 page, 392 b y t e s ).
T r a n s c r i p t w r i t t e n on example.log.
Although the output file is called example. dvi, it is not a DVI file but rather an QDVI file. This new file format is actually an extended DVI file in which Ω can store infor­
mation regarding Unicode fonts, writing directions, and so on. Because of this fact, one needs special drivers to handle the resulting HDVI files. To generate a PostScript file, one has to use the o d v i p s driver:
$odvips example This i s (Omega) odvips(k) 5.86 Copyright 1999 Radical Eye Software ( www.r a d i c a l e y e.com ) JOmega o u t p u t, Version 3.14159—1.8, 2000.10.08:1227’ -> example.ps <texc.pro>. [ 1] On the other hand, if we want to view an HDVI file we have to use the o x d v i driver. 1.4 How Does T^X Typeset? A typesetting system has to perform many operations in order to yield excellent output. One of its chief duties is to take a long sequence of words and break it up into individual lines of the appropriate size. In order to do this successfully, the system has to find the best breakpoints. TgX initially takes a paragraph and tries to find these breakpoints without employing the hyphenation mechanism that is available. If this is not possible, 1.5 M ore In f o r m a t i o n a n d Re s o u r c e s -Φ- 1 1 then it hyphenates all words according to the hyphenation patterns that are built into a particular format file and then tries to find the breakpoints, which of course in some cases will be in the middle of a word. Of course, we can instruct TgX to avoid breaking a line at specific points. In certain situations, T]hX fails to produce a line of the appropriate size. If the line is longer than this size, we have an overfull box. On the other hand, if the line is shorter, we have an underfull box. Things are even more difficult for page breaks. TgX usually guesses what would be the ideal breakpoint. This is mainly related to the fact that when TgX was designed, computer memory was an expensive resource and of very limited size. Most certainly, new typesetting systems could deal with this drawback, but since TgX decides page breakpoints in a very reasonable way, there has not been any significant progress on the matter. Another interesting aspect of TgX's functionality is that it treats each character as a little box that can be virtually placed everywhere on the page (see page 39). This way, one can achieve interesting results such as the following alternative dollar symbol$, which is not usually available in most widely available fonts.
T]hX is a typesetting system that has attracted the attention of many people. Moreover, since it is an extremely flexible system, many people work on the creation of TgX ex­
t
ensions and the development of new macros or formats that aim at facilitating the document preparation process. This fact had led a group of people to create the TgX Users Group (TUG for short), a nonprofit organization dedicated to the promotion and further development of T^X and its descendants. TUG publishes the quarterly newsletter TUGboat, which features refereed articles on various aspects of digital ty­
pography with T]hX. More information on TUG can be found at their Internet site: h t t p: //www. t u g. org. Since ΤβΧ is also heavily used by non-English-speaking people, there are many LUGs (i.e., local TgX users groups) that are dedicated to the promotion of digital typography with TgX in their respective countries and the development of tools that facilitate the preparation of documents in their respective languages. More
information on these groups can be found at h t t p: //www. t u g. o r g/l u g s. html. Most of these groups publish newsletters similar to TUGboat; for example the Greek TgX Friends publish the semi-annual newsletter Εντυπον, NTG, the Dutch group, pub­
lishes the semiannual newsletters MAPS, and GUST, the Polish group, publishes a
TeX users group and/or of TUG.
any computing system, TpX packages, and fonts from either f t p://f t p.d a n t e.d e/
t e x - a r c h i v e (maintained by DANTE, the German group), f t p://f t p.t e x.a c.u k/
t e x - a r c h i v e (maintained by UKTUG, the UK group), or f t p://c t a n.t u g.o r g/
12 ·& i I n t r o d u c t i o n
tex-archive (maintained by TUG). These three sites constitute what is commonly known as the "Comprehensive TgX Archive Network," or CTAN, for short. Moreover, most T^X groups have mailing lists where people can ask questions regarding any­
thing related to TgX. The Usenet newsgroup comp, t e x t .t e x is the official ΤβΧ forum for advanced and novice users. However, before sending any question to this group, you are strongly advised to consult the ΤβΧ Frequently Asked Questions Web page at h t t p: //www. t e x. a c. u k/c g i - b i n/t e x f aq2html. Finally, we suggest that you might like to have a look at the I^T^X Navigator site at h t t p: //t e x. l o r i a. f r/t e x.
2 ------------
T h e Fi l e St r u c t u r e
In this chapter, we describe the general structure of a Ι5ΓεΧ/Λ file. Since a Ι^Τ^Χ/Α file is composed of characters, we elaborate on the characters that one is allowed to type into a valid file and present some special characters with a predefined meaning. Next, we present the concept of a document class, the standard IiT^X classes, and the classes provided by the American Mathematical Society. Furthermore, we discuss how one can create the title of a document and a title page. Next, we present how one can get some of the standard logos that are frequently used in the T^X world. We continue by presenting a real-world I^T^X file and conclude with the presentation of a package that allows the combination of several I^TgX files into a single document.
2.1 The Characters We Type
A user communicates with a computer by either typing in letters, digits, or symbols or by using some pointing device (e.g., a mouse). In the first case, these letters, digits, and symbols are collectively called characters. Each character is internally encoded as a sequence of binary digits (i.e., the digits "0" and "1") of a fixed length. This means that each character is equal to some number and, consequently, one can compare characters. Early computing systems provided only uppercase English letters, digits, a few sym­
bols, and some special characters, such as the newline character, the end of file character, and so on. This limitation was imposed mainly because computers at that time had lim­
ited memory. Soon, people realized that they could not type in an ordinary English text with this limited character set, so, as computer technology advanced, computer manu­
facturers proposed new, larger character sets. The ASCTI (American Standard Code for Information Interchange) character set was the one adopted by most computer manu­
facturers. ASCII contains 128 characters and includes all English letters in both cases, the ten digits, all symbols that are on a common keyboard, and 32 control characters. However, as computers became available to non-English-speaking people, there was a need to provide extended character sets so that non-English-speaking people could
1 4 ^ 2 T h e F i l e S t r u c t u r e
type in texts in their own languages. This fact led the various national standards or­
ganizations to define extensions of ASCII that contained at most 256 characters. These extended ASCII character sets were approved by the International Standards Organi­
zation, and now each of them has a unique name. For example, ISO-8859-7 is the name of the extended ASCII used in Greece. Similarly, ISO-8859-9 is the one used in Turkey, ISO-8859-1 the one used in Western Europe, and ISO-8859-5 is the default character set in countries that use the Cyrillic alphabet. Although people can write texts in their own language, it is still difficult to exchange files containing characters belonging to some extended ASCII. The main reason is that characters above 127 (i.e., the numbers that represent these characters are greater than 127) are not the same in two different extended ASCIIs, so it was necessary to define a new character set that would contain all possible letters, symbols, ideograms, and so on, in order to allow data exchanges without any problem. This necessity led to the definition of the Unicode character set. Unicode does contain all of the necessary characters to correctly type in a text in any lan­
guage currently in use but also many mathematical symbols, characters not presently in use, such as the accented vowels of polytonic Greek, and many symbols that are in common use such as the symbol ®. Of course, one is also allowed to have characters from different languages in the same file (e.g., it is possible to have Japanese, Greek and Arabic text in the same file). Unicode provides for two encoding forms: a default 16-bit form called UCS-2 and a byte-oriented form called UTF-8. The Unicode standard ver­
sion 3.1 is code-for-code identical with International Standard ISO/IEC10646. If we use the 16-bit form, we can encode more than 65000 characters, while if we use the UTF-16 extension mechanism, we can encode as many as 1 million additional characters. The reader interested in learning more about Unicode may consult the relevant Web page at h t t p://www.Unicode.org
.
TgX is a typesetting engine that can handle only files that contain characters be- longing to some extended ASCII character set. For this reason, it is not particularly well-suited for multilingual document preparation, especially when it comes to lan­
guages that do not use the Latin alphabet. On the other hand, Ω is a typesetting engine that can handle Unicode files, so it is particularly well-suited for multilingual document preparation.
Although a LTgX
file can contain ASCII characters and a A file can contain Unicode
characters, there are a few characters that cannot be typed in directly as they have a predefined meaning. These characters are the following ones:
#$%&"_ ~ \ { > Let us now explain the special meaning of each of these characters. The character # (called sharp) is used to name the parameters of a parametric macro. However, this mechanism is primarily used in plain TgX and by people who create new formats and packages. The character$ (called dollar) is used to designate that one wants to write mathematical formulas. The same symbol is used to designate the end of mathematical text. The character % (called percent) is used to write comments (i.e., a sequence of characters that is completely ignored by Ι^ΤβΚ). When we place the % character in a line,
2.1 T he C h a r a ct e r s W e T y pe -φ 1 5
ΐ^ΤβΧ ignores this character and everything to the right up to the end of the current line. Moreover, in certain cases, it prevents the typesetting engine from putting in some unwanted white space. The character & (called ampersand) is used in the construction of tables. The character ~ (called tilde) usually stands for an unbreakable space; that is, if we put it between two character sequences without any space before or after it (e.g., Figure" 1) ΤβΧ will not attempt to put these two sequences on different lines or pages. However, in certain cases, it does not act like an unbreakable space. Such a case occurs when one prepares a manuscript in polytonic Greek. The characters _ (called underscore) and ~ (called circumflex) are used to enter subscripts and superscripts in mathematical formulas, respectively. The characters { (called left brace) and > (called right brace) are used to define what is called in Computer Science a local scope (i.e., a place where all changes are local and do not affect the rest of the code). Readers familiar with C, Java, or Perl programming will identify this mechanism with the block structure provided by these languages. The character \ (called backslash) is the escape character (i.e., a character that makes special characters nonspecial and vice versa). For example, when it is in front of a word, the word is treated as a command. Certainly, there are some things that may not be clear at the moment, but they will become clear as we proceed. Now, since these characters are special and one is not allowed to type them in directly, the question is: "How can we type in these characters in a I^TgX file"? The answer is given by the following table:
Symbol
Command
Symbol
Command
#
%
Λ
\#
\%
\t e x t a s c i i c i r c u m
\t e x t a s c i i t i l d e
$& \ \$
\&
\_
\t e x t b a c k s l a s h
{
U
}
\>
Thus, in order to get 40% off, we have to type in the characters 40\% off.
>· Exercise 2.1 What are the characters that one has to type in to get the following sentence:
A2$, we w i l l get ((n + 1 ) j n) , whi ch is not as satisfactory. Here, we w ant to force M e K to make the size o f the external parentheses bigger. The \l e f t and \r i g h t com­ mands do not fail, they do p ro pe r l y enclose the expression that they surround. The problem is w i t h our aesthetics, w h i c h require bigger parentheses since the inner ex­ pression also uses parentheses and not because the inner part creates a larger box that the external parentheses failed to surround. The correct i n p u t f o r this task is$\b i g l ( ( n + l )/n \b i g r ) ~2$. LTgX provides the f o l l o w i n g commands f o r predeter­ m i n i n g the size o f a delimiter:$\B i g g l ( \b i g g l ( \B i g l ( \b i g l (
\ \b i g r ) \B i g r ) \b i g g r ) \B i g g r ) $The same commands w o r k f o r a ll delimiters lef t or right. Another application o f this f a c i li t y is when w r i t i n g b ig operators such as \sum. I n the next display, the second expression (which used \b i g g l ( \b i g g r ) parentheses) looks better than the fi r s t (which u s e d\l e f t ( \r i g h t ): \ 1/2 / 00 \ 1/2____________________________________ Ι>») (Σ>») · . i— 1 / 2—1 There are some delimiters though that do not come i n pairs, such as the character /. For these, the commands are 4/5/6/ 7/8$3\Biggm/ 4\b i g g m/ 5\B i g m/ 6\b i g m/ 7/8$5.4.1 1 C o m m u t a t i v e D i a g r a m s Commutative diagrams are often used i n mathematics to depict a relation between mathematical entities. I n this section, the term "d i a g r a m" w i l l stand f o r commutative diagram. There are several ways that one can d r a w diagrams. One o f them is presented as part o f the Am.S packages i n Section 5.5.16. However, this is not a complete solution since i t cannot produce diagonal arrows. A complete solution is p rovided by the kuvio package of A n d ers Svensson and t h e pb- diagram package o f Paul Burchard. 54 T h e A r t o f T y p e s e t t i n g M a t h e m a t i c a l Τ ε χ γ Φ · 127 Both packages w o r k w i t h a conceptual g r i d and attach nodes and arrows to it. The pb-diagram package provides the environment diagram. The two main commands are \a r r o w and \node. The syntax of the command \a r r o w is like this: \a r r o w { x The { χ, y> show the direction of the arrow. The parameter x can take all of the cardinal points o f the compass; that is, i t can be e (for east), w (for west), s (for south), and n (for north) and their intermediate positions: ne, nw, se, sw, nne, nnw, sse, ssw, ene, ese, wnw, and wsw. I f pb-lams is used, we have additional directions available. These are nee, see, nww, sww, neee, mine, nnnw, nwww, swww, ssse, seee, nnnee, nnnww sssww, sssee, nneee, nnwww, sswww, and sseee. The argument y sets the position of the label z w i t h respect to the arrow. I t can be t (for top), b (for bottom), 1 (for left), and r (for right ). The \a r r o w command can be used w i t h a dditional arguments: \a r r o w [ s ] { χ,y 1,y 2 } { z > or \a r r o w [ s ] { χ, y 1, y 2 > { z l } { z 2 > I n the second case, we have t w o labels: the z l and z2 that are set above and below the a rrow ( y l = t b ) or lef t and r i g h t ( y l = l r ). The y2 argument i n both o f the syntaxes above specifies the a r r o w shaft head and ta i l to be used. Most of the f o l l o w i n g options are available i f either the pb-lams or the pb-xy package is used. Shafts can be .. f o r dotted lines, = f o r double lines, and ! fo r invisible lines. The head can be - f o r no arrowhead, <> fo r arrowheads at both sides, A for double arrowhead, ’ fo r lef t h a lf arrowhead, and ‘ f o r r i g h t h a lf arrowhead. The t a i l can be V f o r single arrow tail, J f o r l ef t hook arrow tail, and S f o r square a r r o w tail. The s i n the optional argument sets the number of columns or rows that the arrow w i l l span. The position o f the label on the a rr ow length can be set b y d i v i d i n g the arrow int o a number of pieces, adding a y3 argument to hold the a r r o w shape information, and g iv i n g to the y2 option the number o f the piece on w h i c h the label w i l l be set. The d i v i s i o n is done b y setting the \dgARROWPARTS (by default, \dgARR0WPARTS=4; thus, the y2 can be 1, 2, 3, or 4). The \node command is used i n the fo r m \n o d e { n o l s } { f ormula}, where n c o l s is a number that sets how many columns after the last node the f o r m u l a w i l l be set. The typesetting of diagrams is w r i t t e n i n rows, and we move to the next r o w b y \\. Here is a simple example: \b e g i n { d i s p l a y m a t h } - x — > y V \b e g i n { d i a g r a m } \n o d e { X }\a r r o w { s, l M p } \a r r o w { e,t,.->{g> \n o d e { Y }\a r r o w { s,r } { q }\\ \n o d e { A } -\a r r o w { e,b,. .M r } · A B \node{B}- \end{diagram}- \e n d { d i s p l a y m a t h } and here is a rather complex example (we used the lamsarrow, pb-lams, and pb-diagram packages): 128 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s A\ ---------------------> A2 The code f o r this (and i t w i l l be good f o r the reader to study it) is$ $\b e g i n { d i a g r a m } \node [ 3 ] {A_l}- \a r r o w [2] { e, \node [2] - fA_2}\arrow [2] { s, ’ }\\ w \node-[ B_l}-\arrow [2] { n e, 1, =}-Cb_l}-\arrow-Ce, t, - } { b _ 2 } - \n o d e { }\a r r o w { e ,b)-[b_3}-\node-[B_2}· \a r r o w [2] { n,r, . -!Kb_4} \a r r o w [2 ] { e,t, J}{b_5}-\node [2] {B_3)-\arrow [2] { s w, L }\\ w \node{C_l}- \a r r o w [ 2 ] { n n e,l,l } - { c _ l ) - \a r r o w [ 2 ] {n e,r } - { c _ 2 ) - \node [ 2 ] {C_2}-\arrow [2 ] { w, t, <>, . . }"Cc_3)-\arrow [2 ] { e, t, A}-[c_43· \a r r o w [2 ] { η, l r, S}{c_5}-[c_6}· \node [2] {C_3}- \end{diagram}-$$I f these capabilities o f the pb-diagram package are not enough for the user (and this can happen), then, most probably, the capabilities of the kuvio package w i l l cover the reader's needs. This is a b i g p la i n T^ X macro package w i t h a Ι^Τ^ Κ w rapper package. The reader can check the documentation of this package, whi ch provides more features than simply diagrams. For example, i t provides some a dditional math symbols, i nc l u d in g a circle symbol f o r composition of functions (the \c i r c command produces a circle that is too b ig f o r compositions). The package documentation can be found at f t p: //f t p. math. u b c. c a/p u b/s v e n s s o n/k u v i o/ w it h n a m e td w k-A4. p s. gz or t d w k. p s. gz. The package itself is available fr o m the CTAN. 5.5 The Λ/^φ Classes and Packages The Aj\z(S document classes amsart, amsbook, and amsproc fo r articles, books, and proceedings, respectively, provide a much better control f o r mathematical text than the standard document classes. This is w h y these are usually the preferred classes f o r texts containing a l o t of mathematics. I n a m u l t i l i n g u a l environment, the classes have a problem w i t h accented letters i n the r u n n i n g heads. The problem is solved i f one uses t h e t extcase package b y Davi d Carlisle. Actually, t h ese classes p r o v i d e t h e 5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 1 2 9 same f u n c t i o n al i ty as the amsmath package plus the document design characteristics o f the Aj\/{S publications. So, one may either d ire c t ly use one o f these classes or load the amsmath package w i t h any other class. Note that this package defines the \AmS command, w h i c h print s the Aj ^S logo. In the fo l lo w i ng, we discuss the features provided b y the amsmath package plus some a dditional packages provided b y the Aj^S, such as amsthm f o r customizing theorem environments and amscd f o r commutative diagrams. Since these are loaded b y the Α μ § document classes, w h a t we w i l l say is v a l i d f o r both strategies {Aj ^S classes or any class plus amsmath and other Aj ^S packages). We w i l l refer to either of these strategies by saying "t h e Aj\4S packages." Information about these classes can be found i n the Aj ^S documentation o f the ^ V f £ _^T|i>( d istributi on, as these packages and classes are usually called. I n version 2.0 the file to look at is i n s t r - 1. d v i, whi ch presents useful i nf ormat ion about article preparation f o r journals and describes also the commands f o r t i t l i n g (which are very similar to the standard a r t i c l e class o f I ^ Ie X). I f y o u r system has already installed these classes, this file is usually i n t e x m f/d o c/l a t e x/a m s c l s/. 5.5.1 A d d i t i o n a l S y m b o l s The Am.S packages p rovide bo ld symbols, Greek letters included, through \b o l d s y m - b o l. Also, i ta li c capital Greek letters are p rovided b y using the letters "v a r" between the backslash and the name of the Greek letter. For example, \b o l d s y m b o l {\p i }\b o l d s y m b o l {\i n } \v a r P s i gives π 6 Ψ. They also provide w ha t is k n o w n as "p o o r man's b o l d" f o r cases where the \b o l d - symbol command does not do anything (due to the lack of a bold g lvp h o f the symbol needed). The poor man's b o ld command is \pmb and simulates bold b y t y p i n g several copies of the symbol we want w i t h slight offsets. Here are a few examples: \b e g i n { d i s p l a y m a t h } Σ Π ν \pmb{\sum}-\pmb{\prod}- _______________________________________\p mb {\b i g vee j - Accents are also supported i n bold. The command \mathbf {\t i l d e { A } } - w i l l produce the r i g h t (bold) accent above the bold A i n I ^ X: A. But w i t h the Α\φ packages we w i l l get the r i g h t t h i n g even fo r \m a t h c a l {\v e c { A } } (A). Alternatives to \mathbb and \m a t h f r a k are also provided, and they are \Bbb and \f r a k, respectively. They are useful when the standard IffT]gX commands have been redefined (as i n the case of the mathbbol package). 5.5.2 A c c e n t s i n M a t h The Ajv[S packages p rovide better accents f o r math mode. The advantage is clear when one wants to use double accents. One should compare t h e following: 13 ° ^ 5 T y p e s e t t i n g M a t h e m a t i c s standard Τ^ΤβΚ \hat{\hat A} : A, A Μ β \hat{\hat A> : A. The same holds true f o r all other accents (see Table 5.3). Double accents take a l o t of processing time, and this is why, i f we use them repeatedly, i t is better to store the result of a double accent to a command using the \accentedsymbol available w i t h the amsxtra package. This command introduces a shorthand and should be used only i n the document's preamble. Here is an example: \accentedsymbol{\Ahathat)-{7o \hat{\hat{A>}} \accentedsymbol{\Ybrevedot}"C% A and Y \dot-[\breve{Y)·}·} \A h a t h a t and \Ybrevedot The commands \d d d o t and \d d d d o t produce t r i p l e and quadruple dot accents i n ad­ d i t i o n to the \d o t and \d d o t accents (which are already available w i t h standard I^TgX): \d d d o t { E } and \d d d d o t { T } give E and T, respectively. Special symbols that are set as superscripts f o r m another k i n d of accent. These are useful i n math (for instance the Fourier transform uses a \h a t as superscript unless the function is a single letter or a few letters). For example, \b i g l (\e x p ( - x ~ 2 )\b i g r )\s p h a t gives ( e x p ( —x2)^j . Notice that we do not use the Λ character. The reader is recom­ mended to t r y the commands \spcheck, \s p t i l d e, \s p d o t, \s p d d o t, \sp d d d ot, and \sp b r e v e. A l l of them are available w i t h the amsxtra package. 5.5.3 D o t s The Aj vfi packages pr ovide five commands f o r accessing d if fe re nt ly positioned ellipsis dots, \d o t s c represents "d o ts w i t h commas" l ik e this 1,2,...,n ( l,2,\d o t s c,n ). \d o t s b stands f o r "d o t s w i t h binary operator s/relations" as i n 1 + 2 + · · · + « (1+2+ \d o t s b +n). \dotsm. stands fo r "m u l t i p l i c a t i o n dots" as i n αια2 · · · α η (a_l a_2 \d otsm a_n). \d o t s i stands for "d ots w i t h i n t egra ls" as i n f A f B - · · (\i n t _ A\i nt_B \d o t s i ). Finally, \d o t s o covers "o t h e r dots," w hi c h are none of the above: a .. .b + ... + c ( a\d o t s o b +\d o t s o +c). 5.5.4 N o n b r e a k i n g D a s h e s There are cases (such as when we give the page range of a reference) when we do not w ant to a ll o w a line break at the en dash point. This can be done w i t h the command \nobreakdash. So, i f you w r i t e "pages 321-345" as pages 321\nobreakdash—345, a line break w i l l never occur between the dash and 345. The command can also be used f o r combinations such as p - a d i c. Naturally, one can define shorthands f o r commonly used constructs, b u t this is t h e subject of th e n ex t chapter. 5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 1 3 1 5.5.5 O v e r a n d U n d e r A r r o w s Standard I^TgX, as we have shown i n Section 5.4.3, provides the commands \o v e r - r i g h t a r r o w and \o v e r l e f t a r r o w. Some additional commands i n c l u d in g underarrows are n o w available. A l l o f them are as follows: \o v e r l e f t a r r o w \u n d e r l e f t a r r o w \o v e r r i g h t a r r o w \u n d e r r i g h t a r r o w \o v e r l e f t r i g h t a r r o w \u n d e r l e f t r i g h t a r r o w For example, \u n d e r l e f t a r r o w { x y } ’'{\o v e r l e f t r i g h t a r r o w { z w » gives xyzw. Note: This is not to be used f o r projective l imits. See Table 5.5.12. 5.5.6 M u l t i p l e I n t e g r a l S i g n s The commands \i i n t, \i i i n t, and \i i i i n t give m u l t i p l e integral signs w i t h nice spacing between them i n both text and display styles. The command \i d o t s i n t gives t w o integral signs w i t h ellipsis dots between them. Also, the domain of integration is set nicely below these signs i f the \l i m i t s command is w r i t t e n immediately f o l l o w i n g the integral command: JJ f { x,y ) d x d y JJJ f ( x,y,z ) d x d y d z x x f ( x,y,z,w) d x d y d z d w J J f ( x^' · · *' xk) x x The code that generates these formulas has the f o l l o w i n g general pattern: \ ( i i i ) i n t\l i m i t s _ X 5.5.7 R a d i c a l s A better control f o r the placement of the root index is p rovided through the commands \l e f t r o o t and \u p r o o t. These commands shift the index of the root, g iv i n g a better appearance i n certain circumstances. I n the f o l l o w i n g example, we move the letter μ 3 units u p and 1 to the right: \s q r t [\mu] -f\nu")- V u \s q r t [\l e f t r o o t { - l 3 -\u p r o o t { 3 }\m u ] {\nu)- 132 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s 5.5.8 E x t e n s i b l e A r r o w s The commands \x l e f t a r r o w and \x r i g h t a r r o w provide extensible arrows i n order to accommodate expressions above and below them: f(x) ^ 1 x ^ c o 0\x l e f t a r r o w { x\t o -\i n f t y > f ( x ) \x r i g h t a r r o w [ x\t o\i n f t y ] { x\n o t i n\m a t h b b { Q } - } - 1 5.5.9 A f f i x i n g S y m b o l s t o O t h e r S y m b o l s St andar d I^TgX p r o v i d e s t he \s t a c k r e l c o mman d f o r p l a c i n g so me t h i n g above a b i n a r y r e l a t i o n. The Aj\/iS packages p rovide more general commands, \o v e r s e t and \u n d e r - s e t. These w o r k w i t h anything and not only w i t h b in a r y relations: O X \o v e r s e t - C\c i r c } {\t e x t r m { X } } X \u n d e r s e t {\a s t } {\t e x t r m { X } } * 5.5.1 0 F r a c t i o n s a n d R e l a t e d C o n s t r u c t s The command \g e n f r a c provides an easy interface to define new fractions. Its syntax is as follows: \g e n f r a c { l ef t - del i m} { r i ght - del i m} - {. l i ne - t hi c k ne s s } { dt yl e} { numerat or} { denomi nat or} The lef t and r i g h t d e li m it e r s are used, f o r example, f o r b inomial expressions. The line thickness refers to the fraction line and is set to 0 p t f o r b inomial expressions. To select the style, we use a number f r o m 0 to 3. The number 0 is f o r display style, 1 fo r text style, 2 f o r script style, and 3 fo r script-script style. By default, the f o l l o w i n g commands are defined: Command Expansion \t f r a c { x H y > \g e n f r a c O O - C H l H x H y } \d f r a c { x } { y } \g e n f r a c O O - C H 0 H x H y } \binom-Cx}--Cy} \g e n f r a c { ( > { ) H O p t H H x H y } \dbinom{x)-{y)- \g e n f r a c { ( > { ) K 0 p t > { 0 > { x > { y > \tbinom-[x)"Cy)- \g e n f r a c { ( > { ) H O p t H l H x H y } The commands \t f r a c and \d f r a c p r ovide convenient abbreviations f o r {\t e x t s t y - l e\f r a c {. .} {. .} > and {\d i s p l a y s t y l e\f r a c {. .} {. .} }, respectively. Here is an ex­ ample: 5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 1 3 3 ^ l o g J \t f r a c { l > { x >\l o g x$$$ \d f r a c { l } - [ x }\l o g x$$Here is an example o f \dbinom and \t b i n o m: l logX$$\dbinom{n)-{k)-+ \f rac-C\tbinom{n3"[k}-3-[k! }$$The special command \c f r a c is f o r w r i t i n g continued fractions:$$ 1 \c f r a c { l } { a + \c f rac{l}"Ca+ \c f rac-[l}-Ca+-C \aboveOpt \ddots}- » > Λ + a + d “I- . You can request that the numerators to be set to the lef t or r i g h t of the fraction line. This is accomplished b y using \c f r a c [1] or \c f r a c [ r ]. 5.5.1 1 T h e \s m a s h C o m m a n d The \ smash command zeros the depth (option b) or height (option t ) of characters and is useful fo r alignments. I n the f o l l o w i n g example we present t w o dif ferent formulas typeset using the \ smash command (odd rows) and w i t h o u t using the \ smash command (even rows). The reader should have a close look at the result to see the difference. v ^ “i- V y “i- V% ^ + Vv + _______________________ ( i - V X i ) x (1 - v ^) x 5.5.1 2 O p e r a t o r N a m e s \s q r t { x } - +\s q r t {\s m a s h [ b ] { y } - } - +\s q r t { z } \s q r t { x } - +\s q r t { y } - +\s q r t { z } - ( l -\s q r t - C\s m a s h [ b ] {\l a m b d a _ j » ) X ( l -\s q r t {\l a m b d a _ j } ) X W e s a w i n S e c t i o n 5.4.2 h o w t o d e f i n e n e w f u n c t i o n s/o p e r a t o r s w i t h s t a n d a r d I f f l i g X. T h e Aj\4S packages pr ovide an easy interface fo r this. I f you w ant to define the operator \random, all you have to say is \Declare Ma th Op e r at o r{\r a n do m}{ra n d om} There is also a starred form: 134 ^ 5 T y p e s e t t i n g M a t h e m a t i c s \DeclareMathOperator*-C\LimMLim}- This means that the defined operator should have subscripts and superscripts placed i n the “ l i m i t s" positions (above and below like, say, the \max operator). I n a d d i t i o n to the ones already predefined b y standard I^TgX (see Table 5.24), we also have the f o l l o w i n g available: \i n j l i m (i nj l i m ) \l g (lg) \p r o j l i m (proj l i m ) \v a r l i m s u p ( l i m ) \v a r l i m i n f ( l i m ) \v a r i n j l i m ( l i m ) \v a r p r o j l i m ( l i m ) There is also the command \operatorname such that \operatorname-[xyz}- can be used as a b in a r y operator. You can use \operatorname* i n order to get l imits. 5.5.1 3 T h e \m o d C o m m a n d a n d i t s R e l a t i v e s The several space conventions f o r the mod notation are handled b y the commands \mod, \bmod, \pmod, and \pod. The second and t h i r d commands are available i n standard I^TgX as well. Here is an example: gcd(m, n mod n) x = y (mod b) x = y mod c x = y (d) \gcd(m,n\bmod n) x\e q u i v y \pmod b x\e q u i v y\mod c x\e q u i v y \p o d d 5.5.1 4 T h e \t e x t C o m m a n d The command \t e x t is provided f o r w r i t i n g text i n math mode. I f the text is to be w r i t t e n i n sub/super-script position, the text size is adjusted automatically, and this is its main advantage over the previously described method using a \mbox: f { x ) X2f ( x )\s t a c k r e l {\t e x t { d e f )-}-{=} x*2$$I n a m u l t i l i n g u a l environment, the command w i l l use the current text language and w i l l accept language-specific commands. 5.5.1 5 I n t e g r a l s a n d S u m s We have seen how to deal w i t h stacked expressions under a \sum symbol using the \a t o p command. The Am S packages provide the command \s u b s t a c k and the sl ightly more general environment subarray, w h i c h has a column specifier: 5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 135 Σ/Μ neZ n> 0 \b e g i n { d i s p l a y m a t h } \sum_-C\substack{ n\i n\m a t h b b Z\\ n\g e q 0 » f (n) \e n d { d i s p l a y m a t h } Σ /(») neZ 0<«<A:! \b e g i n { d i splaymath} \sum_{% \b e g i n { s u b a r r a y }"C l ] · n\i n\m a t h b b Z\\ - k!\l e q n\l e q k! \e n d { su b arr a y}-} f (n) \e n d { d i splaymath} I i one wants to p u t accents and l im i t s on a large operator, he or she can use the command \s i d e s e t. Here is an example that f u l l y demonstrates the capabilities of this command: b 2ς 4 1 ^ 3 a$$\sideset{_l''2>-C_3''4}\sum_a''b5.5.1 6 C o m m u t a t i v e D i a g r a m s Commutative diagrams are supported w i t h the amscd package. This is provided n o t as a complete solution b u t as a package f o r a quick diagram, d ra wn w i t h o u t diagonal arrows (for a complete solution, see Section 5.4.11). Consequently, we w i l l not go to the trouble to describe the f u n c ti o n al i t y of this package. Here is an example that demonstrates the use of the package: \b e g { d i splaymath} \begin{CD> A @>a>b> B\\ C D OVcVV OAAdAW C 0= D \end{CD}- \e n d { d i splaymath} 5.5.1 7 D i s p l a y e d E q u a t i o n s a n d A l i g n e d S t r u c t u r e s Maybe the biggest advantage of using the A v f S packages is the a b i l i t y they give to better deal w i t h displayed and aligned environments ^ n u c h better than the already discussed eq na rra y environment o f I£T|iX. These environments are: e q u a t i o n e q u a t i o n * a l i g n a l i g n * g a t h e r g a t h e r * f l a l i g n f l a l i g n * m u l t l i n e m u l t l i n e * a l i g n a t a l i g n a t * s p l i t g a th e re d a l i g n e d a l i g n e d a t 136 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s x = y (Λ*?) The eq na rra y environment can s ti l l be used, b u t i t is preferable to use the a l i g n envi­ ronment or a combination o f the e q u a t i o n environment plus the s p l i t environment. The starred forms (except s p l i t ) do not number the environment. You can also suppress the number o f any line b y p u t t i n g \n o t a g before the \\. The \nonumber command is s ti l l v a l i d and can be used. I f we w ant to give a specific tag to a line, we can use the \t a g command: \b e g i n { e q u a t i o n ) - x=y\tag{x~y?> \e n d { e q u a t i o n } Notice that \t a g automatically puts the given text i n parentheses. This can be avoided w i t h its starred version: \t a g *. The s p l i t environment can o nly be used inside some o f the other environments (except m u l t l i n e ). The most i mpo rta n t difference f r o m the standard eqnarray environment is that here we have no extra w hi t e space around the aligned symbol, and the main syntactical difference is the use o f a single & i n f r o n t of the symbols to be aligned instead of surrounding the symbol b y tw o &. Here are some examples: \b e g i n { e q u a t i o n } \b e g i n { s p l i t } a & = b+c+d \\ & \quad + e + f\\ & = g + h\\ & = i \e n d { s p l i t } \e n d { e q u a t i o n } Notice here that the s p l i t environment is treated as one mathematical f ormula and therefore takes only one number. The same happens w i t h m u l t l i n e: a — b c d + e + f = g + h — i ( 5.9) ci-\-b-\-c-\-d-\-6-\- + 1 + 2 + 3 + 4 + 5 ( 5.10) \b e g i n - C m u l t l i n e } a + b + c + d + e + f\\ +1+2+3+4+5 \e n d - C m u l t l i n e ) - The m u l t l i n e e n v i r o n m e n t i s u s e d f o r e q u a t i o n s t h a t d o n o t f i t o n o ne l i n e, a n d i t a l w a y s set s t h e f i r s t l i n e o f t h e e q u a t i o n f l u s h e d t o t h e l e f t a n d t h e l a s t l i n e f l u s h e d t o t h e r i g h t ( a p a r t f r o m t h e i n d e n t a m o u n t \m u l t l i n e g a p ). I f t h e r e a r e m i d d l e l i n e s, t h e y a r e c e n t e r e d i n d e p e n d e n t l y w i t h i n t h e d i s p l a y w i d t h. Th i s c a n c h a n g e w i t h t h e c o m m a n d s \s h o v e l e f t a n d \s h o v e r i g h t. These c o m m a n d s t a k e t h e e n t i r e e q u a t i o n l i n e as a n a r g u m e n t ( e x c e p t t h e f i n a l \\). The g a t h e r e n v i r o n m e n t a l l o w s u s t o w r i t e s e v e r a l d i s p l a y e d f o r m u l a s w i t h o u t b i g v e r t i c a l spaces s e p a r a t i n g t h e m. M o r e o v e r, a n y o f i t s e q u a t i o n s c a n b e a s p l i t e n v i r o n m e n t: 5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 1 3 7 \b e g i n { g a t h e r > a = b + c\\ (5.11) \b e g i n { s p l i t > d+e & = f + g\\ (5.12) h &= i \end-Csplit }- \e n d { g a t h e r } - The a l i g n environment is an enhanced version o f the standard e q n a r r a y. I n a ddi ti on to the better spacing around the aligned symbol, i t also accepts many align points: a = b + c d + e = f + g h = i a = b + c h = i (5.13) d + e = f + g j = k (5.14) \b e g i n { a l i g n } a &= b+c & h &= i\\ d+e &= f + g & j &= k \e n d { a l i g n } The a l i g n environment can also be used f o r adding comments to equations: \b e g i n { a l i g n } a &= b+c & & \t e x t { b y axiom 5 }\\ d+e &= f+ g & & \t e x t { b y t h e h yp o t h e s i s } · \e n d - [ a li g n } - The variant a l i g n a t takes as an argument the number of columns that are to be aligned and leaves no space between them, w hi c h is useful f o r constructs such as a = b + c b y axiom 5 (5.15) d + e = f + g b y the hypothesis (5.16) \begin{alignat}--C2}- l O & ^ + l l l & v - l W \ | X X X m A. V * / x+ y = 0 (5.18) The f l a l i g n environment sets the equations flushi o f the display. That is w h y the starred version is to be &x+ &y=0 \e n d { a l i g n a t } 2d to the l ef t and to the r i g h t preferred. I f o n ly one p o in t of alignment is given, then i t behaves l ike the a l i g n e nvin a = b + c h = ι d + e = f + g j = k m m e n t: \b e g i n { f l a l i g n * } a & = b + c & h & = i\\ d + e & = f + g & j & = k \e n d { f l a l i g n * } - T h e e n v i r o n m e n t s t h a t w e h a v e s e e n t h u s f a r a r e d e s i g n e d t o p r o d u c e d i s p l a y s t h a t o c c u p y t h e f u l l w i d t h o f t h e d i s p l a y/p a g e. T h e e n v i r o n m e n t s g a t h e r e d, a l i g n e d, a n d a l i g n e d a t o c c u p y o n l y t h e s p a c e n e e d e d b y t h e e q u a t i o n. T h u s, t h e y c a n b e u s e d a s b u i l d i n g b l o c k s f o r c e r t a i n a p p l i c a t i o n s. F o r e x a m p l e: 138 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s w e l l - k n o w n equations \b e g i n { e q u a t i o n * } \l e f t.\b e g i n { a l i g n e d } E &= mc',2\\ E &= h\n u \e n d { a l i g n e d }\r i g h t\} - \qquad \t e x t { % w el l - k no w n e q u a t i o n s } \e n d { e q u a t i o n * } These -ed variants accept the optional arguments f o r vertical positioning [ t ] and [b] like the a r r a y environment. Finally, the cases environment gives another way of typesetting nonanalytically defined functions w i t h tighter spacing between the de li m it e r and the array: \b e g i n { d i splaymath} \c h i _ A =
\b e g in { c a s e s } - 1 & \t e x t { i f $l\i n A$ }\\
0 & \t e x t { o t h e r w i s e.} \end{cases}- \e n d { d i splaymath)-
Notice the absence of \{ i n the i n p u t above!
L5Te X is not allowed to break the displays produced b y the commands described thus far at the end o f a page. To a ll o w this i n a p articular line o f an equation, you must use \d i s p l a y b r e a k [ n ], where n can be either 0 or 1 or 2 or 3 or 4, immediately before the \\. I f n is set to zero, i t means that a break is permissible here, whereas i f i t is set to four, Ι^ΤβΧ is forced to break. I f you w ant this policy to be used systematically f o r all equations, you can p u t the command \a l l o w d i s p l a y b r e a k s [n ] i n the preamble of y o u r document, where n has the same meaning as the argument of the \d i s p l a y b r e a k command. Recall here that \\* prohibits a page break.
Displays can also be i nt errupted for inserting text using the \i n t e r t e x t command. A l i g n points are preserved:
x a
1 m e A 0 otherwise.
hence
II II
(5.19)
(5.20)
\b e g i n { a l i g n ) - x &= y\\ y &= z\\
\i n t e r t e x t { h e n c e }
X = z
(5.21)
x &— z \e n d { a l i g n }
5.5.1 8 N u m b e r i n g E q u a t i o n s a n d R e f e r e n c i n g
5-5 T h e A\i S C l a s s e s a n d P a c k a g e ^ 139
Δ
Equation numbers are usually set with respect to the section that the equation belongs to. Usually, the equation counter is used for this purpose; this counter is predefined for the book document class. For the a r t i c l e document class, we usually define
\renewcommand{\theequation}{\thesection.\arabic{equation}}
This works fine except that it must be reset at the beginning of each new section us­
ing the \setcounter command. The packages make this easier by providing the \nuraberwithin command, so we can set
\numberwithin{equation}{section}
Of course, this command can be applied to any other counter. Adjusting the tag placement can be done using the \r a i s e t a g command. For example, \r a i s e - tag{6pt> w il l raise the tag by 6 pt. For cross referencing, we additionally have the \eqref command as well as the standard \r e f command. The only difference is that \eqref also provides the parentheses around the equation number.
Finally, we can create subordinate equations with the subequations environ­
ment:
λ: - y (522)
y - z (5.23a)
ξ - w (5.23b)
\be g i n-f equat i on } x=y

\begin-f subequations} \label{subeqnarray}
\be g i eqnarr ay} y &=& z\\ z &=& w \end{eqnarray}
\end{subequations}
Notice that we still need a math display environment inside the subequations environment. This inner environment can be any of the ones discussed in the previous section (here we used the standard eqnarray). In addition, you w i l l see that the numbers start from the next number after the last equation. The \r e f or \eqref command for these w i l l not produce the subordinate numbering but the parent one instead i f the label is immediately after the start of the subequations environment. Thus, i f we refer to the last eqnarray, we get (5.23).
The counters involved in the subequations are parentequation and equation. So, i f we want to change something, we can use standard IAT^X commands. For example:
\begin{subequation}
\renewcommand-C\the equat ion}{*/,
\theparent equat ion \roman{equat i o n } }
\end{subequ at i an}
140 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s
5.5.1 9 M a t r i c e s
For matrices, the environments d i f f e r f r o m the standard a r r a y environment i n that they have predefined delimiters and a more compact appearance. On the negative side is the fact that they do not a ll o w alignment of the entries. For such a task, we must use the a r r a y environment. The available environments are the p m a t r i x ( w i t h parentheses as delimiters), b m a t r i x ( w i t h delimiters [ ]), v m a t r i x ( w i t h delimiters | |), and V m a tr i x ( w i t h delimiters || ||). I n a d di ti o n to these, we have the m a t r i x environment (for whi ch delimiters must be provided) and the s m a l l m a t r i x environment f o r matrices such that f i t nicely inside text. Notice that f o r the s m a l l m a t r i x environment the
as
a b c d
delimiters must also be provided. Thus, the small m a tri x above was
$\l e f t [\b e g i n { s m a l l m a t r i x } a & b \\ c & d \e n d { s m a l l m a t r i x } -\r i g h t ]$
The command Y h d o t s f o r{.number} produces a r o w o f dots that spans the given number of columns. Here is an example:
\b e g i n { d i s p l a y m a t h }
\b e g i n { m a t r i x ] - a&b&c&d\\ e &\h d o t s f o r { 3 }
\ end-[mat r i x } 
\end-Cdisplaymath}-
The \h d o t s f o r command takes an optional argument that is used as a mu lt ip l ica t ive factor for the distance between consecutive dots:
a
e
d
\b eg i n { d i splaymath}
\b e g i n { b m a t r i x }
a _ { l l > & a_{12> &
a_-[13}- & \d o t s & a _ { l n }\\
a_{21> & a_{22> &
a_{23}- fe \d o t s fe a _ { 2 n }\\
\h d o t s f o r [.5 ] { 5 }\\
\h d o t s f o r { 5 }\\
\h d o t s f o r [ 3 ] { 5 }\\ a _ { n l } & a_{n2> & a_{n3}- & \d o t s & a _ {n n}
a 1 1 a\2 di?,
#21 Λ 22 &23
d i n 0-2 n
d n\ &n2 &n?>
\e n d { b m a t r i x ) -
\e n d { d i s p l a y m a t h }
5.5.2 0 B o x e d F o r m u l a s
The \b o x ed command puts a fra me around its argument:
5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 1 4 1
a + b = c (5-24)
\b e g i n { e q u a t i o n }
\boxed{a+b=c}
\e n d { e q u a t i o n }
5.5.2 1 C u s t o m i z i n g T h e o r e m s
Customization o f the appearance of the theorem-related environments can be done b y using the amsthm package. Like the theorem package discussed i n Section 5.4.8, i t recognizes the \t h e o r e m s t y l e specification and has a starred fo rm f o r unnumbered environments. I t also defines a p r o o f environment that automatically enters the QED symbol at the end of the proof. The available theorem styles are p l a i n, def i n i t i o n, and remark. The theorem styles are declared before the relative \newtheorem commands. For example, the preamble of a document may contain
\t h e o r e m s t y l e { p l a i n } % d e f a u l t \newtheorem{thm}{Theorem} [ s e c t i o n ]
\newtheorem{prop} [thm] { P r o p o s i t i o n }
\newtheorem{lem} [thm] {Lemma}
\n e w t h e o r e m { c o r } [ t h m ] { C o r o l l a r y }
\t h e o r e m s t y l e { d e f i n i t i o n }
\n e w t h e o r e m { d e f n } [ t h m ] { D e f i n i t i o n }
\n e wtheorem{exa}[t hm] {Exampl e}
\t h e o r e m s t y l e { r e m a r k }
\newtheorem{rem}[thm]{Remark}
\n e w t h e o r e m * { n o t e } [ t h m ] { N o t e }
The \swapnumbers command is available i n order to a ll o w the theorem number to be prin t ed before the theorem header:
5.1 Theorem. Every bounded monotone sequence in ]R converges.
C o r o l l a r y 5.2. A monotone sequence in R either converges or diverges to either 00 or
----------ΘΟ.----------------------------------------------------------------------------------------------------------------------------------------------
T h i s w a s p r o d u c e d b y i s s u i n g t h e \s wa p n u mb e r s c o m m a n d b e f o r e t h e d e f i n i t i o n o f t h e t h e o r e m e n v i r o n m e n t i n t h e p r e a m b l e a n d b e f o r e t h e d e f i n i t i o n o f t h e c o r o l l a r y e n v i r o n m e n t.
The p a c k a g e a l s o p r o v i d e s t h e c o m m a n d \n e w t h e o r e m s t y l e, w h i c h e nabl es u s t o d e f i n e c u s t o m t h e o r e m s t y l e s. The s y n t a x i s
\n e w t h e o r e m s t y l e { n a/n e of s t y l e y { s pac e - abo v e y
{ s pace- bel owy{ body- f ont y { i ndent amounty{Thm head f o nt y { punct uat i on a f t e r Thm heady {.space a f t e r Thm heady {.Thm head specy
142 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s
The space-above is the space between the theorem and the last line o f the previous paragraph. The space-bel ow is the space between the theorem and the next paragraph. I f you leave these tw o empty, then the "u s u a l" space w i l l be used. The body-f ont declaration needs no explanation (you can use, f o r example, \i t s h a p e ). The i ndent amount is the indentation space before the header begins. I f you leave this empty, then no i ndentation w i l l be used. You can also use an already defined length such as \p a r i n d e n t f o r paragraph-like indentation. For example, Thm head f ont can be set to \b f s e r i e s and the punct uat i on a f t e r Thm head is the punctuation that w i l l be set after the theorem (for example, a dot: {.} ). Finally, space a f t e r Thm head is self- explanatory ( i f set to \n e w l i n e i t w i l l create a line break after the theorem head) and the Thm head s pec, i f set to [\t h m n o t#3 ], w i l l produce the comment i n the theorem's header, read fr o m the square brackets o f \b e g i n { t h m } [Thm Head s p e c ].
The p r o o f environment has an optional argument that customizes the head of the proof. For example, you may say
\b e g i n { p r o o f }- [ P r o o f o f t h e main theorem]
The shape o f the q e d symbol is controlled b y \qedsymbol. The default is □. I t can also be accessed, i f necessary, b y the \q e d command. I t frequently happens i n mathematics that a p ro of may end w i t h a display equation or array. I n these cases, the position of the q e d symbol is problematic. The nice way is to use the command \qedhere at the end o f the line where the display ends. For example,
Proof.
f(x) =x-x
= 0 □
was produced by
\b e g i n { p r o o f }
\b e g i n { a l i g n * } - f ( x ) & = x - x\\
&=0\qedhere \e n d { a l i g n * } - \e n d { p r o o f }
I t is i mpo rta n t to note that the amsthm package must be loaded before the amsmath package. I t is automatically loaded w i t h the document classes. I n case you get an error relating to the \qedhere command, t r y \mbox-C\qedhere} instead.
5.5.22 O p t i o n s o f t h e a m s m a t h P a c k a g e
The f o l l o w i n g options are available f o r the amsmath style file:
5.5 T h e A m S C l a s s e s a n d P a c k a g e9v>· 1 4 3
c e n t e r t a g s (default) place the equation number o f a s p l i t environment vertically centered on the total height o f the environment, t b t a g s place the number o f the s p l i t environment at the bottom of the environment i f the tags are on the r i g h t and at the top when the tags are on the left, s u m l i m i t s (default) place the sub/super-scripts of summation symbols above and be­
l o w the symbol i n displayed equations. This affects products, direct sums, and direct products as well, b u t not integrals (see two items below), n o s u m l i m i t s always place the sub/super-scripts to the side o f a sum (or similar) sym­
bol, even i n displays, i n t l i m i t s The same as s u m l i m i t s b u t f o r integrals, no i n t l i m i t s (default) The opposite o f i n t l i m i t s.
n a m e l i m i t s (default) L ike sum l imits, b u t f o r certain operator names such as det, inf, lim, max, min, and so on. n o n a m e l im i t s The opposite of n a m e l i m i t s. leqno Place equation numbers on the left, reqno Place equation numbers on the right.
f l e q n Position the equations at a fixed indentation fr o m the l ef t margin (not centered).
You can choose any of the options above w i t h the optional argument o f the \u s e - package command; f o r example, \usepackage [ n o s u m l i m i t s ] { amsmath}·.
5.5.2 3 C o n v e r t i n g f r o m S t a n d a r d t o t h e A\^ S P a c k a g e s
I f you have already w r i t t e n something b u t now you w ant to load the amsmath and other A\4S packages, you usually have only to load them and yo u r files should ru n successfully (provided that they are i n LTEX2g). Some changes that you may w ant to do are to substitute all eq n a r r a y environments w i t h the a l i g n environment and to use the p r o o f environment combined w i t h the \qedhere command f o r y o u r proofs that end w i t h displays.
5.5.2 4 T h e a m s a r t T o p M a t t e r C o m m a n d s
The top matter o f an Aj^tS article document contains i nf ormat ion about the author, the t i t l e subject classification, the key words, the abstract, and so on. I n Table 5.25, we see the commands defined b y the amsart class f o r such information. A l l arguments i n square brackets are optional and are not always necessary. A short ti tl e should be pro vid e d f o r use i n the r u n n i n g heads i f the t i t l e is too long. I n this case, we can force a line break i n the ti t l e using \\ or let LTgX take care o f this. A n author command is given f o r any author separately. The optional argument is f o r a shortened name, such as
\a u t h o r [ L. E u l e r ] {Leonard E u l e r }
144 ^ 5 T y p e s e t t i n g Μ λ τ η ε μ λ t i c s
Table 5.25: amsart top matter commands
\t i t l e [ short - t i t le ] { t i t l e }
\a d d r e s s {address>
\email{e/7iaii >
Xdedicatoryidedication}
\t h a n k s { t h a n k s >
\keywor ds{comma separated key words} \b e g i n { a b s t r a c t }...\end{abst ract}
\author [ short-name ] {name } \curraddr{current-a<2<2ress } \i i r l a d d r { f/?i l }
\d a t e { i i ( 2 i.e }
\t r a n s l a t o r { i r a n s l a i o r’s name}
\subj c l a s s [2000] {Primary ; Secondary } \m a k e t i t l e
Δ
Ι ί there are many authors and their names do not fit into the running head, then we can replace the running head names with "FIRST AUTHOR ET AL." by us­
ing \markboth{FIRST AUTHOR ET AL.}{short t i t l e in al l caps} (for more details on the \mathboth command, see the next chapter.) The \markboth com­
mand should come after the \m a k e t i t l e command.
For each author, we must provide an address. Line breaks in the address are again by \ V The same applies for the \c u r r a d d r i f an author is current ly i n another (temporary) address. The e-mail address is w r it t e n as usual ([email protected] .domain) and fo r the URL address, i f a ~ is needed, we use the command \t e x t a s c i i t i l d e. The class w i l l automatically use labels l ike "
E-mail address:.” In a m u lt i l i n g u a l environment, you should be careful, as these terms may not be translated i n the main document language.
The \t h a n k s field is provided fo r acknowledgments of grants and support, and i t can appear more than once i n the top matter.
The subject classification and keywords appear as footnotes b u t w i t h o u t f o o t n o t e ­
mark. The 2000 in the subject classification's optional argument follows the 2000 Mathe­
matics Subject Classification scheme ( h t t p: //www. auns. org/msc). I f the optional argu­
ment is omitted, the 1991 Subject Classification w i l l be used.
Finally, f o r the abstract, let us note that i t should be placed before
the \m a k e t i t l e command.
5.6 From A to MathML
This section shows how we can generate X M L content, in general, and M a THMLcontent, i n particular, from Λ i n p u t files. Therefore, the material presented here is not necessary for the understanding of the rest o f the book.
XML, the extensible M a r k up Language, is a standard f o r document markup that is getting universal acceptance. Data can be marked up w i t h simple, human-readable tags. In addition, X M L is becoming the standard format for computer-related documents.
5-6 F r o m Λ τ ο Μ α t h M L <>- 145
XML elements are delimit ed b y start and end tags. Start tags begin w i t h a <, and end tags begin w i t h a </. Both of these are followed b y the name of the element and are closed b y a >. For example,
< t i t l e > My A r t i c l e </t i t l e >
is a simple example of a title element. Note that this element has content. There are elements w i t h o u t content, w hi c h are called empty elements. Empty elements start w i t h a <, the name o f the tag, and close w i t h a /> (e.g., < h r/> ). X M L itself does not specify any parti cul ar formatting; rather, i t specifies the rules for tagging elements. These tags can then be interpreted to format elements i n dif ferent ways. SGML, the Standard Generalized M a r k u p Language, is a system f o r organizing and tagging elements o f a document. SGML, l ike XML, is used to mark u p documents, but, u n li ke XML, i t is a very complex system.
M a thM L is an X M L application that is p r i m a r i l y intended to facilitate the use and reuse o f mathematical and scientific content on the Web. Of course, other applications, such as computer algebra systems and p r i n t typesetting, are possible as well. I n general, Ma thM L markup is embedded i n t o H T M L documents. But, currently, o n ly Mozilla, Netscape's successor, can render Ma t h M L content.
Since many people w o u l d really love a tool that w o u l d a ll o w them to w r i t e ord in a ry I^T^X content and transform i t very easily to M a thM L the authors o f Ω have extended this system so that i t can d ire c t ly produce M a thM L content. These new features are described i n b r i e f i n [10]. Here, we w i l l t r y to completely document these new features.
The command \MMLmode2 tells Ω to enter Ma ra MLmo d e; that is, n o w mathematical formulas w i l l be o u t p u t as Ma t h M L instructions. The command \noMMLmode cancels the effect o f \MMLmode so mathematical formulas are o u t p u t as D V I instructions. Nev­
ertheless, i t is not enough to enter Ma thM L mode i n order to get M a thM L output: we must d e l i m i t each mathematical formula b y the commands \M M L s t a r t t e x t and \MMLendtext. Let us see a concrete example. Suppose that the code that is shown on the r i g h t of Table 5.26is stored i n file m a t h.t e x. Then, A w i l l generate two o u t p u t fi l es— math. mml, w hi c h w i l l contain the Ma thM L content (or, i n general, the X M L content), and m a t h.d v i, whi ch is just a normal D V I file. The code at the lef t of Table 5.26 is the o u t p u t generated b y A: N ow, th e next st ep i s t o see h o w we can generate a com p l ete H T M L or X M L file fr o m a A i n p u t file. I f we feed Λ w i t h the f o l l o w i n g i n p u t f i l e 3
\d o c u m e n t c l a s s { a r t i c l e } -
\begin-[document}
\MMLmode
\SGMLwrite{ <! ——Gener a t ed by Omega v er s i o n \0megaVer s i o n — >}---------------
\SGMLwriteln
\S G M L s t a r t t e x t t a g { h t m l } %
2. The discussion aplies to Ω version 1,15, new features introduced to versions 1.23 and later are discussed on Appendix E.
3, Whatever appears between <! — and —> is considered a comment and it is ignored.
146 -φ- 5 T y p e s e t t i n g Μ α t h e m a t i c s
Table 5.26: A A input file and the generated Ma t h ML content.
<mtext>
<inlinemath>
$<mrow> <mi> E </mi> <mo> = </mo> <mi> m </mi> <msup> <mi> c </mi> <mn> 2 </mn> </msup> </mrow>$
</inlinemath>
</mtext>
\SG MLst a rtte xtt a g{h e a d }% \S G M L s t a r t t e x t t a g { t i t l e } %
A Simple HTML document \S G M L e n d t e x t t a g { t i t l e } % \SGMLendtexttag{head}% \SG MLs t a rtt e x t t a g{b o d y }% \SGMLemptytag{hr>{>
Th i s i s a simple HTML document \SGMLloneta g { h r w i d t h = 1150\SGMLpercent11} {}% \SGMLendtexttag-Cbody}-% \SGMLendtexttag{html}-%
\e n d {d o cument}
then we w i l l get the f o l l o w i n g output:
<!— Generated by Omega v e r s i o n 1.1 5 — > <html>
< t i t l e >
A Simple HTML document </t i t l e >
<body>
< h r/>
Th i s i s a simple HTML document
<hr w i d t h =ll 50%n>
\document c l a s s i a r t i c l e } \begin{document} \MMLmode \MMLstarttext $E=mc"2$
\MMLendtext
\noMMLmode
$E=mc~2$
\end{document}
5-6 F r o m Λ τ ο Μ λ t h M L -φ- 147
</body>
</h t m l >
The command \S G M L s t a r t t e x t t a g is used to specify start tags and the command \SGMLendtexttag is used to specify end tags. The commands \SGMLemptytag and \SGMLlonetag are used to specify empty tags and lonely tags, which are tags similar to the <p> and <br> tags o f the H T M L markup language. The command \SGMLwrite is used to o u t p u t content to the . mml file, w h i l e the command \SGMLwriteln just changes line to the o u tp u t file. The command \OmegaVersion prints the current version of the Π typesetting engine. Since certain symbols have a predefined meaning but, at the same time, are frequently used in X M L and SGML content, Π provides the fo l lo w i n g commands, which generate the symbols on the left-hand side o f each column.
\SGMLampersand
&
\SGMLbackslash
\
\3GMLcarret
\3GMLdollar
T a b l e i i.i: C o n t i n u e d.
1 5 T ^ X E r r o r M e s s a g e
P r o b a b l e C a u s e
U n d e f i n e d c o l o r * . . . ’ .
U n d e f i n e d c o l o r m o d e l ‘ ... ’
U n d e f i n e d t a b p o s i t i o n.
U n k n o w n g r a p h i c s e x t e n s i o n
U n k n o w n o p t i o n ... f o r ... \v e r b e n d e d b y e n d o f l i n e,
\v e r b i l l e g a l i n c o m m a n d a r g u m e n t.
\< i n m i d l i n e.
T h e n a m e d c o l o r w a s n o t d e f i n e d w i t h \d e f i n e c o l o r.
T h e c o l o r m o d e l r e q u e s t e d i n \d e f i n e c o l o r i s u n k n o w n.
A \= c o m m a n d h a s n o t b e e n u s e d t o d e f i n e t h e t a b p o s i t i o n s o u g h t b y o n e o f \<, \>, \+, o r \-
A n u n k n o w n f i l e e x t e n s i o n w a s f o u n d w h e n t h e \i n c l u d e g r a p h i c s c o m m a n d t r i e d t o d e ­
t e r m i n e t h e f i l e t y p e o f t h e g r a p h i c.
A n u n a v a i l a b l e o p t i o n w a s s p e c i f i e d i n a \d o c u m e n t c l a s s o r \u s e p a c k a g e c o m m a n d. T h e t e x t f o l l o w i n g a \v e r b c o m m a n d g o e s b e ­
y o n d t h e p r e s e n t l i n e. Y o u m a y h a v e o m i t t e d a n e n d c h a r a c t e r.
T h e a r g u m e n t t o a c o m m a n d c o n t a i n s a \v e r b c o m m a n d.
A t a b b i n g e n v i r o n m e n t c o n t a i n s a \< i n t h e m i d d l e o f a l i n e r a t h e r t h a n a t t h e b e g i n n i n g o f t h e l i n e.
A s w e m e n t i o n e d e a r l i e r, s o m e t i m e s a s i n g l e e r r o r c a n g e n e r a t e o t h e r s i n a k n o c k - o n e f f e c t. T h e m o s t c o m m o n e x a m p l e i s a n i n p u t f i l e w i t h a p r o b l e m a t i c l i s t e n v i r o n m e n t. I n o u r v e r s i o n, t h e r e a r e t h r e e i t e m s i n a n e n u m e r a t e d l i s t t h a t h a s a n e r r o r i n t h a t t h e e n v i r o n m e n t s t a r t s w i t h \b e g i n { n u m b e r i n g } i n s t e a d o f \b e g i n - C e n u m e r a t e }. I n a d d i t i o n, a s i m p l e e r r o r i s e m p l o y e d t o d e m o n s t r a t e t h e e r r o r r e c o v e r y f a c i l i t i e s T g X o f f e r s.
T h e f o l l o w i n g t e x t c a n b e t y p e d i n a s a c o m p l e t e e x a m p l e o f e r r o r p r o p a g a t i o n:
\d o c u m e n t c l a s s { a r t i c l e }
\b e g i n - C d o c u m e n t } -
\s u n x ~ 2 + \c o s x ~ 2 = 1 
C o m p u t e r l a n g u a g e s a r e c o n s i d e r e d t o b e \e m p h - C o b j e c t - o r i e n t e d } i f t h e y s u p p o r t t h e f o l l o w i n g p r o p e r t i e s:
\b e g i n { n u m b e r i n g }
\i t e m a b s t r a c t i o n
382 -φ- 11 T o E r r I s H u m a n
\i t e m e n c a p s u l a t i o n \i t e m i n h e r i t a n c e \i t e m p o l y m o r p h i s m \e n d { e n u m e r a t e }
\e n d { d o c u m e n t } -
R u n n i n g I ^ T ^ X o n t h i s i n p u t f i l e g e n e r a t e s t h e f i r s t e r r o r:
! U n d e f i n e d c o n t r o l s e q u e n c e.
1.3 \s u n
x"2 + \c o s x"2 = 1 
7
A t t h e p r o m p t, w e c a n t y p e t h e l e t t e r i a n d t h e n t h e c o r r e c t n a m e o f t h e c o m m a n d:
? i
i n s e r t
>\s i n
! L a T e X E r r o r: E n v i r o n m e n t n u m b e r i n g u n d e f i n e d.
S e e t h e L a T e X m a n u a l o r L a T e X C o m p a n i o n f o r e x p l a n a t i o n.
T y p e H < r e t u r n > f o r i m m e d i a t e h e l p.
1.7 \b e g i n { n u m b e r i n g ) - 7
U n f o r t u n a t e l y, i t i s n o t n o w p o s s i b l e t o d o t h e s a m e a n d t o r e p l a c e t h e e r r o n e o u s p i e c e o f c o d e, a s i t c o n s i s t s o f m o r e t h a n o n e t o k e n. S o, a l l w e c a n d o i s t o p r e s s r e t u r n a n d g e t a s u c c e s s i o n o f e r r o r m e s s a g e s. T h u s, w e g e t t h e s e t h r e e \l o n e l y \i t e m m e s s a g e s c a u s e d b y o u r f a i l u r e t o c a l l u p a n e n u m e r a t e e n v i r o n m e n t s o t h a t I ^ T ^ X f i n d s t h e i t e m s o u t s i d e o f a l i s t e n v i r o n m e n t:
! L a T e X E r r o r: L o n e l y \i t e m — p e r h a p s a m i s s i n g l i s t e n v i r o n m e n t.
S e e t h e L a T e X m a n u a l o r L a T e X C o m p a n i o n f o r e x p l a n a t i o n.
T y p e H < r e t u r n > f o r i m m e d i a t e h e l p.
1.6 \i t e m a
b s t r a c t i o n
7
1 L a T e X E r r o r: L o n e l y \i t e m — p e r h a p s a m i s s i n g l i s t e n v i r o n m e n t.
S e e t h e L a T e X m a n u a l o r L a T e X C o m p a n i o n f o r e x p l a n a t i o n.
T y p e H < r e t u r n > f o r i m m e d i a t e h e l p.
i i.2 E r r o r M e s s a g e s ■$· 383 1.7 \i t e m e n c a p s u l a t i o n 7 ! L a T e X E r r o r: L o n e l y \i t e m — p e r h a p s a m i s s i n g l i s t e n v i r o n m e n t. S e e t h e L a T e X m a n u a l o r L a T e X C o m p a n i o n f o r e x p l a n a t i o n. T y p e H < r e t u r n > f o r i m m e d i a t e h e l p. 1.8 \i t e m i n h e r i t a n c e 7 ! L a T e X E r r o r: L o n e l y \i t e m — p e r h a p s a m i s s i n g l i s t e n v i r o n m e n t. S e e t h e L a T e X m a n u a l o r L a T e X C o m p a n i o n f o r e x p l a n a t i o n. T y p e H < r e t u r n > f o r i m m e d i a t e h e l p. 1.9 \i t e m p o l y m o r p h i s m 7 T h e y a r e f o l l o w e d b y a f i n a l e r r o r m e s s a g e ! L a T e X E r r o r: \b e g i n { d o c u m e n t } e n d e d b y \e n d { e n u m e r a t e }. S e e t h e L a T e X m a n u a l o r L a T e X C o m p a n i o n f o r e x p l a n a t i o n. T y p e H < r e t u r n > f o r i m m e d i a t e h e l p. 1.1 0 \e n d - T e n u m e r a t e > t h a t i n d i c a t e s t h a t t h e p r o g r a m a t t e m p t e d t o t e r m i n a t e a n e n u m e r a t e e n v i r o n m e n t t h a t w a s n e v e r s t a r t e d u p. P r e s s i n g e n t e r o n e m o r e t i m e c a u s e s t h e p r o g r a m t o t e r m i n a t e. S o, w e h a v e s e e n t h a t a s i n g l e e r r o r i n o u r i n p u t f i l e c a n l e a d t o a c a s c a d e o f o t h e r e r r o r m e s s a g e s. I n s u c h c a s e s, o n e i s o f t e n b e t t e r o f f t y p i n g I\s t o p r a t h e r t h a n X f o l l o w e d b y t h e r e t u r n k e y s i n c e t h e f o r m e r w i l l i n c l u d e t h e f i n a l m a t e r i a l t h a t h a s b e e n p r o c e s s e d i n t h e o u t p u t. 384 "Φ· i i T o E r r I s H u m a n 11.2.2 Errors in Packages M a n y c l a s s e s a n d p a c k a g e s a r e a v a i l a b l e t o e x t e n d t h e f a c i l i t i e s o f f e r e d b y I i T ^ K. U s u a l l y a d d i t i o n a l p a c k a g e s a n d c l a s s e s h a v e e r r o r a n d w a r n i n g m e s s a g e s t h a t c o n c e r n t h e i r o w n u s e a n d a r e d e s c r i b e d i n t h e d o c u m e n t a t i o n t h a t a c c o m p a n i e s t h e m. F o r e x a m p l e, a d d i n g t h e c o m m a n d t o t h e p r e a m b l e o f o u r d o c u m e n t p r o d u c e s t h e f o l l o w i n g e r r o r m e s s a g e: ! P a c k a g e b a b e l E r r o r: Y o u h a v e n ’ t s p e c i f i e d a l a n g u a g e o p t i o n. B y a d d i n g t h e o p t i o n g e r m a n t o t h e o p t i o n s l i s t o f t h e \u s e p a c k a g e { b a b e l } c o m ­ m a n d, w e a r e e n a b l e d t o t y p e s e t G e r m a n l a n g u a g e d o c u m e n t s ( i.e., \u s e p a c k a g e [ g e r ­ m a n , e n g l i s h ] { b a b e l } ). O n e e r r o r t h a t c a n c a u s e c o n f u s i o n o r p a n i c w h e n f i r s t e n c o u n t e r e d i s t h e m e s s a g e ! T e X c a p a c i t y e x c e e d e d, s o r r y [...]. T h i s h a p p e n s w h e n Τ β Χ h a l t s i t s e x e c u t i o n b e c a u s e t h e i n t e r n a l s p a c e r e q u i r e d t o p r o c e s s y o u r d o c u m e n t w a s u s e d u p. T h i s u s u a l l y h a s n o t h i n g t o d o w i t h n o t h a v i n g s u f f i c i e n t c a p a c i t y f o r y o u r d o c u m e n t b u t i s m o r e l i k e l y t o b e a k n o c k - o n e f f e c t o f a n o t h e r t y p e o f e r r o r i n y o u r i n p u t f i l e. T h e f o l l o w i n g e x a m p l e a t t e m p t s t o d e f i n e t w o n e w c o m m a n d s, \e s m i l e a n d \e f r o w n, t h a t a r e u s e d a s s h o r t h a n d s t o e x p r e s s f e e l i n g s i n i n f o r m a l m e s s a g e s ( u s u a l l y e - m a i l s ). T a b l e 1 1.2 l i s t s T g X e r r o r m e s s a g e s a n d t h e i r c a u s e s. \d o c u m e n t c l a s s { a r t i c l e } \n e w c o m m a n d {\e s m i l e } { a \e s m i l e } \n e w c o m m a n d {\e f r o w n } {\t e x t t t {;( } } \b e g i n { d o c u m e n t } T o d a y i s m y b i r t h d a y \e s m i l e \\ H o w e v e r, a c a r e l e s s s l i p h a s r e s u l t e d i n \e s m i l e b e i n g d e f i n e d i n t e r m s o f i t s e l f r a t h e r t h a n t h e s t r i n g o f c h a r a c t e r s t h a t m a k e s u p t h e e - m a i l i c o n. A s a r e s u l t o f t h i s, t h e f o l l o w i n g m e s s a g e w a s g e n e r a t e d b y T g X: !TeX c a p a c i t y e x c e e d e d,s o r r y [ m a i n m e m o r y s i z e = 2 0 0 0 0 0 1 ]. \e s m i l e - > a \e s m i l e 1.5 T o d a y i s m y b i r t h d a y \e s m i l e I f y o u r e a l l y a b s o l u t e l y n e e d m o r e c a p a c i t y, y o u c a n a s k a w i z a r d t o e n l a r g e m e. \u s e p a c k a g e { b a b e 1 } 11.2.3 Errors Found by TgX n \e n d { d o c u m e n t } i i.2 E r r o r M e s s a g e s ■$· 385
T a b l e 11.2: T^X e r r o r m e s s a g e s a n d t h e i r p r o b a b l e c a u s e s.
Τ β Χ E r r o r M e s s a g e
P r o b a b l e C a u s e
! D o u b l e s u b s c r i p t.
! D o u b l e s u p e r s c r i p t.
! E x t r a a l i g n m e n t t a b h a s b e e n c h a n g e d t o \c r.
! E x t r a }, o r f o r g o t t e n $. ! I c a n ’ t f i n d f i l e ! I l l e g a l p a r a m e t e r n u m b e r i n d e f i n i t i o n o f ... ! I l l e g a l u n i t o f m e a s u r e ( p t i n s e r t e d ). ! M i s p l a c e d a l i g n m e n t t a b c h a r a c t e r &. M i s s i n g c o n t r o l s e q u e n c e T w o a d j a c e n t s u b s c r i p t s h a v e o c c u r r e d i n a m a t h e n v i r o n m e n t. T r y n e s t i n g t h e b r a c e s ( e.g.,$ y _ { 2 _ { 4 } } $g i v e s i/24 ). T w o a d j a c e n t s u b s c r i p t s h a v e o c c u r r e d i n a m a t h e n v i r o n m e n t. T r y n e s t i n g t h e b r a c e s ( e.g.,$ y ~ { 2 ~ { 4 } } $g i v e s y 2 *). T o o m a n y f t c o l u m n s e p a r a t o r s i n o n e r o w o f a n a r r a y o r t a b u l a r e n v i r o n m e n t. P r o b a b l y a f o r g o t ­ t e n \\ c o m m a n d. U n m a t c h e d m a t h m o d e l d e l i m i t e r s o r b r a c e s p r o b ­ a b l y c a u s e d b y a m i s s i n g { \ [ \ ( o r$.
Y o u r n a m e d f i l e d o e s n o t e x i s t.
I n c o r r e c t u s e o f a # i n o n e o f t h e \n e w c o m - m a n d, \r e n e w c o m m a n d, \p r o v i d e c o m m a n d ( t h e p a c k ­
a g e w r i t e r's v e r i o n o f \n e w c o m m a n d ), \n e w e n v i r o n - m e n t, o r \r e n e w e n v i r o n m e n t. N e s t i n g t h e s e c o m ­
m a n d s a l s o c a u s e s t h i s.
P o s s i b l y t h e s a m e p r o b l e m a s w i t h t h e m e s s a g e: ! m i s s i n g n u m b e r, t r e a t e d a s z e r o, o r y o u f o r ­
g o t u n i t s o f a l e n g t h a r g u m e n t ( e.g., 9 i n s t e a d o f 9 p t ).
Y o u t y p e d t h e s p e c i a l c h a r a c t e r & i n a p a s s a g e o f t e x t r a t h e r t h a n a n a r r a y o r t a b u l a r e n v i r o n m e n t. T r y a \f t.
A f i r s t a r g u m e n t t h a t i s n o t a c o m m a n d n a m e w a s
g i v e n a s a n a r g u m e n t t o o n e o f t h e \n e w c o m m a n d, \n e w l e n g t h, \n e w s a v e b o x, o r \r e n e w c o m m a n d c o m ­
m a n d s.
1 ) T g X e x p e c t e d a n u m b e r o r l e n g t h a s t h e a r g u m e n t t o a c o m m a n d b u t d i d n o t g e t o n e. 2 ) A s q u a r e b r a c k e t i n s o m e t e x t w a s m i s t a k e n f o r t h e s t a r t o f a n o p t i o n a l a r g u m e n t. 3 ) \p r o t e c t w a s p l a c e d i n f r o n t o f a l e n g t h o r \v a l u e c o m m a n d.
A t t h i s p o i n t T g X i s p r o b a b l y c o n f u s e d, a n d t h e e r r o r l o c a t o r i n d i c a t e s a p l a c e t o o f a r b e y o n d t h e a c t u a l e r r o r.
A m a t h m o d e c o m m a n d o c c u r r e d w h e n T g X w a s
i n s e r t e d.
! M i s s i n g n u m b e r, t r e a t e d a s z e r o.
! M i s s i n g { i n s e r t e d o r ! M i s s i n g } i n s e r t e d
! M i s s i n g $i n s e r t e d o r ! M i s s i n g$ $i n s e r t e d. ! W o t a l e t t e r. n o t i n m a t h m o d e o r a b l a n k l i n e w h i l e i t w a s i n m a t h m o d e. A n i n a p p r o p r i a t e a r g u m e n t t o a \h y p h e n a t i o n c o m m a n d w a s u s e d. 3B 6 -φ- i i T o E r r I s H u m a n Table 11.2: Continued. T g X E r r o r M e s s a g e P r o b a b l e C a u s e ! P a r a g r a p h e n d e d b e f o r e ... w a s c o m p l e t e. ! T e X c a p a c i t y e x c e e d e d, s o r r y ! T e x t l i n e c o n t a i n s a n i n v a l i d c h a r a c t e r. ! U n d e f i n e d c o n t r o l s e q u e n c e. ! U s e o f ... d o e s n ’ t m a t c h i t s d e f i n i t i o n. ! Y o u c a n ’ t u s e 'm a c r o p a r a m e t e r c h a r a c t e r #’ i n m o d e. S e e i f y o u c a n h e l p o u r u s e r o u t b y r e w r i t i n g t h e d e f i n i t i o n o f \e s m i l e i n t e r m s o f a s u i t a b l e e - m a i l i c o n s u c h a s : - ), a n d t h e n t r y r u n n i n g T g X. Y o u s h o u l d t h e n f i n d t h a t T ^ X r u n s s m o o t h l y a n d p r o c e s s e s t h e i n p u t f i l e w i t h o u t a n y d i f f i c u l t y. T h e p r e s e n t g e n e r a t i o n o f c o m p u t e r s h a s s u f f i c i e n t m e m o r y t o g i v e Τ β Χ t h e s p a c e t h a t i t n e e d s f o r m o s t d o c u m e n t s, b u t a g i v e n i n s t a l l a t i o n o f T ^ X o n l y h a s a f i x e d a m o u n t o f s p a c e s e t u p. F o r t h i s r e a s o n, t h e v e r s i o n i n s t a l l e d o n y o u r c o m p u t e r m a y n e e d t o b e r u n w i t h d i f f e r e n t s e t t i n g s, o r a b i g g e r v e r s i o n m a y n e e d t o b e o b t a i n e d. L a m p o r t ( i n [ 2 0 ] p a g e s 1 4 2 - 1 4 4 ) g i v e s m o r e d i s c u s s i o n o f t h e t y p e s o f s p a c e t h a t m a y b e u s e d u p a n d s o m e s o l u t i o n s t o g e t a r o u n d t h e p r o b l e m. W h e n w r i t i n g m a t h e m a t i c s, e r r o r s o f t e n a r i s e f r o m t h e o m i s s i o n o f a c l o s i n g c o m ­ m a n d t o r e t u r n t o a t e x t e n v i r o n m e n t, s u c h a s$ o r a f o r g o t t e n c l o s i n g b r a c e >. C o n t i n ­
u a l l y p r e s s i n g t h e r e t u r n k e y w i l l u s u a l l y g e t T g X t o f i n i s h p r o c e s s i n g t h e f i l e, b u t a m o r e c o n v e n i e n t a l t e r n a t i v e s o m e t i m e s i s t o u s e t h e s c r o l l m o d e ( t y p e S a n d t h e r e t u r n
A c o m m a n d a r g u m e n t c o n t a i n e d a n i n a p p r o p r i a t e b l a n k l i n e. Y o u m a y h a v e l e f t o f f t h e r i g h t b r a c e t o f i n i s h a n a r g u m e n t.
A n e r r o r i n y o u r i n p u t f i l e i s t h e m o s t l i k e l y c a u s e, r a t h e r t h a n T ^ X a c t u a l l y r u n n i n g o u t o f s p a c e. P r o b ­
a b l y, TjnX i s l o o p i n g e n d l e s s l y b e c a u s e o f a w r o n g c o m m a n d.
Y o u r i n p u t f i l e c o n t a i n s a n o n p r i n t i n g c h a r a c t e r. U s e a n e d i t o r t h a t j u s t p r o d u c e s A S C I I c h a r a c t e r s, o r c h o o s e "s a v e a s A S C I I" f r o m y o u r w o r d p r o c e s ­
s o r.
Y o u m a y h a v e m i s s p e l l e d o r m i s p l a c e d a c o m m a n d n a m e. A l t e r n a t i v e l y, y o u h a v e o m i t t e d a \d o c u - m e n t c l a s s o r \u s e p a c k a g e c o m m a n d.
1 ) I f ... i s a c o m m a n d f o r lATjnX, t h e n y o u m a y h a v e u s e d t h e i n c o r r e c t s y n t a x f o r a n a r g u m e n t t o a p i c t u r e c o m m a n d. 2 ) I f ... i s a \@ a r r a y, t h e r e i s a n e r r o r i n t h e © - e x p r e s s i o n i n t h e a r g u m e n t o f a n a r r a y o r t a b u l a r e n v i r o n m e n t ( t r y \p r o t e c t w i t h a f r a g i l e c o m m a n d ). 3 ) A f r a g i l e c o m m a n d h a v i n g a n o p t i o n a l a r g u m e n t t h a t o c c u r s i n a m o v i n g a r ­
g u m e n t c a n a l s o c a u s e t h i s.
Y o u t y p e d t h e s p e c i a l c h a r a c t e r # i n a p a s s a g e o f n o r m a l t e x t. T r y u s i n g \#.
i i -3 W a r n i n g s 387
k e y a t t h e e r r o r p r o m p t ), w h i c h w i l l p r o c e e d a l l t h e w a y t h r o u g h t h e f i l e a n d a l l o w s o n e t o l o o k a t t h e t y p e s e t r e s u l t i n t h e o u t p u t D V I f i l e t o s e e t h e n a t u r e o f t h e e r r o r.
11.3 Warnings
11.3.1 Warnings Generated by Ι£Γ|ηΧ
Y o u c a n t e l l w h e t h e r a w a r n i n g i s g e n e r a t e d b y I ^ T g X ( s e e T a b l e 1 1.3 ) s i n c e i t w i l l b e g i n w i t h t h e t e x t L a T e X W a r n i n g: . F o r e x a m p l e, i f w e r e f e r e n c e a n u n d e f i n e d l a b e l a s i n t h i s p a s s a g e
\d o c u m e n t c l a s s { a r t i c l e }
\b e g i n { d o c u m e n t }
T h e B r i t i s h p h i l o s o p h e r G i l b e r t R y l e i n t r o d u c e d t h e t e r m c<t h e G h o s t i n t h e M a c h i n e ’ ’ t o c h a r a c t e r i z e t h e C a r t e s i a n v i e w o f t h e m i n d. S e c t i o n
\r e f { v o l i t i o n } i n t r o d u c e s h i s v i e w o f m e n t a l p r o c e s s e s.
\s e c t i o n { T h e M y t h o f V o l i t i o n s, A c c o r d i n g t o R y l e ’ s ( 1 9 4 9 ) b o o k T h e C o n c e p t o f M i n d }
\e n d { d o c u m e n t }
t h e n t h e f o l l o w i n g I ^ T g X w a r n i n g i s g e n e r a t e d:
L a T e X W a r n i n g: R e f e r e n c e ‘ v o l i t i o n ’ o n p a g e 1 u n d e f i n e d o n i n p u t l i n e 5.
T l i i s c a n b e c o r r e c t e d b y a d d i n g t h e c o m m a n d \l a b e l { v o l i t i o n } i m m e d i a t e l y f o l ­
l o w i n g t h e c l o s i n g b r a c e o f t h e s e c t i o n i n g c o m m a n d. R u n n i n g I ^ T g X t w i c e o n t h e f i l e w i l l g e n e r a t e t h e c o r r e c t c r o s s - r e f e r e n c e a n d w i l l o m i t t h e w a r n i n g o n t h e s e c o n d r u n t h r o u g h. A n a d d i t i o n a l w a r n i n g i s s t i l l g e n e r a t e d o n t h e s c r e e n a n d w r i t t e n t o t h e l o g f i l e, n a m e l y
O v e r f u l l \h b o x ( 1 5.4 3 3 p t t o o w i d e ) i n p a r a g r a p h a t l i n e s 8 — 8 [ ]\0 T l/c m r/b x/n/1 4.4 T h e M y t h o f V o - l i - t i o n s, A c - c o r d - i n g t o R y l e ( 1 9 4 9 ) [ ]
W e c a n s e e t h a t t h i s i s a Τ β Χ w a r n i n g s i n c e i t h a s n o ? c h a r a c t e r p r e c e d i n g t h e m e s s a g e i n d i c a t i n g a n e r r o r a n d b e c a u s e i t i s n o t p r e c e d e d b y t h e w o r d s L a T e X W a r n i n g: . I t i s t e l l i n g u s t h a t Τ β Χ c o u l d n o t f i n d a g o o d p l a c e t o b r e a k t h e l i n e c o n t a i n i n g t h e s e c t i o n h e a d i n g. W e l e a v e i t a s a n e x e r c i s e f o r t h e r e a d e r t o a s s i s t T g X i n c o r r e c t l y b r e a k i n g t h e l i n e.
3B 8 -φ- i i T o E r r I s H u m a n
T a b l e 11.3: I£TeX w a r n i n g s a n d t h e i r p r o b a b l e c a u s e s.
I ^ T g X W a r n i n g M e s s a g e
P r o b a b l e C a u s e
C i t a t i o n ‘ . . .
’ o n p a g e ... u n d e f i n e d.
Command ... i n v a l i d i n m a t h m o d e.
F l o a t t o o l a r g e f o r p a g e b y ...
F o n t s h a p e ‘... >
i n s i z e ... n o t a v a i l a b l e
h f l o a t s p e c i f i e r c h a n g e d t o h t. o r !h f l o a t s p e c i f i e r c h a n g e d t o !h t.
L a b e l ‘ ’
m u l t i p l y d e f i n e d.
L a b e l ( s ) may h a v e c h a n g e d. R e r u n t o g e t c r o s s - r e f e r e n c e s r i g h t.
M a r g i n p a r on p a g e ... m o v e d.
No \a u t h o r g i v e n.
O p t i o n a l a r g u m e n t o f \t w o c o l u m n t o o t a l l o n p a g e ...
O v a l t o o s m a l l.
R e f e r e n c e ‘... ’
on p a g e ... u n d e f i n e d.
Some f o n t s h a p e s w e r e n o t a v a i l a b l e, d e f a u l t s s u b s t i t u t e d.
T h e r e w e r e m u l t i p l y - d e f i n e d l a b e l s.
T h e r e w e r e u n d e f i n e d r e f e r e n c e s o r c i t a t i o n s.
Y o u h a v e n o t d e f i n e d t h e k e y i n \c i t e c o m m a n d w i t h a \b i b i t e m c o m m a n d.
Y o u u s e d t h e n a m e d c o m m a n d i n m a t h m o d e w h e n i t i s n o t a l l o w e d t h e r e.
A t a b l e o r f i g u r e i s t o o l o n g b y t h e s t a t e d l e n g t h i n u n i t s o f p o i n t s. I t i s p r i n t e d o n a s e p a r a t e p a g e.
A f o n t w a s s p e c i f i e d t h a t i s u n a v a i l a b l e o n y o u r s y s t e m, a n d i t w a s r e p l a c e d b y t h e f o n t i n d i c a t e d o n t h e n e x t l i n e.
A t a b l e o r f i g u r e w i t h a n o p t i o n a l h o r ! h a r g u m e n t c o u l d n o t f i t o n t h e p r e s e n t p a g e a n d w a s p l a c e d o n t h e n e x t p a g e.
T h e s a m e a r g u m e n t s w e r e u s e d f o r t w o \b i b i t e m o r M a b e l c o m m a n d s. T h i s o c c u r r e d o n t h e p r e v i o u s r u n t h r o u g h I ^ T e X.
I n d i c a t e s t h a t t h e v a l u e s g i v e n b y \c i t e, \r e f, o r \p a g e r e f c o u l d b e w r o n g i f t h e c o r r e c t v a l u e s h a v e a l t e r e d s i n c e t h e l a s t r u n t h r o u g h 1?Te X.
A m a r g i n a l n o t e h a d t o b e p r i n t e d l o w e r t h a n t h e t e x t i t r e f e r s t o, s o a s n o t t o o v e r p r i n t a n e x i s t i n g m a r g i n a l n o t e.
A \a u t h o r c o m m a n d d i d n o t o c c u r b e f o r e \m a k e - t i t l e.
A b o x t o o b i g f o r t h e p a g e w a s s p e c i f i e d b y t h e o p t i o n a l a r g u m e n t o f a \t w o c o l u m n c o m m a n d.
A p o o r a p p r o x i m a t i o n t o t h e r e q u e s t e d o v a l o c - c u r r e d b e c a u s e t h e r e q u i r e d q u a r t e r c i r c l e s w e r e n o t a v a i l a b l e t h a t s m a l l.
A M a b e l c o m m a n d w a s n o t u s e d t o d e f i n e t h e a r g u m e n t o f a \r e f o r \p a g e r e f c o m m a n d.
A f o n t w a s s p e c i f i e d t h a t i s u n a v a i l a b l e o n y o u r s y s t e m a n d s u b s t i t u t e d w i t h a d e f a u l t a l t e r n a t i v e.
T w o d i f f e r e n t M a b e l c o m m a n d s w e r e u s e d i n t h e d e f i n i t i o n o f a l a b e l.
A n o n e x i s t e n t b i b l i o g r a p h y e n t r y o r M a b e l w a s r e f e r r e d t o b y a \c i t e o r \r e f c o m m a n d.
U n u s e d g l o b a l o p t i o n ( s ): [...].
Y o u h a v e r e q u e s t e d r e l e a s e ‘ ’
o f L a T e X, b u t o n l y r e l e a s e ‘... ’
i s a v a i l a b l e.
T h e \d o c u m e n t c l a s s c o m m a n d, o r p a c k a g e s t h a t w e r e l o a d e d, d i d n o t r e c o g n i z e t h e i n d i c a t e d o p ­
t i o n s.
Y o u r r e l e a s e o f I ^ T e X d o e s n o t w o r k w i t h a s p e c i f i e d d o c u m e n t c l a s s o r p a c k a g e. A l a t e r v e r s i o n o f L^T]h X w i l l b e r e q u i r e d t o w o r k w i t h t h a t.
i i -3 W a r n i n g s 389
W h e n u s i n g b a b e l, a c o m m o n e r r o r i s a m i s s i n g h y p h e n a t i o n p a c k a g e f o r a l a n g u a g e t h a t w e w i s h t o w r i t e i n. I f w e t y p e s e t t h e e x a m p l e
\d o c u m e n t c l a s s [ a 4 p a p e r, l l p t ] { a r t i c l e }
\u s e p a c k a g e [ s p a n i s h,e n g l i s h ] { b a b e l }
\b e g i n { d o c u m e n t }
A v e r s e f r o m t h e G u a n t a n a m e r a s o n g. L y r i c a d a p t i o n b y J u l i a n O r b o n, b a s e d o n a p o e m b y t h e C u b a n p o e t J o s\’ { e } M a r t V {\i }:
\b e g i n { v e r s e }
\s e l e c t l a n g u a g e { s p a n i s h }
Y o s o y u n h o m b r e s i n c e r o \\
D e d o n d e c r e c e l a p a l m a, \\
Y a n t e s d e m o r i r m e q u i e r o \\
E c h a r m i s v e r s o s d e l a l m a.
\e n d { v e r s e }
\e n d { d o c u m e n t }
t h e l o g f i l e i n f o r m s u s t h a t t h e r e i s a p o s s i b l e p r o b l e m w i t h t h e t y p e s e t o u t p u t a r i s i n g d u r i n g t h e u s e o f t h e a d d - o n p a c k a g e b a b e l:
P a c k a g e b a b e l W a r n i n g: N o h y p h e n a t i o n p a t t e r n s w e r e l o a d e d f o r ( b a b e l ) t h e l a n g u a g e ‘ S p a n i s h ’
( b a b e l ) I w i l l u s e t h e p a t t e r n s l o a d e d f o r
\l a n g u a g e = 0 i n s t e a d.
T h i s t e l l s u s t h a t i t c o u l d n o t f i n d h y p h e n a t i o n p a t t e r n s f o r S p a n i s h, s o i t w i l l u s e t h o s e f o r t h e d e f a u l t l a n g u a g e, w h i c h w i l l b e t h e f i r s t o n e e m b e d d e d i n t h e f o r m a t f i l e ( e.g., A m e r i c a n E n g l i s h ). I n o r d e r t o g e n e r a t e a f o r m a t f i l e, w e h a v e t o u s e i N i T g X ( o r i n i o m e g a, a n d s o o n ). T h i s p r o g r a m t r a n s f o r m s t h e f i l e l a t e x.l t x i n t o a f a s t l o a d a b l e b i n a r y f o r m a n d i n c l u d e s h y p h e n a t i o n p a t t e r n s f o r v a r i o u s l a n g u a g e s. S i n c e w e a r e t y p e s e t t i n g p o e t r y i n S p a n i s h w i t h l i n e s n a r r o w e r t h a n t h e w i d t h o f t h e p a g e, w e c a n c h o o s e t o i g n o r e t h e w a r n i n g s i n c e I ^ X d o e s n o t n e e d t o t r y a n d h y p h e n a t e t h e v e r s e. H o w e v e r, i f w e w e r e t y p e s e t t i n g a c o n t i n u o u s p i e c e o f S p a n i s h p r o s e, t h e n w e w o u l d l i k e t o l o a d t h e h y p h e n a t i o n p a t t e r n s f o r t h e S p a n i s h l a n g u a g e. T h i s i s d o n e b y l o c a t i n g t h e f i l e l a n g u a g e. d a t i n o u r Τ β Χ i n s t a l l a t i o n a n d a d d i n g t h e l i n e
s p a n i s h s p a n h y p h.t e x % S p a n i s h
t o t h e f i l e. F o l l o w i n g t h i s, a n e w L 5T gX f o r m a t f i l e m u s t b e g e n e r a t e d b y r u n n i n g i n i T ^ X o n t h e f i l e l a t e x.l t x o f o u r s y s t e m. T h i s w i l l p r o d u c e a f o r m a t f i l e f o r L5T^< t h a t w i l l a l l o w f o r l o a d i n g t h e S p a n i s h h y p h e n a t i o n p a t t e r n s w h e n t h e S p a n i s h l a n g u a g e i s s e l e c t e d u s i n g t h e B a b e l p a c k a g e. T h i s e x a m p l e i l l u s t r a t e s t h e d i f f e r e n c e b e t w e e n T g X o r L 5 T g X e r r o r s a n d w a r n i n g s. I n t h e c a s e o f a n e r r o r, t h e e x e c u t i o n o f T g X h a l t s a n d s o m e a c t i o n m u s t b e t a k e n b y t h e u s e r t o c o r r e c t t h e m i s t a k e, w h i l e a w a r n i n g h i g h l i g h t s a p o s s i b l e p r o b l e m w i t h t h e t y p e s e t o u t p u t b u t p r o g r a m e x e c u t i o n c o n t i n u e s a n d t h e
39° ^ 11 T ° E r r I s H u m a n
D V I f i l e i s p r o d u c e d. D e p e n d i n g o n t h e n a t u r e o f t h e w a r n i n g, t h i s m a y o r m a y n o t h a v e a n a c t u a l e f f e c t o n t h e t y p e s e t o u t p u t.
11.3.2 Warnings Generated by TgX
T a b l e 1 1.4 g i v e s t h e s u b s e t o f Τ β Χ w a r n i n g s h i g h l i g h t e d i n t h e T i T g X m a n u a l. T h e s e f o c u s o n p l a c e s w h e r e T ^ X h a d d i f f i c u l t l y i n b r e a k i n g a l i n e o r p a g e a n d c a n b e a i d e d i n t h e p r o c e s s b y t h e j u d i c i o u s u s e o f s o m e h i n t i n g c o m m a n d s f r o m t h e u s e r.
Table i i.4: T^X w a rnings and t heir probable c a u s e s.
T g X W a r n i n g M e s s a g e P r o b a b l e C a u s e
TjnX h a d d i f f i c u l t y f i n d i n g a g o o d p l a c e t o b r e a k t h e l i n e. Y o u m a y n e e d t o i n d i c a t e s u i t a b l e p l a c e s f o r t h e h y p h e n a t i o n o f a n u n u s u a l w o r d o r a d d a \l i n e b r e a k o r \n e w l i n e c o m m a n d.
T g X h a d d i f f i c u l t y f i n d i n g a g o o d p l a c e f o r a p a g e b r e a k a n d p u t t o o m u c h o n t h e p a g e. I t n e e d s s o m e a s s i s t a n c e f r o m y o u. T r y u s i n g a \p a g e b r e a k o r \e n l a r g e t h i s p a g e * c o m m a n d.
T w o s u c c e s s i v e \\ o r \n e w l i n e c o m m a n d s a d d e d v e r t i c a l s p a c e t o y o u r d o c u m e n t. A l t e r n a t i v e l y, a \s l o p p y d e c l a r a t i o n, a s l o p p y p a r e n v i r o n m e n t, o r a \l i n e b r e a k c o m m a n d m a y p r o d u c e t h i s w a r n ­
i n g.
T g X h a d d i f f i c u l t y f i n d i n g a g o o d p l a c e f o r a p a g e b r e a k a n d p u t t o o l i t t l e o n t h e p a g e. I t n e e d s s o m e a s s i s t a n c e f r o m y o u. T r y a d d i n g a \n o p a g e b r e a k c o m m a n d t o d e t e r T g X f r o m b r e a k i n g t h e p a g e t h e r e.
11.4 The Last Straw: Strategies for Dealing with Resistant
Errors
O c c a s i o n a l l y, t h e s i t u a t i o n m a y b e r e a c h e d w h e r e t h e T g X p r o g r a m c a n n o t b e s t o p p e d f o l l o w i n g a n e r r o r ( e.g., w h e n a s e r i o u s e r r o r p r o p a g a t i o n c a u s e s t h e t e x t p r o c e s s i n g t o c o n t i n u e i n d e f i n i t e l y ). I n t h i s c a s e, o n e m a y n e e d t o h a l t t h e p r o g r a m w i t h t h e o p e r a t i n g s y s t e m i n t e r r u p t, t h e n a t u r e o f w h i c h w i l l d e p e n d o n y o u r p a r t i c u l a r o p e r a t i n g s y s t e m, a l t h o u g h t y p i c a l l y s i m u l t a n e o u s l y p r e s s i n g t h e C t r l a n d c k e y s o r C t r l a n d B r e a k w i l l d o t h e t r i c k.
O v e r f u l l \h b o x ...
O v e r f u l l \v b o x ...
U n d e r f u l l \h b o x . . .
U n d e r f u l l \v b o x ...
i i.4 T h e L a s t S t r a w -φ- 391
W i t h o b s c u r e e r r o r s, a s t r a t e g y o f d i v i d e a n d c o n q u e r c a n b e h e l p f u l. B y i n s e r t i n g a \e n d { d o c u m e n t } c o m m a n d p a r t o f t h e w a y t h r o u g h, r u n n i n g L T g X, a n d e x a m i n i n g t h e o u t p u t, y o u c a n s e e i f t h e f i r s t p a r t o f t h e f i l e i s f r e e o f e r r o r s. I f i t i s, t h e n y o u c a n c u t a n d p a s t e t h e \e n d { d o c u m e n t } f u r t h e r d o w n, t y p e s e t t h e a l t e r e d d o c u m e n t, a n d s e e i f t h e e r r o r h a s o c c u r r e d i n t h e t e x t b e t w e e n w h e r e y o u l a s t e n d e d t h e i n p u t a n d t h e c u r r e n t l i n e w h e r e y o u h a v e e n d e d i t. O f c o u r s e, y o u w i l l n e e d t o m a k e s u r e t h a t a n y a c t i v e e n v i r o n m e n t s a r e a l s o e n d e d ( e.g., p l a c i n g t h e \e n d { d o c u m e n t } c o m m a n d a f t e r t h e e n d o f a q u o t a t i o n e n v i r o n m e n t ). T h i s s u c c e s s i v e m o v i n g o f t h e e n d i n g c o m m a n d d o w n t h r o u g h t h e d o c u m e n t, t o g e t h e r w i t h t h e j u d i c i o u s u s e o f a c o m m e n t c h a r a c t e r % t o t e m p o r a r i l y o m i t s u s p e c t l i n e s, c a n h e l p a g r e a t d e a l i n t r a c i n g a n e r r o n e o u s p i e c e o f L T ^ X i n p u t. S o m e Ι ^ Τ β Χ - o r i e n t e d e d i t i n g p r o g r a m s ( s u c h a s e m a c s ) a l l o w y o u t o s e l e c t p i e c e s o f i n p u t t e x t a n d t y p e s e t t h e p a s s a g e s a u t o m a t i c a l l y w i t h o u t h a v i n g t o c r e a t e a c o m p l e t e T g X d o c u m e n t, w h i c h i s v e r y c o n v e n i e n t f o r t r a c i n g e r r o r s ( s e e A p p e n d i x B ).
1 2 ---------------------
Installing N ew Type
M o s t c o m m o n f o n t f o r m a t s ( P o s t S c r i p t T y p e 1, T y p e 3, e t c., a n d T r u e T y p e f o n t s ) c a n b e u s e d w i t h a n y o f t h e I ^ T ^ X f o r m s ( i n c l u d i n g s t a n d a r d I ^ T ^ X, A, a n d p d f l A T g X ), a n d, o f c o u r s e, Ι ί Γ β Χ u s e s b y d e f a u l t f o n t s c r e a t e d w i t h M E T R F O N T. N e w e r f o r m a t s, s u c h a s t h e O p e n T y p e f o r m a t, c a n a l s o b e u s e d s i n c e i t i s p o s s i b l e t o c o n v e r t t h e m t o T y p e 1 f o n t s. D i r e c t s u p p o r t o f O p e n T y p e m a y b e a d d e d i n t h e f u t u r e.
T h e s t a n d a r d w a y t o i n s t a l l P o s t S c r i p t T y p e 1 f o n t s i s b y u s i n g t h e f o n t i n s t p r o g r a m b y A l a n J e f f r e y a n d R o w l a n d M c D o n n e l l. T h i s p r o g r a m i s a c t u a l l y a T ^ X a p p l i c a t i o n! A l t h o u g h f o n t i n s t i s q u i t e a p o w e r f u l p r o g r a m, i t c a n n o t h a n d l e a l l p o s s i b l e c a s e s, s o w e w i l l f u l l y d e s c r i b e t h e i n s t a l l a t i o n p r o c e d u r e o f v i r t u a l l y a n y P o s t S c r i p t T y p e 1 f o n t. I t i s v e r y i m p o r t a n t f o r t h e u s e r t o u n d e r s t a n d t h e i n s t a l l a t i o n o f T y p e 1 f o n t s, a s i t i s p o s s i b l e t o c o n v e r t a l l c o m m o n f o n t f o r m a t s t o T y p e 1. W e w i l l, h o w e v e r, s t a r t w i t h t h e d e f a u l t M E T R F O N T f o n t s.
12.1 Installing METRFONT Fonts
M o s t o f t h e t i m e, M E T R F O N T f o n t s c o m e f r o m "T ^ X - a w a r e" p e o p l e o r t h e C T A N a r c h i v e s, a n d t h u s t h e y c o m e w i t h i n s t a l l a t i o n i n s t r u c t i o n s. I n a n y c a s e t h e i n s t a l ­
l a t i o n o f M E T R F O N T f o n t s i s s i m p l e. I f t h e f o n t s c o m e w i t h s u p p o r t f i l e s, t h e n y o u j u s t p l a c e t h e M E T R F O N T s o u r c e s i n t h e T ^ X t r e e s ( u s u a l l y i n t e x m f/f o n t s/s o u r c e/) a n d t h e a c c o m p a n y i n g s u p p o r t f i l e s ( p a c k a g e s a n d f o n t d e f i n i t i o n s ) a n y w h e r e i n t e x m f/t e x/g e n e r i c/ o r t e x m f/t e x/l a t e x/. Y o u d o n o t r e a l l y n e e d t h e T F M f i l e s, a s t h e s e w i l l b e g e n e r a t e d a u t o m a t i c a l l y f r o m t h e M E T R F O N T s o u r c e s w h e n y o u u s e t h e f o n t s. H o w e v e r, i f T g X f o n t m e t r i c s a r e p r o v i d e d a n d y o u w a n t t o s a v e c o m p u t i n g t i m e, y o u c a n p u t t h e m a n y w h e r e i n t e x m f/f o n t s/t f m/.
N o w, y o u m u s t r e f r e s h t h e “ f i l e n a m e d a t a b a s e." U n f o r t u n a t e l y, t h e r e i s n o s i n g l e n a m e f o r t h i s o p e r a t i o n. I t s n a m e d e p e n d s c h i e f l y o n t h e T ^ X i m p l e m e n t a t i o n i n u s e, s o o n a U n i x s y s t e m, t h e s y s t e m a d m i n i s t r a t o r c a n p e r f o r m t h e o p e r a t i o n a b o v e b y i s s u i n g
$m k t e x l s r o r$ t e x h a s h
3 9 4 ^ 12 I n s t a l l i n g N e w T y p e
O n W i n d o w s i n s t a l l a t i o n s, t h i s o p e r a t i o n i s o f t e n l i n k e d s o m e w h e r e i n t h e s t a r t m e n u.
I f t h e f o n t s a r e n o t a c c o m p a n i e d b y s u p p o r t i n g p a c k a g e f i l e s, t h e n y o u c a n s i m p l y u s e t h e m a s d e s c r i b e d i n S e c t i o n 3.4 u s i n g t h e \f o n t c o m m a n d, a n d, o f c o u r s e, y o u m a y c r e a t e y o u r o w n p a c k a g e a n d f o n t d e f i n i t i o n f i l e s. B u t, w e w i l l d i s c u s s t h e s e t h i n g s l a t e r, i n S e c t i o n 1 2.4.
12.2 Installing Type 1 Text Fonts in BT^X
Type 1 fonts com e in tw o flavors ^ binary and A S C II. The binary form is actually an encrypted and com pressed version of the A S C II one. The usual filenam e extensions are .p f a for the A S C II form and .p fb for the binary form. Both form s can be used w ith T^TgX b y follow ing the same procedure. Type 1 fonts are usually accom panied b y the so-called "A d o b e Font M etric" file w h ich usually has the . a f m filenam e extension. W e w ill see the im portance of the A F M file in the next paragraphs.
Suppose that w e have a Type 1 font nam ed fo n t.p fb (the same applies to .p fa fonts). The typesetting engine needs only to know the dim ensions of the glyphs, so it is not really concerned about the actual shape of the glyphs. A fter all, for TgX, each letter is just a box, as w e have already explained, and as the reader m ay recall, a box has a height, a w idth, and possibly a depth. H ow ever, w e m ust stress that there is a fourth param eter that w e intentionally did not present until now. It is called italic correction
and is the am ount of additional w hite space to be added after the character to avoid the collision of the slanted character w ith the next one (com pare 'leaf
b' w ith 'leaf
b'). O f course, you w ill need the file fo n t .p fb (i.e., the glyphs them selves) w hen you w ant to print or p review you r docum ent. Rem em ber: TgX typesets and it does not
print! So, w e do need the font m etrics to m ake available for use w ith I^TgX. The actual glyphs w ill be used b y the d river program.
Usually, each Type 1 font is accom panied b y its font m etrics file, but just in case w e have a font but not the font metrics, there is a sim ple procedure by m eans of w h ich one can get the font m etrics. This procedure is described in the next subsection and can be safely skipped on a first reading.
12.2.1 Extracting Metric Information
The easiest w a y to get the f o n t. a f m file is b y opening f o n t. p fb in a font editor. There are several font editors, depending on the platform w e w o rk w ith. For U n ix systems, one can use the pfa edit font editor b y George W illiam s available from h ttp://p fa ed i t
. so u rce f o rg e. net. For other platform s, there are up to n o w only com m ercial products.
If you have such a program, open the fo n t.p fb file and use the extract utilities provided in its m enus. If you do not have such a program, another w ay to do the job is b y using Ghostscript. Since w e use Ghostscript, the font m ust already be kn ow n to the program w ith a proper declaration in the Fontmap file of you r Ghostscript installation
12.2 I n s t a l l i n g T y p e i T e x t F o n t s i n E l g X -φ- 395
( o r t h e F o n t m a p.G S f i l e i n n e w e r r e l e a s e s ). O f c o u r s e, w e c a n c o p y t h i s f i l e i n t o o u r c u r r e n t w o r k i n g d i r e c t o r y a n d m a k e t h e c h a n g e s t e m p o r a l. H e r e i s t h e r e c i p e t o g e t t h e A d o b e f o n t m e t r i c:
1. F i n d o u t t h e i n t e r n a l n a m e o f t h e f o n t a t h a n d f o n t. p f b, c o n v e r t t h e . p f b f i l e t o t h e A S C I I f o r m a t b y i s s u i n g p f b 2 p f a f o n t .p f b. T h i s c r e a t e s f o n t .p f a, w h i c h w h e n o p e n e d i n a n y t e x t e d i t o r a l l o w s u s t o r e a d t h e f o n t's n a m e b y l o o k i n g a t t h e l i n e t h a t s t a r t s w i t h /F o n t N a m e. I f t h e n a m e i s, f o r e x a m p l e, T i m e s - N e w R o m a n, t h e n t h i s l i n e w i l l l o o k l i k e t h i s: /F o n t N a m e /T i m e s - N e w R o m a n.
2. M o d i f y t h e F o n t m a p ( o r F o n t m a p. G S ) f i l e b y a d d i n g t o i t a l i n e l i k e
/T i m e s - N e w R o m a n (/p a t h/t o/f o n t.p f b );
w h e r e /p a t h/t o/ i s t h e l o c a t i o n o f f o n t .p f b i n o u r s y s t e m.
3. G e t t h e a f m f i l e w i t h t h e c o m m a n d
$g e t a f m f o n t.p f b | g s n d - > f o n t.a f m ( t h e c o m m a n d a b o v e i s w r i t t e n f o r t h e U n i x e n v i r o n m e n t ). N o w, w e h a v e t o p r e p a r e m e t r i c f i l e s t h a t T g X c a n u n d e r s t a n d s i n c e i t c a n n o t u n d e r ­ s t a n d A F M f i l e s. Τ β Χ c a n d e a l o n l y w i t h T g X f o n t m e t r i c s. H e r e, w e h a v e o n e s e r i o u s r e s t r i c t i o n: e a c h T F M f i l e c a n n o t c o n t a i n m e t r i c d a t a f o r m o r e t h a n 2 5 6 g l y p h s. T h i s i s t h e m o s t s e r i o u s r e s t r i c t i o n t h a t Ω r e m o v e s, a n d i t i s a l s o t h e r e a s o n w h y w h e n s w i t c h i n g l a n g u a g e s, f o r e x a m p l e f r o m E n g l i s h t o G r e e k, w e h a v e t o s w i t c h f o n t s a n d, c o n s e ­ q u e n t l y, w e ( a r t i f i c i a l l y!) n e e d t o h a v e c o m m a n d s s u c h a s \t e x t l a t i n, a s d e s c r i b e d i n C h a p t e r 1 0. B u t a n A F M f i l e m a y c o n t a i n m e t r i c i n f o r m a t i o n f o r m a n y g l y p h s. T h u s, w e h a v e t o c r e a t e o u r T F M b y s e l e c t i n g 2 5 6 g l y p h s f r o m t h e m a n y g l y p h m e t r i c s i n t h e A F M f i l e. T h i s i s d o n e b y w h a t w e c a l l a n encoding vector. A c t u a l l y, a n e n c o d i n g v e c t o r i s s o m e t h i n g m o r e. I t l i s t s i n a s e q u e n c e t h e n a m e s o f t h e g l y p h s f o r w h i c h w e w a n t t o g e t i n f o r m a t i o n, a n d t h e o r d e r is i m p o r t a n t, a s T g X r e a l l y i d e n t i f i e s e a c h g l y p h b y i t s p o s i t i o n i n t h i s r o w o f 2 5 6 g l y p h s. 12.2.2 Encoding Vectors U s i n g C o m p u t e r S c i e n c e n o m e n c l a t u r e, w e c a n s a y t h a t a n e n c o d i n g v e c t o r i s j u s t a n a r r a y o f g l y p h n a m e s t h a t d e s c r i b e s t h e a r r a n g e m e n t o f g l y p h s i n a f o n t. E n c o d i n g v e c t o r s a r e u s e d t o r e a r r a n g e t h e p o s i t i o n s o f t h e v a r i o u s g l y p h s i n a f o n t. N a t u r a l l y, i n t h i s s e c t i o n w e w i l l d e a l o n l y w i t h e n c o d i n g v e c t o r s t h a t c a n b e a p p l i e d t o P o s t S c r i p t f o n t s. T h e d e f i n i t i o n o f a n e n c o d i n g v e c t o r c o n s i s t s o f i t s n a m e, a s e q u e n c e o f g l y p h n a m e s e n c l o s e d i n b r a c k e t s, a n d t h e k e y w o r d d e f. T h e e n c o d i n g n a m e a n d t h e g l y p h n a m e s m u s t b e p r e f i x e d w i t h a s l a s h (/), a s e a c h e n c o d i n g v e c t o r i s a v a l i d P o s t S c r i p t d a t a s t r u c t u r e a n d a s s u c h i t m u s t f o l l o w t h e c o n v e n t i o n s o f t h e P o s t S c r i p t l a n g u a g e. H e r e i s a n e x a m p l e d e f i n i t i o n: /g r e e k [ /a l p h a /b e t a /g a m m a /d e l t a...] d e f 396 ^ 12 I n s t a l l i n g N e w T y p e O b v i o u s l y, w e m u s t k n o w t h e n a m e s o f t h e g l y p h s o f a n e x i s t i n g f o n t i n o r d e r t o a p p l y a n e n c o d i n g v e c t o r t o t h i s f o n t. U s u a l l y, L a t i n f o n t s u s e s t a n d a r d n a m e s f o r e a c h g l y p h, b u t w e c a n n o t r e l y o n t h i s a s s u m p t i o n, s o i t i s b e s t t o c h e c k t h e n a m e s o f t h e g l y p h s o f t h e f o n t t h a t w e w a n t t o r e e n c o d e. T h i s c a n b e d o n e b y i n s p e c t i n g t h e P o s t S c r i p t f o n t w i t h a f o n t e d i t o r o r a f o n t v i e w e r s u c h a s g f o n t v i e w. T h i s f o n t v i e w e r i s p a r t o f t h e G n o m e d e s k t o p e n v i r o n m e n t ( h t t p: //w w w. g n o m e. o r g ). N o w, t h e p r o b l e m t h a t w e h a v e t o f a c e i s t o d e c i d e h o w t o o r d e r t h e s e g l y p h s i n o u r e n c o d i n g v e c t o r. T h e c h o i c e s t h a t w e w i l l h a v e t o m a k e d e p e n d h e a v i l y o n h o w w e a r e g o i n g t o u s e a p a r t i c u l a r f o n t. T h u s, a f o n t w i t h G r e e k l e t t e r s c a n b e u s e d a s a m a t h e m a t i c a l f o n t o r a s a f o n t t h a t w i l l b e u s e d t o t y p e s e t o r d i n a r y G r e e k t e x t. O n c e s u c h i s s u e s h a v e b e e n d e c i d e d, w e d e f i n e t h e e n c o d i n g v e c t o r. F o r e x a m p l e, i f o n e i s g o i n g t o u s e a G r e e k f o n t t o t y p e s e t G r e e k t e x t, t h e n t h i s f o n t m u s t f o l l o w t h e c o n v e n t i o n s o f t h e f o n t s d e s i g n e d b y C l a u d i o B e c c a r i. A l t h o u g h t h i s p a r t i c u l a r g l y p h a r r a n g e m e n t i s n o t u n i v e r s a l l y a c c e p t e d, i t c a n b e s a f e l y u s e d t o r e e n c o d e f o n t s. T h e t a s k o f d e f i n i n g a n o f f i c i a l e n c o d i n g f o r G r e e k f o n t s i s a n o n g o i n g p r o j e c t. S i n c e t h e r e i s n o o f f i c i a l d e f i n i t i o n, w e h a v e t o f i n d t h e o r d e r o f t h e g l y p h s u s i n g t h e d e f a u l t f o n t s b y u s i n g t h e n f s s f o n t. t e x i n p u t f i l e. W e r u n L T g X o n t h i s f i l e a n d f o l l o w t h e i n s t r u c t i o n s:$ l a t e x n f s s f o n t
* N F S S f o n t t e s t p r o g r a m v e r s i o n < v 2.0 e >
*
* F o l l o w t h e i n s t r u c t i o n s
N a m e o f t h e f o n t t o t e s t = grmnlOOO
No w t y p e a t e s t c o m m a n d (\h e l p f o r h e l p ):
*\help
\i n i t s w i t c h e s t o a n o t h e r f o n t;
\s t o p o r \b y e f i n i s h e s t h e r u n;
\t a b l e p r i n t s t h e f o n t l a y o u t i n t a b u l a r f o r m a t;
\t e x t p r i n t s a s a m p l e t e x t, a s s u m i n g T e X t e x t f o n t c o n v e n t i o n s; \s a m p l e c o m b i n e s \t a b l e a n d \t e x t;
\m i x t u r e m i x e s a b a c k g r o u n d c h a r a c t e r w i t h a s e r i e s o f o t h e r s; \a l t e r n a t i o n i n t e r l e a v e s a b a c k g r o u n d c h a r a c t e r w i t h a s e r i e s; \a l p h a b e t p r i n t s a l l l o w e r c a s e l e t t e r s w i t h i n a g i v e n b a c k g r o u n d; \A L P H A B E T p r i n t s a l l u p p e r c a s e l e t t e r s w i t h i n a g i v e n b a c k g r o u n d; \s e r i e s p r i n t s a s e r i e s o f l e t t e r s w i t h i n a g i v e n b a c k g r o u n d;
\l o w e r s p r i n t s a c o m p r e h e n s i v e t e s t o f l o w e r c a s e;
\u p p e r s p r i n t s a c o m p r e h e n s i v e t e s t o f u p p e r c a s e;
\d i g i t s p r i n t s a c o m p r e h e n s i v e t e s t o f n u m e r a l s;
\m a t h p r i n t s a c o m p r e h e n s i v e t e s t o f T e X m a t h i t a l i c;
12.2 I n s t a l l i n g T y p e i T e x t F o n t s i n E l g X -φ- 397
\n a m e s p r i n t s a t e x t t h a t m i x e s u p p e r a n d l o w e r c a s e;
\p u n c t p r i n t s a p u n c t u a t i o n t e s t;
\b i g t e s t c o m b i n e s m a n y o f t h e a b o v e r o u t i n e s;
\h e l p r e p e a t s t h i s m e s s a g e;
a n d y o u c a n u s e o r d i n a r y T e X c o m m a n d s ( e.g., t o \i n p u t a f i l e )
*\table
*\bye
[ 1 ]
O u t p u t w r i t t e n o n n f s s f o n t.d v i ( 1 p a g e, 1 0 7 0 4 b y t e s ).
T r a n s c r i p t w r i t t e n o n n f s s f o n t.l o g.
N o w, w e c a n c r e a t e t h e e n c o d i n g v e c t o r a n d s t o r e i t i n a f i l e w i t h a r e a s o n a b l e n a m e. W e f i r s t p r i n t t h e o u t p u t o f t h e T^T ^X r u n a b o v e a n d u s e i t t o d e f i n e t h e e n c o d i n g v e c t o r. O f c o u r s e, t h i s t a s k a s s u m e s t h a t w e a r e f a m i l i a r w i t h t h e g l y p h s a n d t h e i r n a m e s.
T h e f i l e w h e r e w e s t o r e a n e n c o d i n g v e c t o r i s a l s o t h e r i g h t p l a c e f o r d e f i n i n g l i g a t u r e s b e t w e e n g l y p h s. L i g a t u r e s a r e d e f i n e d a f t e r t h e d e f i n i t i o n o f t h e e n c o d i n g v e c t o r. E a c h l i n e d e f i n i n g a l i g a t u r e i s l i k e t h e f o l l o w i n g o n e
% L I G K E R N q u e s t i o n d o w n q u e s t i o n d o w n =: g u i l l e m o t r i g h t ;
I t s t a r t s w i t h % L I G K E R M a n d t h e a c t u a l d e f i n i t i o n o f t h e l i g a t u r e. T h e l i g a t u r e d e f i n i t i o n m u s t b e t e r m i n a t e d w i t h a s e m i c o l o n. N o t e t h a t w e c a n h a v e m o r e t h a n o n e l i g a t u r e d e f i n i t i o n a s i n t h e f o l l o w i n g e x a m p l e:
% L I G K E R M h y p h e n h y p h e n =: e n d a s h ; e n d a s h h y p h e n =: e m d a s h ;
O f c o u r s e, a s i s e v i d e n t, t h e t w o d e f i n i t i o n s a r e r e l a t e d.
W e n o w e x p l a i n h o w t o s e t u p l i g a t u r e r u l e s. A s s u m e t h a t w e w a n t t w o g l y p h s t o c o m b i n e i n t o a n e w o n e. S u c h a c a s e i s t h e f i l i g a t u r e, w h e r e t h e l e t t e r f f o l l o w e d b y a n i b e c o m e s f i. T h e f i l i g a t u r e i s s p e c i f i e d a s f o l l o w s:
%
L I G K E R N f i =: f i ;
N o t e t h a t s p a c e s a r e i m p o r t a n t i n t h e a b o v e. T o a d d t h e f f a n d f f i l i g a t u r e s, w e m a y w r i t e:
% L I G K E R N f i =: f i ; f f =: f f ; f f i =: f f i ;
T h i s i s a l s o h o w w e h a v e a c c e s s t o a c c e n t e d l e t t e r s i n l a n g u a g e s s u c h a s G r e e k, H e b r e w, a n d o t h e r s. F o r e x a m p l e, w e u s e
% L I G K E R N t o n o s a l p h a =: a l p h a t o n o s ;
t o s p e c i f y t h a t t h e a c u t e ’ f o l l o w e d b y a
s h o u l d b e c o m e a ά.
A n o t h e r t y p e o f l i g a t u r e i s w h e n one
o f t h e l e t t e r s i s s u b s t i t u t e d b y s o m e t h i n g e l s e. F o r e x a m p l e, i n G r e e k, a s i g m a ( σ ) a p p e a r i n g a t t h e e n d o f a w o r d m u s t c h a n g e t o a f i n a l s i g m a ( ς ). T h u s, i f a s i g m a i s f o l l o w e d b y, s a y, a n e x c l a m a t i o n m a r k, t h e n t h e
398 ^ 12 I n s t a l l i n g N e w T y p e
s i g m a m u s t b e c o m e a f i n a l s i g m a ( w h i c h i s u s u a l l y c a l l e d i n s i d e a f o n t s i g m a l ) a n d t h e e x c l a m a t i o n m a r k s h o u l d r e m a i n i n i t s p o s i t i o n. T h i s s i m p l e r u l e c a n b e e x p r e s s e d a s f o l l o w s:
% L I G K E R N s i g m a e x c l a m =:| s i g m a l ;
T h e s y m b o l = : I i s u s e d t o s a y t h a t if sigma is followed by an exclamation mark replace
the sigma with sigmal but leave the exclamation mark at its position
( t h i s i s w h a t t h e I c h a r a c t e r s t a n d s f o r ). I f t h e f i r s t c h a r a c t e r i s t o r e m a i n i n t a c t b u t t h e s e c o n d c h a r a c t e r m u s t c h a n g e, t h e n t h e =: I s y m b o l s h o u l d b e r e p l a c e d b y t h e I =: s y m b o l. I f t h e l i g a t u r e m e c h a n i s m s h o u l d s k i p o n e o r t w o c h a r a c t e r s b e f o r e r e s u m i n g t h e s e a r c h o f l i g a t u r e s, t h e n w e u s e =: > a n d =:» o r =: I >, =: I », I =: >, a n d I =:». U n f o r t u n a t e l y, i t i s s t i l l n o t p o s s i b l e t o r e s c a n t h e p r e v i o u s c h a r a c t e r s f o r l i g a t u r e s. T h u s, s y m b o l s s u c h a s <=: a r e n o t a v a i l a b l e. T h i s i s a m i s s i n g f e a t u r e t h a t w o u l d b e v e r y u s e f u l f o r c o m p l e x t y p e f a c e s.
A n i n t e r e s t i n g t h i n g i s h o w w e c a n i n c o r p o r a t e s p e c i a l c h a r a c t e r s, s u c h a s t h e s p a c e c h a r a c t e r, i n t o l i g a t u r e d e f i n i t i o n s. T o d o t h i s, w e f i r s t d e f i n e a s h o r t h a n d f o r t h i s
c h a r a c t e r. F o r e x a m p l e, t h e f o l l o w i n g c o d e d e f i n e s t h a t t h e s y m b o l I I w i l l s t a n d f o r a
s p a c e:
% L I G K E R N I I = 3 9 ;
W e a l w a y s u s e t h i s n u m b e r a n d t h e n u s e i t f o r l i g a t u r e s l i k e t h i s:
% L I G K E R N s I I =: s i g m a l ;
N o t e t h a t h e r e w e d i d n o t u s e =: I. W i t h t h e s a m e m e c h a n i s m, w e a r e a b l e t o u s e i n i t i a l a n d f i n a l f o r m s o f l e t t e r s. F o r e x a m p l e, t h e w o r d "b o o k" i n G r e e k i s β ι β λ ί ο. N o t e t h a t t h e t w o b e t a s a r e d i f f e r e n t. T o g e t t h i s e f f e c t, o n e c a n u s e t h e f o l l o w i n g c o d e:
% L I G K E R N I I b e t a =: b e t a l ;
R e a d y - t o - u s e e n c o d i n g v e c t o r s a r e p r o v i d e d b y t h e d i s t r i b u t i o n o f t h e kerkis
f o n t f a m i l y a v a i l a b l e f r o m h t t p: //i r i s. m a t h. a e g e a n. g r/s o f t w a r e/k e r k i s.
12.2.3 Creating Virtual Fonts and Metric Files
A s w e h a v e a l r e a d y e x p l a i n e d, T g X i s a t y p e s e t t i n g s y s t e m t h a t n e e d s t o k n o w o n l y t h e d i m e n s i o n s o f e a c h g l y p h o f a g i v e n f o n t t o s t a r t t y p e s e t t i n g u s i n g t h i s f o n t. C o n ­
s e q u e n t l y, T g X d o e s n o t r e a l l y c a r e w h e r e t h e g l y p h s a r e s t o r e d a n d h o w t h e y a r e s t o r e d —t h i s i s s o m e t h i n g a d r i v e r m u s t b e a w a r e o f. T h i s m a y l e a d s o m e o n e t o c o n ­
c l u d e t h a t w e c a n t y p e s e t a d o c u m e n t u s i n g a virtual
f o n t t h a t c o n t a i n s g l y p h s f r o m d i f f e r e n t r e a l f o n t s. W e l l, t h i s i s n o t q u i t e t r u e i n t h e s e n s e t h a t T g X d i d n o t p r o v i d e t h i s f a c i l i t y o r i g i n a l l y. T h e d e s i g n e r o f T g X i n t r o d u c e d v i r t u a l f o n t s ( a n i d e a t h a t w a s d e v i s e d b y D a v i d F u c h s ) a t a l a t e r s t a g e t o a l l o w p e o p l e t o d o e x a c t l y w h a t w e d e s c r i b e d —t o u s e g l y p h s f r o m d i f f e r e n t f o n t s i n a t r a n s p a r e n t w a y s o t h a t i t i s n o t o b v i o u s t h a t w e a r e a c t u a l l y u s i n g d i f f e r e n t f o n t s. N o w, w e w i l l d e s c r i b e h o w w e c a n g e t a T F M f i l e f r o m a n A F M f i l e.
12.2 I n s t a l l i n g T y p e i T e x t F o n t s i n Ϊ Π | ϊ Χ -φ- 399
L e t u s a s s u m e t h a t w e h a v e t h e T i m e s - N e w R o m a n f o n t s t o r e d i n t h e f i l e t n r .p f b. M o r e o v e r, a s s u m e t h a t t h e f o n t m e t r i c s a r e s t o r e d i n t h e f i l e t n r. a f m a n d t h a t w e w a n t t o r e e n c o d e t h e f o n t u s i n g a n e n c o d i n g v e c t o r s t o r e d i n f i l e m y e n c. e n c, I f w e w a n t t o u s e t h e f o n t w i t h o u t k e r n i n g p a i r s a n d l i g a t u r e s, w e c a n u s e a f m 2t f m ( b y T o m a s R o k i c k i ) t o g e t t h e f o n t m e t r i c s:
$a f m 2 t f m t n r.a f m r t n r.t f m » t n r.m a p I f w e w a n t t o r e e n c o d e t h e f o n t, w e h a v e t o u s e t h e f o l l o w i n g c o m m a n d:$ a f m 2 t f m t n r.a f m - T m y e n c.e n c - v t n r 8 a t n r 8 r » t n r.m a p
I n t h e e x a m p l e s a b o v e w e s t o r e d t h e o u t p u t o f a F M 2T F M t o f i l e t n r. m a p. T h i s f i l e c o n t a i n s i n f o r m a t i o n t h a t m u s t b e e d i t e d. T h e m o d i f i e d i n f o r m a t i o n s h o u l d b e c o p i e d t o t h e f i l e p s f o n t s. m a p o r e l s e t h i s f i l e m u s t b e c o p i e d t o t h e d i r e c t o r y w h e r e p s f o n t s. m a p r e s i d e s. I n t h e l a t t e r c a s e, w e m u s t a l s o a d d t h e f o l l o w i n g l i n e i n t h e f i l e c o n f i g .p s:
p + t n r.m a p
T h e c o m m a n d a b o v e g e n e r a t e s t w o f i l e s: t h e "r a w" T F M f i l e t n r 8 r .t f m a n d t h e vir­
tual property list
f i l e t n r 8 a.v p l. T h i s f i l e c a n b e f u r t h e r p r o c e s s e d b e f o r e i t w i l l b e t r a n s f o r m e d t o a v i r t u a l f o n t w i t h t h e f o l l o w i n g c o m m a n d:
$v p t o v f t n r 8 a t n r 8 a.v f t n r 8 a.t f m W e c o u l d u s e o t h e r n a m e s f o r t h e f o n t f i l e s i n s t e a d o f t h e n a m e s t n r 8 a a n d t n r 8 r. B u t, d u e t o t h e g r e a t a m o u n t o f a v a i l a b l e f o n t s, t h e r e a r e s t a n d a r d r u l e s f o r c r e a t i n g t h e s e n a m e s i n o r d e r t o a v o i d c o n f l i c t. T h e r e a d e r i s a d v i s e d t o c o n s u l t [ 3 ] i f h e o r s h e i n t e n d s t o s h a r e f o n t s w i t h o t h e r p e o p l e. N o w, o p e n t h e f i l e t n r. m a p i n a t e x t e d i t o r. I t s h o u l d h a v e a l i n e l i k e t n r 8 r T i m e s - N e w R o m a n " m y e n c R e E n c o d e F o n t " < m y e n c.e n c T h e w a y t h i s l i n e a p p e a r s i n t h e f i l e w i l l m a k e d v i p s b e l i e v e t h a t T i m e s - N e w R o m a n i s a r e s i d e n t f o n t o f o u r P o s t S c r i p t p r i n t e r o r e m u l a t o r. G e n e r a l l y, t h i s i s n o t t h e c a s e, s o w e n e e d t o m o d i f y t h i s e n t r y a s f o l l o w s: t n r 8 r T i m e s - N e w R o m a n " m y e n c R e E n c o d e F o n t " < m y e n c.e n c < t n r.p f b W i t h t h i s l i n e, w e i n s t r u c t d v i p s t o e m b e d t h e f o n t t n r. p f b w h e n e v e r i t g e n e r a t e s a P o s t S c r i p t f i l e f r o m a D V I f i l e t h a t u s e s t h e f o n t t n r 8 r. W e a r e n o w r e a d y t o u s e o u r f o n t b y u s i n g t h e \f o n t c o m m a n d t o c a l l t h e f o n t t n r 8 r i n a n i n p u t f i l e ( s e e S e c t i o n 3.4 ) p r o v i d e d t h a t a l l o f t h e f o n t's f i l e s t h a t w e j u s t c r e a t e d a r e i n t h e s a m e d i r e c t o r y w i t h o u r d o c u m e n t ( f o r a s y s t e m w i d e i n s t a l l a t i o n, s e e S e c t i o n 1 2.5 ). I f w e h a v e a t o u r d i s p o s a l a l l o f t h e s h a p e s a n d s e r i e s o f t h i s f o n t, w e c a n c r e a t e t h e n e c e s s a r y f o n t d e f i n i t i o n f i l e s t h a t w i l l a l l o w u s t o a c c e s s s h a p e s a n d s e r i e s w i t h t h e c o m m a n d s t h a t w e h a v e l e a r n e d. F o r m o r e i n f o r m a t i o n o n t h e c o n s t r u c t i o n o f f o n t d e f i n i t i o n f i l e s, s e e S e c t i o n 1 2.4. 40 ο -φ- 12 I n s t a l l i n g N e w T y p e 12.2.4 Creating More Fonts from a Type 1 Font A T y p e 1 f o n t c a n b e u s e d t o c r e a t e a d d i t i o n a l s h a p e s f r o m t h e g l y p h s o f t h e f o n t. F o r e x a m p l e, w e c a n e a s i l y c r e a t e s l a n t e d g l y p h s, a l t h o u g h s l a n t e d g l y p h s m a y n o t e x i s t i n o u r o r i g i n a l f o n t, o r w e c a n u s e extended o r condensed g l y p h s o r e v e n ( f a k e ) s m a l l c a p i t a l s. E x t e n d e d a n d c o n d e n s e d g l y p h s a r e g l y p h s t h a t a r e s c a l e d only h o r i z o n t a l l y b y a f a c t o r b i g g e r o r s m a l l e r t h a n 1, r e s p e c t i v e l y. T h i s i s d o n e w h e n w e c r e a t e T F M f i l e s. H e r e a r e t h e n e c e s s a r y c o m m a n d s: • U s e$ a f m 2 t f m t n r.a f m - T m y e n c.e n c - s 0.1 6 7 - v t n r o 8 a t n r 8 r
i n o r d e r t o c r e a t e t h e ( v i r t u a l ) f o n t t n r o 8 a w h o s e g l y p h s a r e s l a n t e d t o t h e r i g h t a t 1 6.7 %. U s e a n e g a t i v e n u m b e r t o g e t s l a n t t o t h e l e f t!
• U s e
$a f m 2 t f m t n r.a f m - T m y e n c.e n c - e 1.2 - v t n r e 8 a t n r e 8 r i n o r d e r t o c r e a t e t h e ( v i r t u a l ) f o n t t n r e 8 a t h a t i s e x t e n d e d b y a f a c t o r o f 1.2, o r u s e a n u m b e r l e s s t h a n 1 t o g e t a c o n d e n s e d f o n t. • U s e$ a f m 2 t f m t n r.a f m - T m y e n c.e n c - V t n r s c 8 a t n r s c 8 r
i n o r d e r t o c r e a t e a f a k e s m a l l c a p i t a l f o n t ( t n r s c 8 a ) i f y o u r f o n t f a m i l y d o e s n o t p r o v i d e a r e a l s m a l l c a p i t a l f o n t. N o t e t h a t w e u s e a c a p i t a l V i n s t e a d o f a v ). T h e d e f a u l t s c a l i n g f a c t o r i s 8 0 % b u t i t c a n b e c h a n g e d w i t h t h e - c o p t i o n. F o r e x a m p l e, i n o r d e r t o c r e a t e ( f a k e ) s m a l l c a p i t a l s w i t h a s c a l i n g f a c t o r o f 7 5 %, w e s h o u l d u s e
a f m 2 t f m t n r.a f m - T m y e n c.e n c - c 0.7 5 - V t n r s c 8 a t n r s c 8 r
12.3 Virtual Property List Files
I n t h i s s e c t i o n w e d i s c u s s t h e s t r u c t u r e o f v i r t u a l p r o p e r t y l i s t f i l e s. T h i s f i l e f o r m a t i s h u m a n - r e a d a b l e a n d, c o n s e q u e n t l y, i t c a n b e m o d i f i e d i n o r d e r t o a d d m o r e f e a t u r e s t o t h e v i r t u a l f o n t s. A v i r t u a l p r o p e r t y l i s t f i l e c o n s i s t s o f t h r e e p a r t s o r l i s t s 1: t h e h e a d e r l i s t ( f r o m t h e s t a r t u p t o t h e L I G T A B L E l i s t ), t h e l i g a t u r e l i s t, a n d t h e m a i n l i s t t h a t d e s c r i b e s e a c h c h a r a c t e r t h a t g o e s i n t o t h e v i r t u a l f o n t. H e r e i s a n e x a m p l e ( o f a p a r t ) o f a v i r t u a l p r o p e r t y l i s t f i l e:
( V T I T L E C r e a t e d b y a f m 2 t f m k.a f m - T k e r k i s e c.e n c - v e k 8 a )
( C O M M E N T P l e a s e e d i t t h a t V T I T L E i f y o u e d i t t h i s f i l e )
( F A M I L Y T e X - e k 8 r )
( C O D I N G S C H E M E k e r k i s e c )
I. T h e t e r m l i s t h a s i t s r o o t s i n t h e L i s p p r o g r a m m i n g l a n g u a g e, w h i c h u s e s a s i m i l a r s y n t a x.
12.3 V i r t u a l P r o p e r t y L i s t F i l e s -· 40 i
( D E S I G N S I Z E R 1 0.0 )
( D E S I G N U N I T S R 1 0 0 0 )
( C O M M E N T D E S I G N S I Z E ( 1 e m ) I S I N P O I N T S )
( C O M M E N T O T H E R D I M E N S I O N S A R E M U L T I P L E S O F D E S I G N S I Z E/1 0 0 0 )
( F O N T D I M E N ( S L A N T R 0 )
( S P A C E D 3 2 0 )
( S T R E T C H D 2 0 0 )
( S H R I N K D 1 0 0 )
( X H E I G H T D 4 8 5 )
( Q U A D D 1 0 0 0 )
( E X T R A S P A C E D 1 1 1 )
)
( M A P F O N T D 0
( F O N T N A M E e k 8 r )
( F O N T A T R 1 2 0 0 )
( F O N T S I Z E R 1 0 0 0 )
)
( L I G T A B L E
( L A B E L C f ) ( C O M M E N T f )
( L I G C i 0 2 )
( L I G C j 0 3 0 )
( S T O P )
( L A B E L 0 2 3 ) ( C O M M E N T f f )
( L I G C 1 0 2 5 )
( L I G C i 0 2 4 )
( S T O P )
( L A B E L C A )
( K R N C w R - 6 8 )
( K R N C v R - 7 5 )
)
( C H A R A C T E R C V ( C H A R W D R 6 7 6 )
( C H A R H T R 6 8 1 )
( C H A R I C R 4 9 )
)
T h e h e a d e r l i s t p r o v i d e s s o m e g e n e r a l i n f o r m a t i o n. I n t h e e x a m p l e a b o v e w e s e e t h a t t h e f a m i l y n a m e o f t h e f o n t i s T e X - e k 8 r e n c o d e d a c c o r d i n g t o t h e k e r k i s e c e n c o d i n g s c h e m e. T h e d e s i g n s i z e o f t h e f o n t i s 1 0 p t, a n d a l l o t h e r s i z e s a r e g i v e n i n d e s i g n u n i t s, w h i c h a r e 1 0 0 0 f o r t h i s f o n t ( 1 0 0 0 u n i t s e q u a l s 1 e m ). E n t e r i n g t h e F O N T D I M E N l i s t, w e s e e ( i n t h e o r d e r o f t h e e x a m p l e ) t h a t t h i s f o n t i s n o t s l a n t e d ( z e r o S L A N T ), t h e i n t e r w o r d s p a c e i s 3 2 0 u n i t s, a n d i t c a n s t r e t c h 2 0 0 u n i t s o r s h r i n k 1 0 0 u n i t s. T h e X H E I G H T a n d QUAD
40 2 -φ- 12 I n s t a l l i n g N e w T y p e
l i s t s s p e c i f y t h e l e n g t h o f t h e d i m e n s i o n s 1 e x a n d 1 e m. T h e E X T R A S P A C E l i s t d e f i n e s t h e s p a c e t h a t Τ β Χ p u t s a t t h e e n d o f a s e n t e n c e p r o v i d e d t h a t \n o f r e n c h s p a c i n g i s e n a b l e d. T h i s c o m m a n d c a n c e l s t h e e f f e c t o f t h e \f r e n c h s p a c i n g c o m m a n d. T h e s u b l i s t s o f t h e F O N T D I M E N l i s t c o r r e s p o n d t o t h e f o n t d i m e n s i o n s d e s c r i b e d i n S e c t i o n 1 2.4. T h e COMM ENT l i s t i s u s e d t o i n t r o d u c e c o m m e n t s i n a p r o p e r t y l i s t.
O n e o f t h e m o s t i m p o r t a n t l i s t s i s t h e M A P F O N T l i s t. I n t h e e x a m p l e a b o v e, i t i s u s e d t o s a y t h a t t h e d e f a u l t e x t e r n a l f o n t t o u s e f o r t h e v i r t u a l f o n t i s n a m e d e k 8 r. I n a d d i t i o n, w e s p e c i f i e d t h e a c t u a l d e s i g n s i z e o f t h e e x t e r n a l f o n t a n d t h e s c a l i n g f a c t o r. T h e r o l e o f t h i s l i s t i s t o m a k e i t p o s s i b l e f o r o n e v i r t u a l f o n t t o d r a w c h a r a c t e r s f r o m m o r e t h a n o n e r e a l f o n t. T h i s i s d o n e b y a s s i g n i n g a n u m b e r t o e a c h r e a l f o n t t h a t w e w a n t t o u s e. T h u s, t h e l i n e s
( M A P F O N T D 0
( F O N T N A M E T i m e s - R o m a n )
)
( M A P F O N T D 1
( F O N T N A M E s y m b o l )
)
( M A P F O N T D 2
( F O N T N A M E c m r 1 0 )
( F O N T A T D 2 0 )
)
l o a d t w o r e a l f o n t s, T i m e s - R o m a n a n d s y m b o l, a n d o n e m o r e, c m r l O, a t t h e s i z e o f 2 0 u n i t s; e a c h o n e i s a s s i g n e d t o o n e o f t h e n u m b e r s 0, 1, a n d 2, r e s p e c t i v e l y. T h e s e
n u m b e r s a r e u s e d i n o r d e r t o s e l e c t t h e r e a l f o n t t o b e u s e d i n t h e t h i r d p a r t o f t h e
v i r t u a l p r o p e r t y l i s t f i l e. I n t h i s t h i r d p a r t, w e h a v e a s e q u e n c e o f s t a t e m e n t s, o n e f o r e a c h g l y p h. E a c h s t a t e m e n t d e s c r i b e s th e d i m e n s i o n s o f t h e g l y p h f r o m w h i c h th e r e a l f o n t i s t o b e d r a w n a n d h o w i t i s d r a w n. T h e f i r s t l i n e i d e n t i f i e s t h e g l y p h i n t h e v i r t u a l f o n t. I t s c o d e p o i n t c a n b e e x p r e s s e d i n f o u r d i f f e r e n t w a y s: b y t h e l e t t e r D a n d a d e c i m a l n u m b e r, b y t h e l e t t e r 0 a n d a n o c t a l n u m b e r, b y t h e l e t t e r H a n d a h e x a d e c i m a l n u m b e r, a n d b y t h e l e t t e r C a n d t h e g l y p h n a m e. H e r e i s h o w o n e c a n e x p r e s s t h e s a m e t h i n g i n a l l f o u r p o s s i b l e w a y s:
C H A R A C T E R C V C H A R A C T E R D 6 8
C H A R A C T E R 0 1 2 6 C H A R A C T E R H 4 4
I n t h e e x a m p l e a b o v e w e s e e t h i s i n f o r m a t i o n f o r t h e c h a r a c t e r V. I t s w i d t h i s 6 7 6 u n i t s, i t s h e i g h t 6 8 1 u n i t s, a n d i t s i t a l i c c o r r e c t i o n i s 4 9 u n i t s.
A n o t h e r v a r i a b l e n o t a p p e a r i n g i n t h e e x a m p l e o f t h e c h a r a c t e r V i s t h e C H A R D P v a r i a b l e, w h i c h c o n t r o l s t h e d e p t h o f t h e c h a r a c t e r ( i.e., h o w m u c h t h e c h a r a c t e r e x t e n d s b e l o w t h e b a s e l i n e ). F o r e x a m p l e, i n t h e f o n t a b o v e, t h e a m p e r s a n d a p p e a r s i n t h e v i r t u a l p r o p e r t y l i s t f i l e a s
( C H A R A C T E R 0 4 6 ( C O M M E N T a m p e r s a n d )
12.3 V i r t u a l P r o p e r t y L i s t F i l e s -· 40 3
( C H A R W D R 8 0 0 )
( C H A R H T R 6 9 4 )
( C H A R D P R 1 3 )
)
t h a t i s, i t e x t e n d s b e l o w t h e b a s e l i n e b y 1 3 u n i t s. N o t e t h a t f o r t h e c h a r a c t e r V w e h a d u s e d i t s n a m e i n t h e C H A R A C T E R s t a t e m e n t, b u t f o r t h e a m p e r s a n d w e u s e d i t s p o s i t i o n i n t h e f o n t ( w h i c h i s t h e p o s i t i o n o f t h e a m p e r s a n d i n t h e e n c o d i n g v e c t o r k e r k i s e c. e n c ).
T h e g l y p h d e s c r i p t i o n a b o v e i s t h e d e s c r i p t i o n o f a r e a l g l y p h. I f w e w a n t t o h a v e t h e d e s c r i p t i o n o f a g l y p h t h a t a c t u a l l y b e l o n g s t o s o m e o t h e r f o n t, w e m u s t h a v e a g l y p h d e s c r i p t i o n l i k e t h e f o l l o w i n g o n e:
( C H A R A C T E R H A F ( C O M M E N T c o d e p o i n t i s 1 7 5 )
( C H A R W D R 0.6 6 5 )
( C H A R H T R 0.7 9 9 )
( C H A R I C R 0.0 6 5 )
( M A P
( S E L E C T F O N T D 0 )
( S E T C H A R 0 4 1 ) ( C O M M E N T c o d e p o i n t i s 2 7 )
)
)
H e r e, w e s e e t h a t t h e d i m e n s i o n s a r e e x p r e s s e d i n d e c i m a l p o i n t u n i t s. T h i s i s p o s s i b l e w h e n t h e r e i s n o D E S I G N U N I T S d e f i n i t i o n. N o w, t h e d e s c r i p t i o n a b o v e s a y s t h a t w e h a v e t o m a p t h e c h a r a c t e r w i t h c o d e p o i n t 1 7 5 t o t h e c h a r a c t e r 2 7 o f t h e r e a l f o n t. T h e f o l l o w i n g i s a m o r e c o m p l e x e x a m p l e:
( C H A R A C T E R D 1 9 7
----------------- ( M A P --------------------------------------------------------------------------------------------------
( P U S H )
( S E T C H A R C A )
( P O P )
( M 0 V E U P R 0.9 3 7 )
( M O V E R I G H T R 1.5 )
( S E T C H A R 0 3 1 2 )
)
)
( C H A R A C T E R 0 2 0 0 ( M A P
( M 0 V E D 0 W N R 2.1 )
( S E T R U L E R 1 R 8 )
)
)
( C H A R A C T E R 0 2 0 1
----------------- ( M A P --------------------------------------------------------------------------------------------------
40 4 "Φ" 12 I n s t a l l i n g N e w T y p e
( S P E C I A L p s: /S a v e G r a y c u r r e n t g r a y d e f .5 s e t g r a y ) ( S E L E C T F O N T D 2 )
( S E T C H A R C A )
( S P E C I A L p s: S a v e G r a y s e t g r a y )
)
)
T h e f i r s t l i s t s a y s t h a t t h e c h a r a c t e r w i t h c o d e p o i n t 1 9 7 i s s e t a s f o l l o w s: a n Ά'
i s t y p e s e t, a n d t h i s i s e n c l o s e d b y P U S H a n d P O P, w h i c h r e s t o r e t h e o r i g i n a l p o s i t i o n. T h e n, t h e c h a r a c t e r w i t h c o d e p o i n t 1 3 0 i s t y p e s e t a f t e r i t i s m o v e d u p b y 0.9 3 7 u n i t s a n d t o t h e r i g h t b y 1.5 u n i t s. T h e l a s t l i s t i s m o r e c o m p l e x. B e f o r e w e a c t u a l l y e x p l a i n w h a t i t d o e s, w e m u s t w a r n t h e r e a d e r t h a t i t u s e s r e a l P o s t S c r i p t c o d e. T h e r e f o r e, t h i s e x a m p l e i s u s e f u l o n l y i f t h e r e a d e r i s a c c u s t o m e d t o t h e b a s i c s o f t h e P o s t S c r i p t l a n g u a g e. N o w, b a c k t o o u r e x a m p l e. T h e c o d e s a y s t h a t i n o r d e r t o t y p e s e t t h e c h a r a c t e r w i t h c o d e p o i n t e q u a l t o 1 2 9 i n t h i s v i r t u a l f o n t, w e s e t t h e P o s t S c r i p t c o l o r t o 5 0 % g r a y a n d t h e n t y p e s e t a n Ά'
f r o m c m r l O a t 2 0 u n i t s i n t h i s c o l o r. T h e S P E C I A L p s: c o m m a n d i s u s e d t o p a s s i t s a r g u m e n t t o t h e P o s t S c r i p t d r i v e r ( s u c h a s d v i p s ). H o w e v e r, w e c h o s e t o u s e t h e s e P o s t S c r i p t c o m m a n d s s i n c e t h e y w i l l b e u s e f u l i n o n e o f o u r a p p l i c a t i o n s ( s e e S e c t i o n 1 2.3.1 ).
T h e s e c o n d l i s t o f a v i r t u a l p r o p e r t y l i s t f i l e i s t h e p a r t t h a t h o l d s t h e l i g a t u r e a n d k e r n i n g i n f o r m a t i o n. I n o u r v i r t u a l p r o p e r t y l i s t e x a m p l e a b o v e, w e h a d
( L I G T A B L E
( L A B E L C f ) ( c o m m e n t f )
( L I G C i 0 2 )
( L I G C j 0 3 0 )
( S T O P )
( L A B E L 0 2 3 ) ( c o m m e n t f f )
( L I G C 1 0 2 5 )
( L I G C i 0 2 4 )
( S T O P )
( L A B E L C A )
___________________________________( K R N C w R - 6 8 )_____________________________________________________________________________
( K R N C v R - 7 5 )
)
T h i s t a b l e d e s c r i b e s t h e l i g a t u r e s f o r 'f' a n d f o r 'ff',
a n d t w o k e r n i n g p a i r s f o r Ά'.
W e f i r s t c h o o s e ( l a b e l ) t h e 'f
c h a r a c t e r a n d t h e n s t a t e t h a t i f t h e n e x t c h a r a c t e r i s a n Ύ
w e s u b s t i t u t e b o t h w i t h t h e g l y p h i n t h e ( o c t a l ) p o s i t i o n 2 ( w h i c h i s t h e "f i" f o r o u r f o n t ) a n d s i m i l a r l y f o r 'f j'. N e x t, t h e 'ffi'
a n d 'ffi'
l i g a t u r e s a r e d e f i n e d s i m i l a r l y. F i n a l l y, w e s t a t e t h a t i f t h e c h a r a c t e r 'w' f o l l o w s t h e c h a r a c t e r Ά',
t h e n 'w'
s h o u l d b e k e r n e d t o t h e l e f t b y 6 8 u n i t s a n d t h e s a m e f o r t h e c h a r a c t e r W
w i t h 7 5 u n i t s. M o r e c o m p l e x l i g a t u r e s c a n b e s t a t e d h e r e u s i n g i n s t e a d o f t h e L I G f u n c t i o n t h e f u n c t i o n s
L I G /L I G /L I G > L I G/ L I G/> /L I G/ /L I G/> /L I G/»
12.3 V i r t u a l P r o p e r t y L i s t F i l e s -· 40 5
t h a t c o r r e s p o n d t o t h e f u n c t i o n s
= : I =: I =: > =: I =:| > | = : I | = :| > l = :| »
i n t h e a f m f i l e, r e s p e c t i v e l y ( s e e S e c t i o n 1 2.2.2 ).
12.3.1 T wo A p p l i c a t i o n s
W e g i v e h e r e t w o n o n t r i v i a l a p p l i c a t i o n s o f m a n u a l l y e d i t i n g t h e v i r t u a l p r o p e r t y l i s t f i l e b e f o r e t h e p r o d u c t i o n o f t h e v i r t u a l f o n t s. F i r s t, w e g i v e t h e e a s y o n e. A s s u m e t h a t w e w a n t t o u s e a f o n t t h a t d o e s n o t c o m e w i t h s m a l l c a p i t a l s. A w a y t o b y p a s s t h i s p r o b l e m ( a l t h o u g h n o t t y p o g r a p h i c a l l y c o r r e c t ) i s t o p r o d u c e f a k e s m a l l c a p i t a l s u s i n g t h e - V o p t i o n o f t h e a f m2t f m p r o g r a m. H o w e v e r, t h e r e a r e l a n g u a g e s, s u c h a s G r e e k, w h e r e a c a p i t a l l e t t e r c o r r e s p o n d s t o m o r e t h a n o n e l o w e r c a s e l e t t e r. F o r e x a m p l e, t h e c a p i t a l i z a t i o n o f b o t h σ a n d ς i s Σ. I t t u r n s o u t t h a t w e h a v e t o e d i t t h e v i r t u a l p r o p e r t y l i s t f i l e a n d c o r r e c t t h e d i m e n s i o n s o f t h e c h a r a c t e r c ( w h i c h c o r r e s p o n d s t o t h e G r e e k f i n a l s i g m a ς; s e e S e c t i o n 1 0.4 ) t o h a v e t h e d i m e n s i o n s o f t h e c h a r a c t e r Σ a n d a l s o m a p ς t o Σ. T h e e n t r y f o r c ( w h i c h c o r r e s p o n d s t o ς ) l o o k s l i k e
( C H A R A C T E R C c
( C H A R W D R 4 9 6 )
( C H A R H T R 4 4 7 )
( C H A R D P R 2 0 8 )
)
a n d i t s h o u l d c h a n g e t o
( C H A R A C T E R C c
( C H A R W D R 5 5 0 )
( C H A R H T R 6 3 0 )
( M A P
( S E T C H A R 0 1 2 3 )
)
)
w h e r e t h e n e w d i m e n s i o n s a r e t h o s e o f t h e c a p i t a l s i g m a s c a l e d t o 8 0 % o r w h a t e v e r i s t h e s c a l i n g f a c t o r f o r t h e s m a l l c a p i t a l s, a n d t h e g l y p h f o r c i s t h e c h a r a c t e r w i t h c o d e p o i n t 8 3 ( o c t a l 1 2 3 ), w h i c h i s t h e c a p i t a l s i g m a.
T h e n e x t a p p l i c a t i o n i s m o r e c o m p l e x. W e w a n t t o c o n s t r u c t a n u n d e r l i n e d f o n t.
U n d e r l i n i n g i s n o t g o o d f o r t e x t w o r k b u t m a y b e u s e f u l i n o t h e r a p p l i c a t i o n s s u c h a s p o s t e r s. W e s a w h o w t o u n d e r l i n e w i t h t h e p a c k a g e u l e m o n p a g e 4 2. H o w e v e r, t h i s w a s a b a d u n d e r l i n i n g s i n c e t h e p o s i t i o n o f t h e u n d e r l i n e d e p e n d s o n t h e d e p t h o f t h e g l y p h s. A g o o d u n d e r l i n i n g s h o u l d s t a y a t t h e s a m e p o s i t i o n t h r o u g h o u t t h e u n d e r l i n e d t e x t a n d s h o u l d b r e a k n i c e l y a t a l l p l a c e s w h e r e t h e g l y p h s e x t e n d b e l o w t h e b a s e l i n e l i k e t h i s:
40 6 -φ- 12 I n s t a l l i n g N e w T y p e
Quit the joy of gambling!
F o r t h i s t a s k, w e s h o u l d a d d u n d e r l i n e s t o a l l o f t h e g l y p h s i n o u r v i r t u a l f o n t s a n d t a k e s p e c i a l c a r e f o r t h o s e t h a t e x t e n d w e l l b e l o w t h e b a s e l i n e.
A s s u m e t h a t w e a l r e a d y h a v e a f o n t f o n t.p f b f o r w h i c h w e h a v e p r e p a r e d a l l n e c e s s a r y f i l e s s u c h a s f o n t 8 a. v p l, f o n t 8 a. v f, a n d s o o n. W e r e p e a t t h e s a m e a f m 2t f m c o m m a n d, b u t n o w w e c h a n g e t h e l a s t t w o a r g u m e n t s t o f o n t u 8 a a n d f o n t u 8 r ( s e e S e c t i o n 1 2.2.3 ). O b v i o u s l y, t h e c o n t e n t s o f t h e r e s u l t i n g f o n t u 8 a. v p l w i l l b e t h e s a m e a s t h a t o f f o n t S a.v p l. N o w, w e e d i t t h e f i l e f o n t u S a.v p l. T h e f i r s t s t e p i s t o a d d a M A P F O N T c o m m a n d s o t h a t f o n t u 8 a c a n r e f e r t o f o n t 8 a. T h i s i s d o n e b y a d d i n g a f t e r t h e ( M A P F O N T D O (... t h e c o d e
( M A P F O N T D 1 ( F O N T N A M E f o n t 8 a ) )
N o w, f o r e a c h c h a r a c t e r t h a t d o e s n o t e x t e n d b e l o w t h e b a s e l i n e, w e a d d a n u n d e r l i n e o f l e n g t h e q u a l t o i t s w i d t h ( C H A R W D ). F o r e x a m p l e, i f t h e s t a t e m e n t f o r t h e l e t t e r Ά'
i s
( C H A R A C T E R C A ( C H A R W D R 7 7 7 )
( C H A R H T R 6 6 3 )
( C H A R D P R 2 9 )
)
w e c h a n g e i t t o
( C H A R A C T E R C A ( C H A R W D R 7 7 7 )
( C H A R H T R 6 6 3 )
( C H A R D P R 2 9 )
( M A P
( P U S H )
( M O V E D O W N R 1 3 1 )
( S E T R U L E R 5 9 R 7 7 7 )
( P O P )
( S E L E C T F O N T D 1 )
( S E T C H A R C A )
)
)
T h e l a s t m o d i f i c a t i o n s a y s t h a t w e s h o u l d m o v e d o w n 1 3 1 u n i t s a n d d r a w a l i n e o f h e i g h t 5 9 u n i t s a n d l e n g t h e q u a l t o t h e l e n g t h o f t h e l e t t e r 'A
'
( h e r e 777).
T h e n, a t t h e s a m e p o s i t i o n ( ( P U S H ) a n d ( P O P ) m a k e s u r e t h a t w e d o n o t m o v e f o r w a r d ), w e t y p e s e t t h e c h a r a c t e r 'A'
f r o m t h e f o n t 1; t h a t i s, t h e f o n t f o n t 8 a. N o t e t h a t w e h a v e t o l i n k t o a n o t h e r f o n t ( f o n t 8 a ) s i n c e r e f e r r i n g t o t h e c u r r e n t f o n t w o u l d l e a d t o a r e c u r s i v e f o n t
d e f i n i t i o n!
12.3 V i r t u a l P r o p e r t y L i s t F i l e s -· 40 7
L e t u s s e e n o w t h e c h a r a c t e r 'j' t h a t e x t e n d s b e l o w t h e b a s e l i n e. I f t h e i n f o r m a t i o n f o r i n t h e f o n t u 8 a. v p l f i l e i s
( C H A R A C T E R
C
j
( C H A R W D
R
2 3 3 )
( C H A R H T
R
6 8 3 )
( C H A R D P
R
2 8 0 )
)
w e c h a n g e i t t o
( C H A R A C T E R C j ( C H A R W D R 2 3 3 )
( C H A R H T R 6 8 3 )
( C H A R D P R 2 8 0 )
( M A P
( P U S H )
( M 0 V E D 0 W N R 1 3 1 )
( S E T R U L E R 5 9 R 2 3 3 )
( P O P )
( S P E C I A L p s: /S a v e G r a y c u r r e n t g r a y d e f 1 s e t g r a y )
( P U S H )
( M O V E L E F T R 4 0 )
( S E L E C T F O N T D 1 )
( S E T C H A R C j )
( P O P ) ( P U S H )
( M O V E R I G H T R 4 0 )
( S E L E C T F O N T D 1 )
( S E T C H A R C j )
( P O P )
( S P E C I A L p s: S a v e G r a y s e t g r a y )
( S E L E C T F O N T D 1 )
( S E T C H A R C j )
)
)
A s b e f o r e, w e f i r s t d r a w t h e u n d