TUGBOAT
Volume 24, Number 2 / 2003
General Delivery 159 From the president / Karl Berry 160 Editorial comments / Barbara Beeton 162 Daniel Taupin, 1936–2003 / John Plaice 163 What is TEX? / Douglas Waud Typography 165 Maths = Typography? / Richard Lawrence 169 On musical typesetting: Sonata for TEX and METAFONT, Op. 2 / Federico Garcia Font Forum 183 There is no end: Omega and Zapfino / William Adams 200 The METAFONT approach: Implicit, relative, and analytical font design / Timothy Hall Resources 205 CTAN plans / Robin Fairbairns, Jim Hefferon, Rainer Sch¨opf, Joachim Schrod, Graham Williams, Reinhard Zierke LATEX 208 Some notes on templates / Lars Hellstr¨om 211 Writing a big book — A first experience with LATEX / David Walden 216 Designing packages for Λ: An overview / Apostolos Syropoulos 221 LATEX news, issues 14–16, 2001–2003 / LATEX Project Team 224 ednotes — critical edition typesetting with LATEX / Uwe L¨uck Software & Tools 236 Hyphenation patterns for minority languages / Kevin Scannell 240 (LA)TEX, genealogy, and the LifeLines software / Andrew Caird 245 Generating LATEX documents through Matlab / S. E. Talole, S. B. Phadke 249 mlBibTEX’s Version 1.3 / Jean-Michel Hufflen Hints & Tricks 262 Glisterings / Peter Wilson 265 The treasure chest / Mark LaPlante Book Reviews 275 The LATEX Companion, Second Edition / Claudio Beccari 278 Guide to LATEX, 4th Edition / Douglas Waud and Mimi Burbank Abstracts 282 Les Cahiers GUTenberg: Contents of Issue 42 (July 2003) 283 MAPS: Contents of issues 27–28 (2002) 286 TEXemplares: Contents of issues 4–6 (2003–04) Reports 288 Report on the Pune workshop on LATEX and free mathematical software / S. A. Katre, Manjusha Joshi 291 TUG at Bay / Nelson Beebe, Wendy McKay, Ross Moore News & 294 Calendar Announcements 295 TUG 2005 announcement c3 EuroTEX 2005 announcement Late-Breaking 296 Production notes / Mimi Burbank News 296 Future issues TUG Business 296 Financial statements for 2003 / Robin Laakso 298 TUG 2005 election 293 Institutional members Advertisements 299 TEX consulting and production services 299 The LATEX Companion, 2nd edition, by Frank Mittelbach et al. 300 Easy Table, Khanh Ha TEX Users Group Board of Directors TUGboat (ISSN 0896-3207) is published by the Donald Knuth, Grand Wizard of TEX-arcana † ∗ TEX Users Group. Karl Berry, President Kaja Christiansen∗, Vice President Memberships and Subscriptions Sam Rhoads∗, Treasurer 2004 dues for individual members are as follows: Susan DeMeritt∗, Secretary Ordinary members: $75. Barbara Beeton Students/Seniors: $45. Steve Grathwohl The discounted rate of $45 is also available to Jim Hefferon citizens of countries with modest economies, as Ross Moore detailed on our web site. Arthur Ogawa Membership in the TEX Users Group is for the Gerree Pecht calendar year, and includes all issues of TUGboat Steve Peter for the year in which membership begins or is Cheryl Ponchin renewed, as well as software distributions and other Michael Sofka benefits. Individual membership is open only to Philip Taylor named individuals, and carries with it such rights Raymond Goucher, Founding Executive Director † and responsibilities as voting in TUG elections. For Hermann Zapf, Wizard of Fonts † membership information, visit the TUG web site: ∗member of executive committee http://www.tug.org. †honorary TUGboat subscriptions are available to organi- zations and others wishing to receive TUGboat in a Addresses Electronic Mail name other than that of an individual. Subscription General correspondence, (Internet) rates: $85 a year, including air mail delivery. payments, etc. General correspondence, TEX Users Group membership, subscriptions: Institutional Membership P. O. Box 2311 [email protected] Institutional Membership is a means of showing Portland, OR 97208-2311 continuing interest in and support for both TEX U.S.A. Submissions to TUGboat, and the TEX Users Group. For further information, Delivery services, letters to the Editor: contact the TUG office ([email protected]) or see parcels, visitors [email protected] our web site. TEX Users Group 1466 NW Naito Parkway Technical support for TEX is a trademark of the American Mathematical Suite 3141 TEX users: Society. Portland, OR 97209-2820 [email protected] U.S.A. Contact the Board Copyright c 2003 TEX Users Group. Copyright to individual articles within this publication Telephone of Directors: remains with their authors, and may not be reproduced, +1 503 223-9994 [email protected] distributed or translated without their permission. Fax For the editorial and other material not ascribed to a particular author, permission is granted to make and +1 503 223-3960 distribute verbatim copies without royalty, in any medium, provided the copyright notice and this permission notice are preserved. World Wide Web Permission is also granted to make, copy and distribute http://www.tug.org/ translations of such editorial material into another language, http://www.tug.org/TUGboat/ except that the TEX Users Group must approve translations of this permission notice itself. Lacking such approval, the original English permission notice must be included. Problems not resolved? Printed in U.S.A. The TUG Board wants to hear from you: Please email [email protected].
[printing date: November 2004] 158 TUGboat, Volume 24 (2003), No. 2
TUGboat TUGboat Editorial Board This issue (Vol. 24, No. 2) is the only regular issue Barbara Beeton, Editor-in-Chief of the 2003 volume year. Vol. 24, No. 1 was the Robin Laakso, Managing Editor TUG 2003 conference proceedings, and No. 3 will be Mimi Burbank, Production Manager the EuroTEX 2003 proceedings. Victor Eijkhout, Associate Editor, Macros We are unfortunately not able to set a definitive Alan Hoenig, Associate Editor, Fonts schedule for the appearance of the next few issues. Christina Thiele, Associate Editor, TUGboat is distributed as a benefit of mem- Topics in the Humanities bership to all members. Production Team Submissions to TUGboat are reviewed by vol- William Adams, Barbara Beeton, Karl Berry, unteers and checked by the Editor before publica- Mimi Burbank (Manager), Robin Fairbairns, tion. However, the authors are still assumed to be Baden Hughes, Steve Peter, Michael Sofka, and the experts. Questions regarding content or accu- Christina Thiele racy should therefore be directed to the authors, with an information copy to the Editor. Other TUG Publications Submitting Items for Publication TUG is interested in considering additional man- Owing to the lateness of the present issue, and uscripts for publication. These might include the scarcity of material submitted for future issues, manuals, instructional materials, documentation, or suggestions and proposals will be gratefully accepted works on any other topic that might be useful to and processed as received. the TEX community in general. Provision can be Manuscripts should be submitted to a member made for including macro packages or software in of the TUGboat Editorial Board. Articles of general computer-readable form. interest, those not covered by any of the editorial If you have any such items or know of any departments listed, and all items submitted on that you would like considered for publication, send magnetic media or as camera-ready copy should be the information to the attention of the Publications addressed to the Editor-in-Chief, Barbara Beeton, Committee at [email protected] or in care of the to the Managing Editor, Robin Laakso, or to the TUG office. Production Manager, Mimi Burbank. The TUGboat “style files”, for use with either TUGboat Advertising plain T X or LAT X, are available from CTAN and E E For information about advertising rates and options, the TUGboat web site, http://tug.org/TUGboat. write or call the TUG office, or see our web page: For authors who have no network access (browser or http://tug.org/TUGboat/advertising.html. FTP), they will be sent on request. Send e-mail to [email protected], or write or call the TUG office. Trademarks This is also the preferred address for submitting contributions via electronic mail. Many trademarked names appear in the pages of TUGboat. If there is any question about whether Reviewers a name is or is not a trademark, prudence dictates that it should be treated as if it is. The following Additional reviewers are needed, to assist in check- list of trademarks which appear in this issue may ing new articles for completeness, accuracy, and not be complete. presentation. Volunteers are invited to submit METAFONT is a trademark of Addison-Wesley Inc. their names and interests for consideration; write to PostScript is a trademark of Adobe Systems, Inc. [email protected]. TEX and AMS-TEX are trademarks of the American Mathematical Society. Unix is a registered trademark of X/Open Co. Ltd. TUGboat, Volume 24 (2003), No. 2 159
Board resignation and appointments General Delivery In January 2004, Stephanie Hogue resigned from the board, owing simply to lack of time. We thank her enormously for her efforts on behalf of T X and TUG From the President E over the years. Karl Berry In my capacity as president, I have appointed several hard-working TEX folks to the board, to TUG I’m honored to serve as the new president fill some of the vacant positions: Jim Hefferon (as of the T X Users Group 2003 annual meet- E (long-time maintainer of TUG’s CTAN node), Ger- ing), following in the footsteps of many past and ree Pecht (long-time TEX enthusiast at Prince- present TEX stalwarts (Pierre MacKay, Nelson ton), Steve Peter (linguist, translator, and very ac- Beebe, and Christina Thiele come immediately to tive TEXxie), and Steve Grathwohl (in charge of mind; see http://tug.org/tugpres.html for a TEXnical operations at Duke University Press). rogues’ gallery). I’d like to thank them all for agreeing to serve. 2003 TUG organizational matters More information about them and the other board members can be found via the web page http:// • TUG once again has an executive director! The tug.org/board.html. board has given Robin Laakso this title, which To continue in office, appointed directors must more accurately reflects her many various tasks stand in the next regular election, which will be in and responsibilities. Congratulations, Robin. 2005; you’ll find an announcement about that else- • As has been mentioned in electronic postings, where in these pages. we’ve opened a small online TUG store: http: //tug.org/store/. Software releases, TUG- Notable TEXnical events boat issues, and various past memorabilia are • The MacTEX TUG Technical Working Group available; members get a 10% discount. was formed at the TUG 2003 meeting, led by • As of 2003, we are officially shipping three is- Wendy McKay and others. Its goal is to work TUGboat sues of per year. This is to help us get on action items that would enhance current and back on track, without publishing ersatz “dou- future development of TEX on Mac OS X. They ble” issues. The regular U.S. postal permit for are in continuing contact with Apple. There periodicals requires at least quarterly publica- are many interesting items on their web page: tion; fortunately, our new nonprofit status (see http://tug.org/twg/mactex/ http://tug.org/tax-exempt/ ) gives us lower • John Hobby, author of MetaPost, has dele- mailing rates in general, so our mailing costs gated bug fixing and general maintenance to are not increasing unduly. a group led by Taco Hoekwater and Hans Ha- • We now ask that members explicitly request the gen. Activities are coordinated via a Meta- CTAN archive on CD, instead of mailing it to Post project at http://metapost.sarovar. everyone. (This can be requested when join- org/. (Sarovar, supported by the TUGIndia ing or renewing, or by mailing [email protected] user group, is a public software repository site at any time.) In our surveys, we found a sig- reasonably analogous to sourceforge.net and nificant proportion of members did not use the savannah.gnu.org.) John retains overall guid- CTAN CD’s, and so this allows us to save consid- ance and direction for MetaPost. erably on production and mailing. The CTAN • A small update of the T X Directory Structure archive is also included on the T X Collection E E document (version 1.1) is available via CTAN DVD, which is sent to all members. (We very and http://tug.org/tds/. The most notable much hope that the 2004 T X Collection will be E changes are better definitions for font map and available soon, but can’t give a precise date.) encoding files. Icelandic TEX user group A new TEX user group was formed in the summer of I will close with a reminder that the TUG board 2003 for Icelandic TEX. We congratulate them and welcomes input or questions at any time; email us wish them much success. The group’s web page: at [email protected]. http://www.rhi.hi.is/istex/ ⋄ Karl Berry A list of all user groups and information thereof [email protected] is available at http://tug.org/usergroups.html. 160 TUGboat, Volume 24 (2003), No. 2
Editorial Comments The article in question is entitled “TEX and LATEX 2ε”. It briefly describes the history of TEX, Barbara Beeton its use at the AMS, development of the AMS pack- Adieu, Daniel Taupin ages, and some future directions. The cited footnote refers to November 27, 1985, as the date on which Daniel Taupin, perhaps best known in the TEX com- TEX 2.0 was released: munity as the creator of MusixTEX, was killed in a mountaineering accident in the Pyrenees on August Conjectural; the historical record for this re- 26, 2003. His love of the mountains was great, and lease seems to be unclear. The 11/27/85 date he has been honored by his colleagues with a com- is the date of the last change recorded in memorative plaque on the Viaduc des Fauvettes (an tex82.bug after the release of version 1.5 and old railway bridge that provides access to a num- prior to other changes designated as belong- ber of climbing venues), which was restored in large ing to version 2.1. An announcement by David measure through his tenacious urging. A web site in Fuchs in the March 1986 issue of TUGboat his memory is at http://www.pyrenees-pireneus. stated that “TEX 1.5, when used with the new com/taupin.htm. CM fonts, is officially called TEX 2.0.” Should I met Daniel at several meetings of TUG and this be interpreted, perhaps, to mean that the other groups, and enjoyed his company. He held release date of 2.0 is the same as for 1.5? strong opinions, but always had something interest- ing to say. Another honorary degree for DEK TUG- Several papers by Daniel were published in On June 5, 2003, Don Knuth received the Doctor of boat , beginning with the proceedings of the 1993 Science degree from Harvard University. The cita- 14 annual meeting ( :3), where his two main hobbies tion, he observed, was rather poetic: were introduced in two papers, the first on “Using TEX and METAFONT to build complicated maps” — Donald Ervin Knuth, Doctor of Science a description of a “tentatively exhaustive catalog of Font of digital ingenuity, icon of algorithmic all the 1500 known climbable crags of France outside invention, whose artful efforts have programmed the high mountains”, and the second, “MusicTEX: the course of a powerful modern science. Using TEX to write polyphonic or instrumental mu- sic”. Background information in support of the cita- tion can be found in the June 5 edition of the Har- Another memorial to Daniel appears at http: vard Gazette //icking-music-archive.org/Memorial/Taupin/ , at http://www.news.harvard.edu/ gazette/2003/06.05/01-honorary.html Statements.html. . Don Knuth to Michael Downes Help save the French Imprimerie nationale I received a note from Don Knuth which had been The French Imprimerie nationale, an institution US intended for Michael Downes, written just an hour broadly equivalent to the Government Print- HMSO UK before he read Michael’s obituary. Since the note is ing Office or the in the , is heir to the on a matter of historical record, it’s presented here centuries-old tradition of French government print- with Don’s permission. ing, starting with the Imprimerie royale, set up by Cardinal Richelieu under King Louis xiii in the 17th 10 Sep 03 century, with forerunners from the Renaissance. Dear Michael This institution is being disbanded by the French Your fine article in AMS Notices (Dec 2002) government, with no thought to the preservation sent me to my diary re footnote 2 on page of its historic heritage — part of the institution is 1389. classified as a “historic monument” — other than to pack it into crates for permanent storage. This move TEX 2.0 was installed on Saturday 04 Jan- uary 1986, on Stanford computers via inter- is scheduled for the first half of 2005, destination un- net connection from my apartment in Boston known. where Jill & I were on sabbatical . . . the same A petition is posted at day as METAFONT 1.0. The diary also says http://www.garamonpatrimoine.org “typed the index of Volume C thru ‘Davis’; for the purpose of encouraging the French govern- never took time to get dressed today ment to preserve this unmatched resource. Please read and sign it. The following text is excerpted – don knuth from the petition. TUGboat, Volume 24 (2003), No. 2 161
The historic collection of the Imprimerie is a since the [16th] century, that is to disappear, unique, priceless testimony of the history of the writ- buried, forgotten, maybe dispersed. Because ten form, from the 16th century to the present. It it [is] not only French writing, but Chinese, includes the Cabinet des poin¸cons, or Punch Room, Arabic, Greek, Hebrew, etc., that are con- holding hundreds of thousands of letterform and char- cerned: there are punches and fonts for nearly acter punches, for both western and oriental scripts; every written language known till the last functional workshops — a foundry, presses for typog- century. And books in all writings and lan- raphy, lithography and copper-plate engraving work, guages. But there is another way. And that stitching and binding — as well as a library with over [is] why, we, the [not] for profit organiza- 30,000 volumes, and the archives of the State print- tion Convention typographique, and so many ing works. Set up in 1539 by King Francis i, at the [other] organizations, and individuals, from same time as the Coll`ege de France, the national cen- so various countries, ask you to add your name ter of academic excellence, this collection stands as to the petition (on-line : the memory of specialized know-how and expertise, http://www.garamonpatrimoine.org, and as a center for creation, now fated to disappear or print it, or ask for a PDF in your own lan- if its continued survival is not ensured. guage or a language [you] understand, to be This whole must not be scattered or split up, as sent to you; Xerox it, and spread the word regards either its contents, or its functions: museum around).
and conservation, typeface creation, publishing and A research. It must be released from the oversight of Avoid obsolescence: Guidelines for LTEX a ministerial department driven by concerns of eco- users nomic profitability. This heritage must be housed in A couple of years ago, a document by Mark Tret- Paris, held by an institution guaranteed adequate re- tin arrived at CTAN, listing a number of things of sources, having the capacity to further enlarge and which a user of LATEX 2ε should be aware. This doc- expand it. Better still, it could be set up as a founda- ument, originally in German, has now been trans- tion — a controlled, non-profit organization — which lated into English (“An essential Guide to the dos would be a dedicated space for conservation, but and don’ts of LATEX 2ε, or obsolete Commands and equally of interfacing with outside elements, and for Packages, and some more Mistakes to avoid”) and research. Concurrently, and as of now, measures several other languages. A search of CTAN for the should be taken to ensure that the transfer of equip- keyword “l2tabu” will find it. The suggestions here ment and expertise proceed speedily, using a tran- are helpful for even experienced LATEX users, giving sition formula, with no interruption to production, reasons as well as directives. conservation, research or training activities. Priceless artifacts must be saved, but equally Hidden TEX use in Germany persons, skills, a store of knowledge must be safe- Need a personalized train schedule? If you’re trav- guarded, that are at risk of being lost to all hu- eling on the German railway (Deutsche Bahn AG), mankind. you can get one — prepared under the covers using T X. The company providing this service, and a −−∗−− E lot of others, has an interesting web site: http: //www.hacon.de/hafas e/print2web.shtml. The TYPO-L A message from Jef Tombeur to the site http://www.travelinfosystems.com/palm/ discussion list (July 28, 2004) communicated this query/query-p2w.cgi/en provides a similar service additional information from the French organization for the UK. Convention typographique and the European Mono- Bank statements and similar documents are also type University: created in the same way, but only in Germany, as far Just imagine if the Eiffel tower was made by as I am aware. (Certainly the statements from my hand. Not just as it is, but even more so — bank aren’t produced this way.) Thanks to Volker each bolt, each and every component forged Schaa for calling these services to my attention. and adorned with care, craft and art. So ⋄ what? Would just be another French mon- Barbara Beeton American Mathematical Society ument. The Cabinet des poin¸cons (punches), 201 Charles Streed and the French Imprimerie nationale library, Providence, RI 02904 USA are something really different. Not just an- [email protected] other French landmark. It is your history, 162 TUGboat, Volume 24 (2003), No. 2
Daniel Taupin, 1936–2003 I last saw Daniel at the Toulouse GUTenberg meeting in 2000. The evening of the banquet, held It was with great sadness that I heard of Daniel in Cintegabelle, the village where Lionel Jospin, the Taupin’s fatal fall from the Rochail, in the Oisans French Prime Minister, was also counsellor-general, region of the French Alps last year, after a successful we visited the church, which holds one of the finest solo ascent. organs in the French south-west. After the talk and I first met Daniel in 1994 at CERN in Geneva, recital, Daniel was explaining to us the difficulties at the inaugural presentation of Omega by Yannis of playing an organ that he had recently found in Haralambous and myself. Lots of grey hair going a church near Paris that was not tuned as a well- off in all directions, a big booming heavily French- tempered clavier. Only certain pieces, in certain accented voice, strongly held opinions — just who keys, could be played with success. was this guy? As always, this colourful personnage had some- Over time, at EuroTEX and GUTenberg meet- thing to say. ings, I got to know Daniel better. He always focused Farewell Daniel, you will be missed. on the details and the exceptional cases. I share this concern and always try to instill it in my software ⋄ John Plaice engineering students. But he didn’t just talk. He built working soft- ware. His MusixTEX, used to produce many of to- day’s online musical archives, is a highly complex piece of software, that deals with all of the excep- tions. It can be used to typeset just about any piece of music in the Western musical tradition, and prob- ably more. Daniel was also well-known in French climbing circles, and played a key rˆole in developing standards for sharing popular climbs between the competitive and recreational styles. Courageous and generous to the core, he was even labelled a “dangerous ter- rorist” by the French state in 1992 for having, with some friends, removed the fixed pitons from the via ferata climb of the famed Aiguille du Midi, done to restore the integrity of the climbing experience. He brought his typesetting and climbing inter- ests together by using TEX and MetaPost together to produce typeset maps of France showing some of the most popular climbs, thereby showing the way forward. Daniel’s death was untimely. My research team here in Sydney had started to examine questions of high-quality typeset music and maps. Just as we were preparing to get in touch with Daniel, with fu- ture collaboration in mind, we received a copy of an email from Fabrice Popineau, announcing Daniel’s fall. TUGboat, Volume 24 (2003), No. 2 163
What is TEX? separated as much as possible from that of deciding what final form it should take. This has several ad- Douglas Waud vantages. For example, as I am typing this, I pay This journal, TUGboat, first appeared in 1980 and no attention to how it will finally come out on the has been going strong since. It provides a contin- page. That will be determined by TEX and ancil- uous stream of articles which inform the reader on lary programs written by people who are far more the latest developments in the field. And there is competent than I to produce an esthetically opti- the problem — the journal has been in production mal final result. Now, if I have strong views, special so long that readers are often assumed to know the training, or an area off the beaten track where what context. This automatically provides a barrier to an I want is just not available (rare these days) I can outsider who might stumble onto the journal and ask tweak to my heart’s content. But I don’t have to. If “What’s going on here?” I simply want to “get the job done”, I can do just The editors have therefore decided periodically that without distractions as to how everything will to insert a primer, a brief summary, to let such a or should be printed. The only formatting I do is newcomer know what we are so excited about. tell the program things like “This is what the title will be”. In the present case, all I had to do was type 1 So what is the object of our affections? ‘\title{What is \TeX?}’ which, incidentally, shows The simple answer is ‘TEX’. This is formally called a you how easy “talking TEX” can be; even if you typesetting program, computer software for produc- know nothing whatsoever about TEX, I think you ing nicely printed output. TEX came about when can read that segment of code. You have one foot Professor Donald E. Knuth, at Stanford University, stuck in the flypaper already! was planning to publish a series of books on com- Now we come to the jewel in the TEX crown — puting. He discovered that the classical process of its ability to typeset mathematics properly. In this typesetting books was no longer viable and its vari- area there is no competition. The American Math- ous replacements were rapidly declining in quality — ematical Society, in fact, was one of TEX’s princi- and so he decided to take a year off to rectify that pal sponsors; the vast majority of mathematicians, omission. He got hooked and the year turned into physicists, and other scientists write their papers us- ten. The centerpiece of his final solution was the ing TEX. program TEX. In a nutshell, TEX allows ordinary When TEX was first developed computers were people to produce beautiful output of top quality. rather primitive compared to today’s. Knuth rec- Now, one unfamiliar with TEX may think “But ognized this and built in modularity. Thus, when I can do that with my word processor!” However, TEX processes a file, it does not know what sort that is a misconception. First, the output will gen- of printer or display will be used to view the result. erally be a notch below that of TEX. The situation Knuth therefore had TEX put its output in a general is analogous to good cooking; you may not know form which could then be used as input by “drivers” what you are missing until you get a taste of a top designed to talk to whatever new printer or moni- quality product. The word processors are getting tor came along. This intermediate form is called better these days (for example, they are starting to a “device independent file” (with the file extension incorporate many of TEX’s tricks) but there is still .dvi). In turn, there are file viewers, like xdvi in catching up to do. GNU/Linux, for displaying such files on a computer There is still another significant distinction. A screen. word processor is described as “WYSIWYG”. This 2 Now meet the family is an acronym for “What you see is what you get”, with the implication that, as you type, the end result So far, I have been using the term TEX in its original will appear precisely on the screen in front of you. context — the program Knuth wrote to carry out the The TEX community interprets WYSIWYG tongue- magic. However, nowadays, the term “TEX” can in-cheek as “What you see is all you get!” The point also imply a whole family of related programs. TEX is that, once you get spoiled by TEX, you will not is just the grand-daddy of a family of related tools. be satisfied with anything less than perfection. We can list the main cast now. The WYSIWYG issue underlies an even more TEX First, TEX itself has gone through several up- profound theme in TEX. There is a clear division of dates. TEX78 came first, TEX82 next, and the labor. The job of deciding what you want to say is current and final version is TEX90. (You don’t 164 TUGboat, Volume 24 (2003), No. 2
really have to know these details since you will 3 What next? only use the final version now.) At this point I encourage you to get your feet wet. Metafont Next, a critical part of typesetting is the Specifically, try to create some documents in LATEX fonts used. Therefore Knuth also pursued the (easier than pure TEX but not out on the “bleeding design of typefaces for TEX. The result was a edge” enough to be overwhelming). First I would companion program Metafont which can be recommend getting a manual. There are many out used to produce tailored characters. (Again, there but I would suggest you start with Lamport’s this is more for information; you will not be original guide [2]. Next you need to have a TEX jumping into font design your first day!) system on your computer. If you use Linux, life is LATEX Now we come to LATEX. This is a component easy; your distribution will probably already have designed to shield the author from the details it installed. If you use Windows or a Macintosh I of TEX. Leslie Lamport, the author of LATEX, suggest you start with Flynn’s excellent introduc- recognized that, although TEX is very accessible tion [1]. If you do not have access to back copies of for the sort of person who loves to wallow in TUGboat you can get it online from: things computer, it can be very formidable to, http://www.tug.org/ shall we say, more normal folks. Thus he put tex-archive/info/beginlatex/html together a simpler system designed to protect where, in particular, the chapter “Installing T X” the author still further from the details of the E will be a succinct guide to getting a system installed. underlying machinery. For example, he allows One final parting word of advice: start with the author simply to put something that is to to something simple, perhaps just try an example from be written exactly as it is typed between paired Lamport’s book, and then add frills one at a time, begin and end verbatim commands and allows i.e. crawl before walk!. the author to completely avoid having to make any decision as to what type face to use, what 4 Online column size, what style, and the like. At the same time they are launching this column, History: The original version, LAT X 2.09, has E TUG is planning an online journal which will include been replaced by LAT X2e. E a column “\begin{here}” which will be directed to- Bib BibTEX TEX is an ancillary program to help ward the person first trying to come to grips with organize bibliographic references. TEX. This column will attempt to identify and clar- MakeIndex MakeIndex is another ancillary pro- ify standard stumbling blocks. This online journal gram, this time for facilitating of creation of will be available at an index. http://www.tug.org/pracjourn dvips Earlier we mentioned .dvi files as a generic form of output. With time, the need for a gen- References eral file format was recognized more widely and [1] Peter Flynn. Formatting information. the company Adobe Systems Inc. created the TUGboat, 23(2):115–237, 2002. PostScript language. The T X community re- E [2] Leslie Lamport. LATEX: A Document sponded with programs like dvips to convert Preparation System. Addison-Wesley, Reading, .dvi files to .ps files. MA, 2nd edition, 1994. pdfTEX and pdfLATEX The next step is where we are currently. PostScript has been augmented ⋄ Douglas Waud with the “Portable Document Format” (PDF), Department of Pharmacology also a creation of the folks at Adobe. If you have University of Massachusetts used the Acrobat reader to read a file, you have Medical School (retired) been looking at a .pdf file. The TEX community 17 Lantern Lane, Shrewsbury, MA, has kept up with this develoment with the pro- USA gram pdfTEX and its LATEX variant pdfLATEX. [email protected] These allow one to use tricks available in the http://users.umassmed.edu/ .pdf format, in particular, to create “hyperref- douglas.waud/ erences”, links to stuff on the web. TUGboat, Volume 24 (2003), No. 2 165
Both are pertinent to the purposes of this paper: it Typography is the aspect of ‘arranging’ or ‘rightly disposing’ ma- terial ‘to aid to the maximum the reader’s compre- hension’ that will be emphasized. Some will argue Maths = Typography? that both these definitions are rather utilitarian and Richard Lawrence omit any feeling for the art and beauty that typog- raphy can bring to the printed document. However Introduction the question of beauty in mathematical typography This paper is written for a conference with the theme is also addressed. ‘Hidden typography’. Broadly the author’s interest So what is hidden typography? In the best is in mathematical printing and typesetting in par- sense it is Beatrice Warde’s crystal goblet typog- ticular. So, as is usual for academic conferences, raphy: invisible or unobtrusive but making the the author’s task is to persuade you, the reader, reader’s task easier and more pleasant. It is design that there is some connection between the confer- that helps the reader to extract meaning from the ence subject and the author’s personal interest. To written word. This is very much the sense relevant see if this can be done it is pertinent to ask a few to the printing of maths. Enough people have trou- questions: ble grappling with the abstraction of maths that it would not be a good idea to add typographical flour- * What is typography and so what is hidden ishes and quirks to its written form. Good ‘crystal typography? goblet’ typography is what the complexity of maths * What is mathematics? typesetting really does need. * Is there any typography in mathematics and is there any hidden typography in it? What is mathematics? The last of these questions is the one that is central The branch of science concerned with number, to the subject of the conference; answers to the other quantity, and space, either as abstract concepts two help to explain the author’s answer to it. So to (pure mathematics) or as applied to physics, engi- start with the conclusion: neering, and other subjects (applied mathematics). (Concise Oxford English Dictionary, 2001) * There is typography in mathematics. Mathematics is its own branch of science (like * The typography in written mathematics is physics or chemistry) and comes in two forms, pure not hidden, it is overlooked. and applied. Both forms are concerned with ‘num- * There is a strong case for saying that written ber, quantity, and space’, one in the abstract, one mathematics is a very highly developed in practical terms. The graphic representation of example of typography: it may even be maths then has to be able to encompass both ab- possible to say ‘Maths = Typography’. stract notions and practical applications if it is to What is typography? be any use to mathematicians and those who use maths (physicists, engineers, etc.). It has to deal The art or process of setting and arranging types with ‘number, quantity, and space’. It also has to and printing from them. (Concise Oxford be able to describe a whole branch of science (part English Dictionary, 10th edition, 2001) will not do). As we know the result is that the print- Typography may be defined as the craft of rightly ing of mathematics is challenging and specialist work disposing printing material in accordance with spe- largely avoided by many. cific purpose; of so controlling the type as to aid Another common view of mathematics, par- to the maximum the reader’s comprehension of the ticularly popular with those who use maths (engi- text. (Stanley Morison, neers, physicists, etc.) is that it is a language that First principles of typography, 1951, CUP) is used to describe physical situations and relation- Here are two definitions of typography, one short ships. Mathematical equations are used to describe and written for a general audience, the other longer the motion of a pendulum, the decay of radioactive and written for an audience wanting to know more. waste, the flow of traffic on congested roads, and the relationship between infinitely large groups of This paper was presented at the 2003 St. Bride Printing objects in multidimensional space. Mathematics is Library Conference on “Hidden Typography”, and appears the language that scientists (physical scientists at here with permission. The texts of all the talks from the conference can be viewed at http://www.stbride.org/ least) use to communicate their ideas and observa- conference2003/. tions. Like mathematics in the dictionary definition 166 TUGboat, Volume 24 (2003), No. 2 above, the physical scientist is interested in ‘number, One of the very earliest mathematical works quantity, and space’. The graphic representation of is the Algebra of Al-Khowarazimi, a ninth-century maths has to reflect this. scholar in Baghdad. Florian Cajori (A history of Having used the standard trick of looking at mathematical notation, 1929, Open Court) quotes a a dictionary definition of the subject it may be in- translation of an example from this work: structive to consider the popular views of its users What must be the amount of a square, which, and practitioners. A physicist uses a variety of when twenty-one dirhems are added to it, becomes strange machines to investigate the rules that gov- equal to the equivalent of ten roots of that square? ern the physical world and records observations as Solution: Halve the number of the roots; the moiety mathematical relationships. A biologist grows then is five. Multiply this by itself; the product is experiments on living things in order to understand twenty-five. Subtract from this the twenty-one more about them perhaps using statistics to sup- which are connected with the square; the remainder is four. Extract its root; it is two. Subtract this port arguments and observations. An engineer de- from the moiety of the rots, which is five; the signs and builds machinery to exploit the discover- remainder is three. This is the root of the square ies of other scientists and uses approximate equa- which you required and the square is nine. Or you tions to predict how the machinery will behave. may add the root to the moiety of the roots; the The mathematician sits and thinks and scribbles sum is seven; this is the root of the square which and rearranges equations on paper or blackboard. you sought for, and the square itself is forty-nine. The mathematician has no machinery or plants or In modern notation the statement of the problem animals to work with. The mathematician’s only and its solution is: prop in this populist view is the piece of paper or 2 x + 21 = 10x blackboard, or more specifically equations written on these. Mathematics is in some sense the written Solution: x = 10/2 √[(10/2)2 21] = 5 √±(25 21) − equations on these surfaces. If this is indeed so, then ± − it can be appreciated that the optimal arrangement = 5 √4 = 5 ± 2 of the symbols in the equations is of some conse- ± quence. = 7, 3 So we have three views of mathematics: it is Even if the reader can not follow the mathe- a branch of science dealing with the description of matical notation, it should be apparent that the ver- the abstract and real and quantity, number, and sion written using symbols is potentially much eas- space; it is a language; and it is written equations. ier to comprehend. It is enormously more compact. Properly, and not just as a result of undue deference This compactness and its consequences for intelligi- to the majesty of the Oxford English Dictionary, it bility were commented on a long time ago. William is only the first of these. But mathematics’ very Oughtred (quoted by Cajori), an English mathe- singular distinction is that it is dependent on its own matician promoting his own work in 1647 noted: language to communicate it. That language is only . . . Which treatise being not written in the usuall easily communicated in its written form (equations synthetical manner, nor with verbous expressions, on paper or blackboard). While the individual but in the inventive way of Analitice, and with sym- components of an equation can be read out loud and boles or notes of things instead of words, seemed their relative positions can be described, it is not too unto many very hard; though indeed it was but their owne diffidence, being scared by the newness far-fetched to say that maths is an unpronouncable, of the delivery; and not any difficulty in it selfe. even a silent, language. So that its written form, For this specious and symbolicall manner, neither equations, has to be able to communicate matters racketh the memory with multiplicity of words, nor of ‘quantity, number, and space’. chargeth the phantasie with comparing and laying things together; but plainly presenteth to the eye Printing’s influence on mathematics the whole course and processe of every operation Before pursuing the intellectual argument that writ- and argumentation. ten maths involves a lot of typography, it is instruc- The essence here is Oughtred’s observation that by tive and interesting to look at the influence of print- writing ‘with symboles or notes of things instead of ing on the development of maths. It is also instruc- words’ the argument is ‘plainly presenteth to the tive to see the consequences of trying to write math- eye’. The ‘symboles’ used by early mathematicians ematics without symbols to understand why the lan- are dictated by what the printer had available. So guage of mathematics is necessary. in one of the earliest printed maths books, Cardan’s Ars magna (1545, quoted in Cajori) the author TUGboat, Volume 24 (2003), No. 2 167 contents himself with using abbreviations set in measure) arisen from the character of the printed the text roman type to express unknowns. Vieta and written letters employed for so many genera- in 1591 (quoted by Cajori) uses single text roman tions, by inheritance and accumulation. It became capitals for unknowns. It was Ren´eDescartes in racial; cultivated in youth, it was intensified in the 1637 who finally established the use of lower case adult, and again transmitted to posterity. German italic letters for unknowns. He also started the letters must go. useful distinction of using letters near the beginning Rejecting Germans and Greeks, I formerly used ordinary Roman letters to mean the same as Max- of the alphabet for unknown constants and letters well’s corresponding Germans. They are plain at the end of the alphabet for unknown variables. enough, of course; but, as before mentioned, are Significantly by this date it was reasonable to expect open to objection. Finally, I found salvation in a printer to have matching roman and italic types Clarendons, and introduced the use of this kind of that could be set together. Mathematical setting is type so called, I believe for vectors (Phil. Mag,. Au- notorious for the diversity of sorts it exploits. In gust, 1886), and have found it thoroughly suitable. early mathematical works the choice of these sorts It is always in stock; it is very neat; it is perfectly is limited to what the printer has. For example in legible (sometimes alarmingly so), and is suitable early printed books on ‘algebra’ much use is made for use in formulae along with other types, Roman of a capital R with a scratched tail to denote root, a or italic, as the case may be, contrasting and also sort ordinarily deployed in liturgical work to denote harmonising well with them. ‘Response’ (e.g. Cardan, 1545). Sometimes block letters have been used; but it is sufficient merely to look at a mixed formula One of the more amusingly documented discov- containing them to see that they are not quite eries made by an author seeking out unexploited cor- suitable. ners of the printer’s stocks is the eventual use of bold to denote vector quantities. Electromagnetic theory This rather long quote illustrates several points was undergoing rapid development in the late nine- about mathematicians and mathematics. teenth century and this called for the development * Mathematicians are quite passionate about of notation in mathematics capable of distinguish- how their maths is presented ing quantities which possessed both direction and * Mathematicians do have a keen appreciation size (vectors) from other non-directional quantities of the utility of notation (scalars). The first attempt used greek type, but this failed because of confusion with other greek sym- * Mathematicians have a real (if idiosyncratic) bols. Maxwell in 1873 promoted German (Fraktur) idea of the aesthetics of maths printing type for the job. Oliver Heaviside (a populariser of It is also clear from this quote what a real influence Maxwell’s work) was the one who started using bold the printer can have on advancing mathematical (Electromagnetic theory, 1893, Ernest Benn Ltd): notation and maths and science themselves.
Maxwell employed German or Gothic type. This The beauty of mathematics was an unfortunate choice, being itself sufficient to The somewhat eccentric writings of Oliver Heavi- prejudice readers against vectorial analysis. Per- side do show that mathematicians have a very keen haps a few readers who were educated at a commer- cial academy where the writing of German letters sense of what works in the notation they use to con- was taught might be able to manage the German vey ideas. Beyond this utilitarian view of notation, vector without much difficulty; but for others it is mathematicians also appreciate wider principles in- a work of great pains to form German letters leg- volved in the proper written display of their work. ibly. Nor is the reading of the printed letters an This appreciation is linked to an appreciation of the easy matter. Some of them are so much alike that maths itself. A mathematician will be very pleased a close scrutiny of them with a glass is needed to if s/he is able to simplify an argument or equation distinguish them unless one is lynx-eyed. This is a and render the mathematical content more compre- fatal objection. But, irrespective of this, the flour- hensible. Mathematicians speak of the ‘beauty’ of ishing ornamental character of the letters is against a well-presented and succinct proof or newly found legibility. In fact, the German type is so thoroughly link between branches of mathematics. The quest unpractical that the Germans themselves are giving it up in favour of the plain Roman characters, which for such ‘beauty’ keeps mathematicians busy try- he who runs may read. It is a relic of mediaeval ing to refine existing proofs. The proof of the Four monkery, and is quite unsuited to the present day. Colour Map problem (any map can be coloured us- Besides there can be little doubt that the prevalent ing only four colours without the same colour ad- shortsightedness of the German nation has (in great joining itself) reported a few years ago is acclaimed, 168 TUGboat, Volume 24 (2003), No. 2 but relying as it does on thousands of hours of com- on plain work, tho’ less profitable to them than the puter calculations, it is regarded as very inelegant. former; because it is disagreeable and injures the There are many mathematicians busy trying to sim- habit of an expeditious Compositor. plify it. The writing of equations that are compact It is not only challenging, it is also expensive. In and convey meaning easily is central to ‘beautiful’ the 1970s and 1980s publishers sought cheaper al- mathematics. ternatives to hot-metal typesetting and used strike- The written language of mathematics is easily on systems (IBM, Varityper) extensively. Mathe- given the attributes of compactness and beauty by maticians grumbled, but mostly accepted arguments mathematicians. It is not surprising to see a long about costs. One however was so appalled by the and close association between mathematicians and standards of typesetting from Varitypers that he re- their printers, the mathematicians exploiting all the belled, spent time studying typography and typeset- available special sorts and skills that the printer can ting, exploited the just-available raster-scan type- provide. There is such density of meaning in the setters, and wrote his own type design and type- choice of letter, its style (roman, bold, italic), its setting programs. That is Donald Knuth, Professor typeface (serif, sans serif, script, outline), its al- of Computer Science at Stanford. His type design phabet (latin, greek, hebrew), its size, its position program is Metafont and the typesetting program relative to other characters (subscript, superscript), is TEX. This is not the place to go into the work- that the printer’s job is very challenging. The chal- ings of TEX, but it is interesting to remark that the lenge is to follow the very detailed requirements of program is a very good example of what computer the mathematical author without any understand- scientists call an ‘expert system’ that is modelled ing of the content. to some degree on the workings of the Monotype The curious thing from a typographer’s point of sytem that it replaces. Typographers hated it be- view is how little a typographer can contribute once cause of its associated typeface, Computer Modern the mathematician has made all the choices neces- Roman which Knuth modelled on the maths books sary to convey the mathematical meaning. It is not of his youth (set in Modern Series 7). Typeset- too controversial to suggest that the mathematician ters couldn’t understand its input coding: this was is in fact his/her own typographer, at least in the not modelled on the mechanical requirements of the matter of writing equations. Monotype system, but is written to make sense to mathematicians. The program was also free. It has Maths = typography? been hugely successful to the point that it is the only If mathematicians define the typography of the word-processing system any self-respecting mathe- equations they write and ‘beautiful’ mathematics matician will use. Typesetters have then found the is well-presented equations whose meaning shines economic necessity of dealing with it. Several are through the density of notation that they bear, then able to do something about its associated typeface, perhaps mathematics is just a highly refined typo- which pleases typographers. graphical game? Going back to Stanley Morison’s One significant aspect of TEX that is illustra- definition of typography as ‘so controlling the type tive of the theme of this paper is a little-remarked as to aid to the maximum the reader’s comprehen- feature of it. Knuth wrote an output program ab- sion of the text’, then that is exactly what a mathe- breviated to ‘dvi’ which allows TEX to be printed matician does. Given that mathematics’ only phys- on anything from a 64-pin dot-matrix printer to a ical reality (its only props) are written equations, laser raster typesetting machine. In all cases the rel- then perhaps maths really is typography. ative positioning of the characters of the equations are perfectly maintained irrespective of the printer Modern mathematical typography used. A mathematician can email a dvi file to a col- Mathematical typesetting has always challenged the league on the other side of the world know exactly printer (Smith: The printer’s grammar 1755): what that colleague will see (‘dvi’ stands for device independent). The exact arrangement of characters Gentlemen [authors] should be very exact in their is vital to the meaning of the equations. The exact Copy, and Compositors as careful in folowing it, typography is vital. For Knuth typography is maths. that no alterations may ensue after it is composed; since changing and altering work of this nature is ⋄ Richard Lawrence more troublesome to a Compositor than can be 18 Bloomfield Avenue imagined by one that has no tolerable knowledge of Bath BA2 3AB, UK Printing. Hence it is, that very few Compositors are [email protected] fond of Algebra, and rather chuse to be employed TUGboat, Volume 24 (2003), No. 2 169
On musical typesetting: Lilypond has to offer, I have put hands to work on Sonata for TEX and METAFONT, Op. 2 creating (yet another) system, with portability, flex- ibility and adaptability as priorities.2 What follows Federico Garcia is a report of what I have done so far. If I’m sub- This article appears in the same TUGboat mitting it to the public, it’s because I think I might issue as an obituary of Daniel Taupin, author be onto something. of MusiXTEX, who unexpectedly passed away I wrote this article in two stages. First (Op. 1) in 2003. I’d like to take the opportunity to when I had just devised the main general model, offer it as an homage to his memory.—FG and anticipated the main algorithms needed to im- plement it. That was toward the end of 2002. And Modern software industry has provided tools for the then now, mid-2004, when publishing it in TUGboat typesetting of music for some time already. Two became really plausible. Particularly the first part programs in particular — Finale and the more recent (a history of the main idea of the system) features Sibelius — virtually exhaust the music community: a narrative approach, so I have avoided anachro- almost all musicians use either one or the other. nism: what I know now but didn’t know then should Both are WYSIWYG (what you see is what you get) not interfere too much. Along the way of telling applications, and both have reached that stage of this story, there is a detailed review and ‘refutation’ development in which new versions consist of little of MusiXTEX. It’s admittedly sharp, but sincerely more than new shortcuts, ‘cookies’ of questionable well-minded and grateful. relevance, and so on. Competition for ever wider Then, in the second part, I allowed myself to markets, on the other hand, has made these pro- ‘upgrade’ the article a little more deeply, taking ad- grams horribly ‘intelligent’: intended for standard vantage of these two years of actual work of pro- situations and the less-than-careful user, they make gramming. It’s interesting to see how getting con- customization beyond a certain point painstakingly crete changes ideas in unexpected ways. bothersome. I think this article can be read without knowl- The problem is that non-standard situations edge of either music, TEX programming, or META- are the order of the day in music. On the one FONT. Experience would surely make it easier to hand, there is the so-called ‘new music’, the con- understand some lines here and there, but I’ve tried temporary form of the ‘art music’ tradition, whose to make it all clear to any reader, above all to non- notational requirements have proven to be hard to 1 musicians. I myself wasn’t very experienced with standardize at all; traditional notational practices TEX, METAFONT, or musical typesetting — and the are quite sufficient for popular and commercial mu- bulk of this article is re-telling the steps I’ve followed sic (increasingly the target of commercial software), and what I’ve learned from scratch. but ‘new music’ overwhelms them in infinite ways. On the other hand, there is musicology, in which PART I: not the composition of new but the analysis of old Qualitative design music might potentially require not-yet-conceived- of typographical upheavals — to circle or otherwise 1 The nature of musical typesetting (I) highlight certain notes, to tie them in unusual ways, It’s no coincidence that music typesetting programs to superimpose staves, . . . Thus, any serious system are, by far, closer to being graphic utilities than text of professional musical typesetting has to give up processors. Musical text is multi-dimensional. As the hope of foreseeing all needs and possibilities. In 2 a word, it has to be programmable. MusiXTEX is Daniel Taupin’s development of what was originally a joint effort with Andreas Egler, MusicTEX. This is what some years ago got me started Lilypond is the TEX-related but independent system devel- thinking of TEX as a suitable environment for such a oped by Jan Nieuwenhuizen and Han-Wen Nienhuys. I am by system. Recently, after having had some experience no means familiar with Lilypond — in part because in 2002, when I wrote a first version of this article, I had to give up with MusiXTEX — the ‘officially approved’ (i.e., ac- trying to install it under Windows. One might think that knowledged by Donald Knuth in his web page) ap- I should have become familiar with it before embarking on plication of TEX to music — as well as a taste of what the creation of TEXmuse; but my intuition is that there is no real overlap between the two. For one thing, Lilypond is not 1 Perhaps I should remind the reader that today’s mu- a TEX package; for another, it boasts (rightly) of beautiful sic, like other arts, is far removed from the conventions and fonts. TEXmuse, on the contrary, boasts of not having fonts traditions of the ‘common-practice period’ (17th–19th cen- at all, and this shows how different their nature and approach turies) — for which, incidentally, the ‘standard’ notation was are. I have grown convinced that, as explained later on, not developed. Everything has changed, from the nature of the having fonts is actually the best way to the flexibility I am musical sound itself to its graphic representation. aiming at, as a musician and as a programmer. 170 TUGboat, Volume 24 (2003), No. 2
we all know from school, the horizontal dimension analogous, system-) breaking, and writes another is time, and the vertical dimension is pitch. But file (.mx2) for TEX to read during a second TEX that’s only part of the matter, since different voices pass. come in different staves (different vertical position). I always wondered whether invoking an exter- The horizontal position of a note in a given staff nal program was really necessary. TEX’s handling depends not only on what notes in the same voice of horizontal spacing, a substantial part of the line- come before or after, but also, and typographically breaking algorithm for which Knuth takes and de- most importantly, on what notes are played at the serves much credit — “this, in fact, is probably the same time by other voices. There is in effect a third most interesting aspect of the whole TEX system” [3, dimension involved. (A look at Figure 1 might be p. 94] — seems so powerful, so flexible, and intu- in place to visualize all this. This piece being for itively so fit to musical spacing, that MusiXTEX ap- piano, each staff corresponds to one hand.) peared to be missing out. I had the impression that music offers an opportunity to really take advan- tage of this superb algorithm, whose capabilities go far beyond assigning a little extra space to periods and question marks in horizontal mode. . . ❈❍❖ ■ ◆ ✵✶ The authors of MusiXTEX lay aside this algo- rithm on the grounds that it implicitly assumes that a normal line of text will Figure 1: A fragment of a typical score (m. 9 of contain many words, so that inter-word glue need Chopin’s piano prelude in c minor, Op. 28 No. 20). not stretch or shrink too much to justify the line. This strategy does not work very well for music. Music is thus not a line of text (in which only If each bar of music is treated as a word, in the the horizontal dimension matters), but also not a sense that inter-bar glue is placed at the end of mathematical formula (in which the vertical dimen- each bar, then the usual result is the appearance sion plays a role): it is an array of several two- of unsightly gaps before each bar rule. This fol- dimensional ‘strings’ that are mutually lined up. Ty- lows naturally from the fact that the number of bars per line is normally many fewer than the pographically, what this resembles most is, of course, number of words in a line of text. [8, p. 9, my a table. And yet there is an important difference: emphasis] a musical score usually goes on and on, for many pages — the table has to be broken. Not broken as This is, in the main, correct. What is flawed is longtable breaks tables, because in this case the ta- the implicit analogy: it is not “each bar of music” ble is not too tall, it is too long. It has hundreds and which has to be “treated as a word”, because its in- hundreds of columns, and there is no way to know ner components are also subject to spacing. Since beforehand how many of them fit in each page. the defining characteristic of a ‘word’, as far as the line-breaking algorithm is concerned, is that its com- 2 The problem of horizontal spacing and ponents remain packed together with rigid space in line breaking between, measures (bars) do not qualify as words. An idea that suggests itself naturally when one med- Therefore there is still a possibility of using itates about this kind of page-breaking is an anal- TEX’s line-breaking algorithm. My whole endeavor has been ultimately moved by the intuition that ogy with TEX’s output routine. Instead of collecting lines and deciding when to break the page ‘verti- there must be some way to apply it. As we shall see, cally’, here the task consists of collecting columns this id´eefixe led me — round-about and through a and deciding on horizontal breaks. This would in- faulty assumption — to the discovery of a promis- deed be the case when the table is input in the ing possibility. But first, now that I have touched form of columns. Page-breaking when the table is MusiXTEX, let me complete my review of it. thus pre-set is actually a rather simple matter, and 3 A word on MusiXTEX we can see a solution in action in the workings of I said above that the problem of horizontally break- MusiXTEX. In fact, that’s the latter’s main break- through: “to address the above aim, a three pass ing a table is a simple one when the table’s columns system was developed” [8, p. 9]. are input as such: as columns. And that that was The ‘three-pass system’ works through an ex- the case with MusiXTEX. In fact, ternal program (MusixFlex), that reads a file (.mx1) the fundamental macro [of MusiXTEX is] \notes created by TEX, decides on page- (and, which is ... & ... & ... \enotes where the character TUGboat, Volume 24 (2003), No. 2 171
& is used to separate the notes . . . to be typeset second one is actually more exasperating. I started on the respective staff [sic] of the various instru- this article by complaining about how customization ments, starting from the bottom. [7, p. 213] is disregarded in commercial music software. For ex- So you input the first note of the bottom-most staff, ample, three steps are needed to change a note-head then use the magical &, then the first note of the from its standard shape (the elliptical spot ❚ ), say second-to-bottom staff, another &, the note in the into a ⋄ or a × (both fairly usual nowadays). Of third-to-bottom staff, etc. After getting to the top course, if you happen to need many such changes, staff, you start again by going back to the bottom you are doomed to follow the same three steps over staff, and inputting its second note. The process is and over. . . exactly analogous to LATEX’s tabular, only rotated What is this like in MusiXT X? Well, by it- ◦ E 90 . self, MusiXTEX cannot do it. You have to go to A way to picture what is involved here is imag- musixtex.tex (naturally a very intricate file), find ining that to type a paragraph of text you have to the relevant definitions, and create your new macros. type a) all the first words, line by line, b) all the Foremost, you have to know what you are doing — second words, c) all the third words, d) ... It is after all, you are programming TEX at a fairly low 4 terribly unnatural, and, as a result, the input is as level. No hope of doing it if you are no TEXnician. unreadable as it can get; both creating and reading Let alone trying to change temporarily the num- it is an excellent, but unwelcome, exercise in ab- ber of lines in a staff, or creating non-standard key stract thought. Because music, after all, is thought signatures, or connecting two notes from different of much as text is: as horizontal lines. Many, inter- staves — all of which is excruciating, but at least 3 connected lines, but lines still. possible, in Finale and Sibelius. Requiring the user Writing a MusiXTEX file is then most uncom- to verticalize what is naturally thought of horizon- fortable, and editing it can be really challenging. tally is awkward; but prohibiting an efficient and But consider the task of ‘extracting parts’ (select- logical programming is — it seems to me — not far ing, for separate printing, a subset of the staves in- short of deserting the very spirit of TEX. volved). This is a very common necessity, for players In addition, little care was put in the choice of of an ensemble need only their staff (not the whole command names — some bear ‘d’ and ‘u’ for English score), and the ability to do it automatically is prob- down and up, others ‘b’ and ‘h’ for French basse and ably the most important advantage of using a com- haute; musical names are applied wrongly (‘accent’ puter for music typesetting. With MusiXTEX’s kind for articulation, ‘sforzando’ for accent, ‘pizzicato’ for of input, this is simply unthinkable (it is analogous staccato, etc.)—trying to memorize this could mean to, but more complicated than, extracting a single forgetting what’s what. MusiXTEX is not flexible column from a tabular environment, even a sim- (the limitations of slurring, for example, are severe); ple one; there is no way to copy-paste, not even to it’s not even efficient: only nine (or twelve with an automatically find the relevant pieces of the input). ‘extension library’) staves can be included, because David Salomon says that “the most important TEX registers are used for almost everything, and feature of TEX is its line-breaking capabilities.... they are exhausted quickly. And, this review al- The second most important feature of TEX is its pro- ready becoming far more odious than my intention, grammability” [6, p. x]. As I have noted, MusiXTEX I have to say that, with MusiXTEX, quality — O pre- ignores the first feature; but the way it neglects the cious treasure and pride of TEX lovers — is poor: the 5 3 output is ugly. Taupin devotes section 1.1.1 of MusiXTEX’s manual to argue that “the humanly logical way of coding music” is the To sum up, MusiXTEX does not in my view take procedure described. This claim is as wrong as it is apode- advantage of TEX’s unique possibilities. Its typeset- ictic. He draws from his perception of what reading key- ting of non-standard music is as demanding as that board music is like. Even here his point is questionable, be- cause the musician reads horizontal chunks from every staff of WYSIWYG commercial programs, adding the in- (the whole tradition of sight-reading training is based on this tricacy of an unreadable input. Sadly, I have had assumption). But, in any case, the composer and the typ- to recommend musicians (even those few well ac- ist (who really matter) certainly do not conceive of music quainted with T X) to use Finale or Sibelius rather vertically. I have never seen anybody setting a score by E columns, but, again, by chunks of horizontal material. In- complete drafts by composers throughout history, including 4 The authors do provide an ‘extension library’ with ⋄, ×, Bach’s Die Kunst der Fugue (one of the first MusiXTEX and other symbols implemented as note-heads; but this kind projects), prove this. In my view, Taupin is here proving of ad hoc procedure is not a solution, for the possibilities are what he believes, rather than believing what he proves: un- still limited. derstandably, his system was “the humanly logical way” of 5 And this is why Lilypond puts so much emphasis on the programming TEX for the task. beauty of its fonts (see note 2). 172 TUGboat, Volume 24 (2003), No. 2
than MusiXTEX: the result is better and the effort problem of page-breaking a horizontally long table is less if the situation is standard, and about the becomes the more manageable (and already solved) same otherwise. one of page-breaking a vertically long one. Even I’m not being just politically correct, however, TEX’s glue would be automatically recovered, only it when I also have to say that, all in all, it is a wonder would apply now to staves (rather than measures), that MusiXTEX was programmed at all. I regard its which do behave as words in the sense that inner creators with deep respect and admiration. space is not stretched. I was thrilled by this idea. I still think it is 4 Premises for an alternative worth exploring for a table-like approach like Mus- The discussion above sets the grounds for what an iXTEX. But I soon realized this does not solve the ideal system would be like. These are my basic big problem. The input is simplified, but the user premises: still has to figure out the (now horizontal) rhythmic Programmability and flexibility. This is ‘simply’ correspondences. And, again, TEX’s spacing algo- a matter of constantly bewaring of rigid designs rithm would be under-used, being applied to the rel- in programming. atively unimportant problem of inter-staff spacing. The output routine, on the other hand, has noth- T X’s glue has to be used. Somehow. It seems so E ing resembling space factors with which to work on fit for musical spacing. . . inter-note spacing (which was my main motivation Horizontal input is necessary if we want a natural to think about that algorithm). and logical system, one that can compete, on So, no way out: for the third premise, TEX had ease of use, with Finale and Sibelius. to take music lessons, and I would be the appointed TEX’s sufficiency No PostScript. Come on, no teacher. I was scared, and maybe that, along with cheating, please. my taste for TEX’s line-breaking algorithm, is why About the first two points, I think it can be said that I focused first on the second premise: bringing back MusiXTEX simply slipped down the wrong way — TEX’s glue. It will be seen that this actually in- far greater difficulties were being tackled by its au- volved a logical slip — but a fortunate one, because thors, so we can forgive them. by tackling the wrong problem I found a solution to But the third premise is a Pandora’s box. ‘Hor- the real one. izontal input’ means that the user will input the What about the fourth premise? Why did I set different lines (staves), one by one. But there is this ‘only-TEX’ requirement to my system? I don’t 6 nothing in a given particular line that indicates the really know — it must have been sheer love of TEX. relationship of its notes to the notes in other lines 5 Bringing glue back (and, remember, the horizontal position of a note depends foremost on the notes in other staves). For The intuition that TEX’s spacing is useful for music example, there is no way to know, by only reading can be stated basically thus: different (rhythmic) line 3, whether its fifth note will be played before, kinds of musical notes receive different amounts of at the same time, or after (graphically, to the left, space to their right, similar to the way periods, com- 7 directly above, or to the right of) the tenth note of mas, and other characters, do in text. A succes- line 6. sion of notes can thus be imagined as a succession MusiXTEX solves the problem, as mentioned, of words, separated by blank spaces; these spaces by asking the user to input columns: it is the user will be stretched by TEX (in the same way TEX who figures the vertical relationships out. But this is precisely what we want to spare the user. Could 6 And total ignorance of PostScript! (although I am will- T X possibly do it? Well, since these relationships ing to learn if it proves necessary; Van Zandt’s miraculous E PSTricks is a compelling taste of what can be achieved by depend on (and only on) the rhythmic characteris- ‘cheating’). 7 tics of the notes involved, to figure them out TEX A quick summary of the algorithm: TEX calculates how would need to ‘understand’ those rhythmic charac- much the line has to be stretched to reach the right margin teristics: nothing less than being taught music. (to be justified). Then this total extra space is distributed between all the blank spaces — elastic spaces, TEX’s ‘glue’ — I still tried something else before committing in the line, proportionately to the ‘space factor’ of the char- to TEX’s musical instruction: if the problem is to acters before the spaces. Periods, for example, have a larger horizontalize a vertical input, why not simply rotate space factor than letters, and therefore spaces after periods the score? The user will type staff by staff, as is will be given a bigger share of the total stretching. Throughout this article I consider the algorithm only in natural to him, but for TEX this will mean column its ‘stretching’ aspect, and without interference from infinite by column, which is natural for it. In addition, the glue or ‘badness’ parameters. TUGboat, Volume 24 (2003), No. 2 173 stretches spaces in a normal line of text), so that if T: ❚ e: ❡ X: ❳ the space factors assigned to each note ‘map’ their rhythmical nature, the final stretching will agree to Table 1: Three musical ‘letters’. the rules of musical spacing. So, the fruitful analogy is words = notes (as op- posed to words = measures, which is ‘semiotically’ of notes ❛ is composed of twenty-four more natural, but typographically misleading — see pieces, thus: ❜ . section 2).8 Another important aspect of this anal- ogy will be treated in the following section. This is how F. H. Gilson [2, p. 11] illustrated, back However, it will be noted that the intuition in 1885, the ‘microstructure’ of a musical text. In paraphrased above is not perfectly rigorous. In all it we can see how much sense it makes to say that truth, as has been already said, the space at the right a note, in all its atomic character, is analogous to a of the musical notes depends not only on their own word (rather than, for example, to a letter). Gilson rhythmic characteristics, but above all on the notes analyzes his three notes into a series of smaller ele- (which, and how many) present in other staves. The ments: these elements would be well thought of as assumption that this spacing behaves similarly to letters. Indeed, Finale and Sibelius build up notes the spacing for justification of texts holds true only from several elements: note-heads, flags (❝) for short in two cases: a) when there is only one staff; and values, etc. So does MusiXTEX, whose fonts do not b) when the note in question is the smallest (rhyth- include complete notes at all.10 9 mically) of all notes played by the different staves. Notes, then, do seem to behave as words: ag- OK, I can state b) now, with an a posteriori gregates of letters. For example, imagine a font in- conceptualization. At the time I was struggling with cluding the three characters in Table 1. The word 11 ‘bringing back TEX’s glue’, I could not possibly have TeX would produce ❚❡❳. thought of this as rigorously. Had I considered spac- Now, there are some important things to note: ing for many voices, I myself would have probably • Many letters of this musical ‘alphabet’ would abandoned the analogy with glue-spacing. But any have no width (such as the ‘letters’ T and e in thinking about many voices was then for me related the example), since musical ‘words’ would tend to ‘teaching music to TEX’, which was a task I had to be vertical rather than horizontal arrange- decided to postpone. Thus I had automatically re- ments. In fact, probably the most appealing duced the scope to one-voice situations — case a)— effect of ‘rotating the score’ (page 173) is that, inadvertently making the intuition (and the anal- when rotated, musical ‘words’ such as ❚❡❳ (now ogy) true and useful. ✷) really resemble text. But with an unro- An incomplete intuition generated an incom- tated score and zero-width characters, any dis- plete consequence: the analogy words = notes (which turbances of ‘normal’ vertical alignment (that is right but not sufficient). But only through a fur- occur frequently enough in music) would re- ther development of this consequence could I start quire the manual insertion of rigid space. imagining a complete strategy that would solve the actual problem of music typesetting, namely the • In ordinary text, the space after a word depends problem of how to deal with polyphony. on the space factor of one of its characters (gen- erally the last one). In music, the space depends 6 The nature of musical typesetting (II) on the word — the note — in its entirety. The musical letter ‘❚ ’, for example, will presumably A page of music type consists of a great many small pieces joined together to represent continu- be part of many notes, each of them requir- ous lines and characters. For instance, this group ing different spacing. But this is different from, say, what happens with character ‘.’ in ordinary
8 text: the spacing of the whole word is deter- I’m using the term ‘word’ in a TEXnical way: it means any succession of characters (‘letters’) bounded by spaces (or mined by that single character, on its own and \par’s). So ‘No!.’ is a four-letter word (‘!’ and ‘.’ being two always in the same way. In our musical font, of the ‘letters’). 9 In other words: when the note in question is the smallest 10 With the annoying result that it is not possible easily to in the whole polyphony, it follows that the next note will be insert a note in ordinary text. Even the authors must have present in the same staff. Then, the only consideration for regretted it when they had to do heavy code for this relatively its spacing is its own rhythmical nature — there will be no simple need when writing the program’s manual. need to make room for intervening notes in other staves. For 11 The vertical line missing here — called ‘stem’ — would a ‘special case’ of the rule, pointed out by the authors of be directly drawn by today’s programs; Gilson included it as MusiXTEX, see note 20. part of the types. 174 TUGboat, Volume 24 (2003), No. 2
characters would have to be assigned different occurred to Tom [Thomas E. Leathrum] that it space factors each time they are used, which is might be possible to take advantage of the fact kind of missing the point. that METAFONT is designed for drawing things. • The only difference between T and e (❚ and ❡ ) [5, p. 1] is the vertical position of the little ellipse. This From this occurrence, Leathrum eventually devel- is of course not the best solution — an infinite oped the program mfpic.12 It took me a relatively alphabet would be needed to put note-heads long time (probably because of my id´eefixe of ap- anywhere in the score. The musical alphabet plying TEX’s glue), but I finally realized the rather should have only one letter for the note-head, obvious fact that building notes up from elements and move it up and down as necessary. was much more of a ‘drawing-things’ than of a ‘com- Taking all this into account, our word would piling-words’ business. Then, Leathrum’s solution no longer be ‘TeX’, but something along the lines of came to my mind automatically: building the notes (in LATEX) ‘T\raisebox{-1ex}{T}\sfactor‘\X X’. is a graphic activity, and it should be done by META- Much less attractive! FONT, not by TEX. The latter only gives directions.
7 The advent of METAFONT 8 TEXmuse There are other reasons why this approach wouldn’t So, that’s it: TEX collects the information for the work, but at the time I was unable to see them. I notes (how many note-heads, what kind, where to think it’s the ‘aesthetic’ disappointment that left me put them, the direction of their stems, additional unsatisfied. I rejected the approach, ‘arbitrarily’ if signs, etc.), and writes a METAFONT program; run- you will, by the feeling that an originally elegant ning it, METAFONT creates a character for each use of TEX’s properties had become a ugly series of note. After that, everything is trivial: each note ad hoc procedures. will be like a single-letter word, with its own space I haven’t spoken of METAFONT yet. But the factor. TEX applies its stretching algorithm and, truth is that, all along, I had been training in META- almost without knowing it, spaces the music auto- FONT — after all, I would soon be forced to create matically: the fonts for my system. So every time I got tired METAFONT of thinking of TEX, I would go for a bach1.mf promenade. I was creating a musical font, imitat- bach.tex bach2.mf ing Finale’s ‘maestro’. Many of the symbols used ✤ ✜ ... here for musical examples actually come from those ✲ TEX ✲ early, unexperienced trials. (That’s partly why they are not very refined.) The point is that I was in- METAFONT creasingly getting to know and love , ✣ ✢ and many times I found myself, after having learned bach1.tfm to take good advantage of a new resource, think- bach2.tfm ing ‘Oh, if only T X could do this...’ This was ... ✬ ✩ E ✛ METAFONT ✛ mainly in connection to arithmetic and the use of variables, but in general a feeling was growing that ✑ METAFONT was curiously well fitted to the kind of graphic handling required by musical text. ✫ ✪ META What would have made one think that - bach.dvi FONT would be fitter for music than graphic utili- ✤ ✜ ties? It was indeed curious. But then one day — it ✲ TEX ✲ was the summer of 2002 — I made a slightly different ✫ comparison, and the whole business became defin- ing and foundational. I would actually say that’s ✣ ✢ the moment TEXmuse was born. The point is not Figure 2: TEXmuse at work. that METAFONT is fitter than PostScript, or than PSTricks, or than P CT X. Truly relevant is the fact I E 12 that Ram´on Casares too had a similar idea in 1994. His METAT X is a more direct application of it, different from METAFONT E is fitter than TEX mfpic (and TEXmuse) in that it requires the user to know how to use METAFONT — it “only builds the necessary bridges to I’m not claiming priority for this. Back in 1992, it use TEX and METAFONT in a cooperative way” [1, p. 317]. TUGboat, Volume 24 (2003), No. 2 175
With this idea, I finally had the outline of a 8.2 Premises and promises system that seemed to work and fulfill the needs of The two middle premises (no Aristotelian pun in- musical typesetting. This outline subsequently suc- tended) of section 4, namely TEX’s glue and hori- ceeded at all the tests that had beaten all other sys- zontal input, were the driving impulses behind the tems and ideas (the many-voice problem, the four devising of the system in the first place—we can premises, and some other needs of music I haven’t assume they are met. About ‘only-TEX’, OK, now mentioned yet). I never performed these tests in METAFONT is involved, but we will all agree that any ‘rigorous’ way, but I qualitatively (and more there is no cheating there. Look at the root di- or less intuitively) felt that the system would hold rectory of the TDS (TEX Directory Structure): it’s fair. That’s when I went ahead and thought of a called texmf. METAFONT is ‘part of the family’, and name, designed a logo, and wrote an article about in any case it was always intended to be the source it, toward the end of 2002. That article has formed of any associated fonts. the basis of the present account, and I’ve so far re- Flexibility, on the other hand, is much favored spected most of its contents and its structure, only by a system that has no fixed alphabet of graphic struggling to make it more clear. elements but constantly creates its own. Thanks to Let’s have a look at how T Xmuse deals with E this, the ‘core’ of TEXmuse — what it will have built the mentioned challenges. in — can reach a level of flexibility that ensures that 8.1 The many-voice problem only the industrious user will have to resort to lower- level programming. And then, good documentation It has already been decided that TEX will be taught and an intelligent use of literate programming for the secrets of musical rhythm. This means that, the METAFONT part of TEXmuse (as well as for the reading the horizontal input for each voice, it will TEX part, needless to say) will enable the industri- know what notes start sounding at any given time — ous to further customize the system.14 which, typographically, means knowing what notes, and in what staves, are present in any given vertical 8.3 Other needs axis. So, in programming METAFONT, T X is not E The main idea of TEXmuse was found by realizing limited to building up single notes in each character: that verticality is, typographically, the main sub- instead, it is able to write a program that includes stance of music. But, musically, horizontal construc- all the notes of a vertical axis in a single, rather tions are also of the utmost importance. The beams tall character. Since TEX also knows what the next that connect eighth-notes, or the slurs and ties that note is (anywhere in the score), it can figure out the group notes to indicate ‘phrasing’, for example, fall shortest rhythmic value of the current character — in this category. How is TEXmuse, that builds char- which, typographically, determines the spacing and acters vertically, going to deal with this? the character’s space factor. A correct application of The common feature of these ‘horizontal ele- TEX’s glue — case b) on page 174 — is then possible. ments’ is that they are entirely defined by the last With this the journey is complete: from the note involved. By ‘remembering’ which notes in wrong analogy ‘words=measures’, through the in- which staves have to be included in the group (the complete halfway-station ‘words=notes’, we have ar- beaming, the slur, etc.), TEX can postpone its type- rived at the solution ‘words=moments of music’; setting to the last note. The METAFONT program from the score as a table exasperatingly input by for this last character can include the horizontal el- columns, through the score as a table impossibly in- ement, sticking out to the left. (This has in fact al- put by lines, to the score as a single line of text with ready been implemented for beams; slurs and other words automatically designed. This raises only a minor (but potentially devas- 28 inches). But to be noted is that all of them are set in tating) concern: imagine a score with 24 staves, nor- handwriting. The other restriction on character height is that it can be mal for a regular-size orchestra. A character includ- up to 16 times the design size. This could lead to fonts of ing notes for 24 staves can be several inches tall, and design size as large as 72pt (for a 16-inch-tall score). I can’t METAFONT foresee any problem with that. will usually fill a page up. Is really able 14 to handle such tall characters? Luckily, METAFONT Is this not, after all, what happens with TEX itself? Most needs are already met, but in addition anybody could allows a maximum height of 2048pt# [4, p. 316]: program his own, learning from existing examples, noto- 13 about 28.5 inches — enough for most needs. riously those of LATEX and its packages, and, of course, Plain TEX and The TEXbook. Look at me: I am a total 13 The largest score produced by regular, home-computing, amateur, I have never taken even a lesson in programming. is usually set in pages of the ‘Folio’ size: 11 × 17. I have But here I am, planning to teach music and METAFONT- certainly seen larger scores (some, but only a few, taller than programming to TEX. 176 TUGboat, Volume 24 (2003), No. 2 elements are analogous. The ‘remembering’ takes to me — all the challenges that had beaten other sys- place in METAFONT, which is much better at han- tem and other ideas. TEXmuse had survived, and it dling information.) Horizontal elements remain as was now due to come into existence. such: they are not ‘broken’ into different pieces for different vertical agglomerates. There are other elements that could imply a PART II Toward and into implementation disturbance of the basic model of TEXmuse. Notes are often ‘adorned’ with all kinds of symbols: the In the original version of this article (written before ♯ and ♭ signs to begin with, but also many differ- any code whatsoever), this second part was devoted ent ‘accents’ (dots, lines, hats, . . . ), fingering indica- to a more detailed description of the planned work- tions, dynamic markings, etc. Many of them are ac- ings of TEXmuse, all in future tense. Discussed were tually vertically aligned with the notes, so that they the actual way TEX’s glue would be applied, the can be included in the characters just as note-heads handling of horizontal elements (beams, slurs, and are — no special treatment is needed. But others go the like), and the basic idea behind ‘teaching music to the left or the right of the notes. The impor- to TEX’. After that came an example, in which I tant implication of this is that these elements make played a computer running TEXmuse on a hypothet- spacing more complicated: in general, spacing is af- ical input, so as to illustrate the whole process. fected by them only if they generate collisions. In Today, however, the actual activity of coding it other words: if there is enough room for the element all has revealed many ‘flaws’, to name them gener- to attach to a note without colliding with the pre- ically. They are all amusing. For example, influ- vious (or the next) one, it is simply appended; but enced by Figure 2 above — and I don’t know by what if it doesn’t fit in the available space, the note has else—I was thinking that the TEXing of a TEXmuse to be moved (and, with it, all the notes in the same file would require three passes. I was even thinking vertical axis). about ways to let the user know that more passes TEXmuse has to keep track of the width of the were needed, and ways to ‘fake’ the final TEX box characters and the space between them. This pro- just as the draft option does for the graphicx LATEX vided, the task is trivial: the extra space needed package! Soon I was to realize that there was no can always be added to the right-most character need for all this. . . of the potential collision. It will never be neces- The point is that in the process of coding I sary to modify a previously built character (which found these flaws, and the changes this has meant for was the potential threat to the whole system). This the system are of far greater importance than many bears some relation to the matter of horizontal con- of the detailed descriptions of the original prospec- structions treated above: there is actually no prob- tive account. This present second part will therefore lem, because additions and adjustments can always omit many of those descriptions in favor of the lat- be made in the ‘current’ character, without second est developments. An original section on ‘teaching thoughts about shipped-out notes. music to TEX’ stays pretty much the same; the sec- tion on spacing is still there, but essentially changed, 9 Conclusion of the first part since here the most important revision took place. The implementation of these two things — horizon- Finally, I’m happy now to present a ‘sample’ instead tal and offset elements — has involved a deep change of the old ‘example’ — now I have a computer run- in the nature of the whole system. But this was re- ning (part of) TEXmuse on a real input. After all served for me to discover only when I started pro- that, I present a totally new set of open questions, gramming. We will see that many interesting things questions that were always present but have started would happen in the process: I found unexpected to come to focus as their eventual implementation and risible redundancies in my ideas (section 12.3), a approaches. particular problem that seemed relatively easy but is giving me trouble to this very day (section 14), and, 10 Teaching music to TEX most strikingly, a slip on the part of the Grand Wiz- The main consequence of the premise of horizontal META ard: a minor but unjustifiable omission in - output, as discussed in section 10, is that TEX has FONT, hard to believe coming from him. I shall to understand the rhythmic characteristics of the have occasion to complain later (note 23). user’s input music. Thanks to that, it will be able What matters is that the phase of qualitative to extract, from the input for each staff, the notes design was over: I had found a promising general that need to be typeset in any given vertical axis idea and I had tested it with all that was available (representing a ‘moment’ in the music). TUGboat, Volume 24 (2003), No. 2 177
0 16 32 64 72 80 96112 Notes played at the same time have the same x coordinate (the different instruments in which they are played are represented by different y’s).15 All that TEX needs is to assign a value — the value of ❇ ❆ ❘ ✼ ✽ ❑ ❙ ✾ its x — to each note of each staff; then, it will sweep all these values, and build vertical characters with notes that have the same x. We are not yet deal- Figure 3: A fragment (m. 10 of Bart´ok’s ing with ‘material’ dimensions, measurable, say, in Sonatina) with its rhythmic ‘quantization’. millimeters. The actual horizontal placement of the notes in the staff is not a direct function of their x. So far the procedure gives TEX only the vertical 11 Horizontal elements correspondences between horizontal input. A ‘unit’ has to be defined for this virtual axis. Figure 3 features also instances of the most impor- Since the rhythmically smallest note in usual prac- tant kind of ‘horizontal element’: notes 2 and 3 in tice is the 128th-note (a note with 5 flags, 32 of which the bottom staff, or notes 1–3 and 4–7 in the top equal a ‘crotchet’ or quarter-note), a fourth of this staff, are connected by ‘beams’. How are beams cre- 16 muse value would be safe as a unit. The quantum q is ated by TEX ? A boxed insertion of the second- then defined as the duration of a 512th-note. All to-last character of Figure 3 disturbs the layout of other notes can be interpreted in terms of q. For ex- the present paragraph, but it gives the key to the ample, the quarter note will be 64q, the whole note will be 512q. Armed with these ‘map of musical time’, TEX answer: ❙ . This character is fairly tall — it makes reads the input a first time.17 All the first notes in each staff occur at 0q. From then on, according room for the top staff, although there is nothing to the duration of the previous note, TEX finds the there (moment 96q). But the important point is value at which all the notes occur. An example is the that it contains, sticking to the left, the complete fragment in Figure 3. The first note (at 0q) in the beam that connects that note to the previous one bottom staff is known to be a quarter-note (the user (as well as the stems for both notes). specifies this), and therefore the second note will be Since the stems of all the notes included in the at 64q. This second note is an eighth-note, so that beam are typeset when the beam itself is typeset, the third one will come at 92q. The count goes on, every note in a beam except the last one features and then the procedure is done for the top staff, for only the note-head. For example, the character for which the values 0, 16, 32, 64, 72, 80, and 112 are 80q illustrates this (and also the procedure for mu- found. sical ‘ties’, which is basically the same but simpler): From this, TEX knows: there are notes in both staves for position 0q; at 16q and 32q, on the other hand, only the right hand has a note; and so on. 18 The vertical correspondences are thus understood. ❑ . This beam is completed only at 112q: ✾ . This is how METAFONT creates the horizontal elements. The other part of the problem is getting TEX to instruct METAFONT to do so. When TEX 15 Here I am ignoring the dimension of ‘pitch’, and talking about the ‘third dimension’ of musical notation, as introduced 18 You might be wondering about the different number of on page 171. beams for different notes in the last illustration. This is an- 16 I have never seen a note of this kind in print, but it’s other thing that depends on the rhythm of the notes involved, good to provide for it. Besides, the smaller the unit, the and this dependence is actually much more interesting and easier and more precise will be irregular subdivisions (triplets, challenging to express algorithmically than the ‘simple’ mat- quintuplets, etc.), of frequent appearance in music. ter of compiling the map of section 10. I have found an al- 17 Here it is that a ‘several-pass’ system is implied: TEX gorithm for this — a very nice one, I think, that uses META- reads the input a first time to deduce the correspondences, FONT’s weights and undraw technique — which I would like and a second time to actually build the characters according to present. Unfortunately, the mere explaining of the require- to those correspondences. In fact, the main programming ments would take so much space that it’s hardly feasible. mechanism for this is to define the same commands differently On the other hand, a problem that I haven’t solved is how for each of the stages. Usual implementations of TEX today to decide the angle of inclination of the beam. (In part, it’s run METAFONT automatically when tfm or pk files are not unsolved because I’ve been unable to find, explicitly stated, present, so that the procedure does not require TEX to run the very complex rules concerning this angle.) For the present twice on the file, as I first thought. examples I cheated, deciding the inclination on my own. 178 TUGboat, Volume 24 (2003), No. 2
❧✉ ♦ ✇ quarter-note and a 16th-note. Which one defines the spacing? (The answer might seem obvious, but we need to express it algorithmically). Figure 4: Different spacing after different Imagine the whole ‘map’ of musical time (as de- note-values. (Excerpt from the violin part of fined in section 10) collapsing into y = 0—that is, Lustoslawski’s Partita for Violin and Piano.) the projection of the whole thing into the horizon- tal axis. (This projection, a series of dots scattered along a line, is a representation of what is known finds an opening ‘|’ character in the user’s input, as the ‘compound rhythm’ of the entire ensemble.) the convention is that the following notes are to be Spacing is inferred from this projection. For every part of a beam. So it suppresses the generation of ‘musical moment’, TEX knows how long it will take stems, and starts building a list of the notes for the for the next note to sound anywhere. Since between beam. When it finds the matching ‘|’ (that closes the first two notes of Figure 3 there are 16q from the beam), the list is complete, and T X passes it to note 1 to note 2, TEX will treat the character as E th METAFONT. Having kept track of exactly where all precisely that: as a 16q (a 16 -note). notes were placed, METAFONT is able to draw their But don’t leap to conclusions too fast. Take stems and the connecting beam. what happens at 80q: the next note comes in the A paired ‘(’ and ‘)’ analogously indicates slurs bottom staff at 96, i.e., 16q afterwards. Therefore, in (T X starts a list of notes when it finds the first, and spite of being an eighth-note, this character will also E th gives it to METAFONT when it finds the second); be treated as a 16 -note (16q long). It’s not simply while ‘=’ (as in Finale) indicates ties. the shortest note present that determines spacing; 20 This is, in the main, how TEXmuse generates it’s the shortest note in the compound rhythm. horizontal elements from straightforward user in- 12.2 Spacing them structions. Now that we know how to treat the notes, spacing- 12 The spacing wise, according to their rhythmical nature, let’s have Here we come to the heart of the matter. As noted a closer look at how TEX actually does it in Fig- before, the main motivation for this whole project ure 4. The notes are ✉ ♦ ✇, and TEX knows was how to get spacing automatically without in- what space factors to apply to them: the respective volving the user at all (unless he wants to be in- values are 1000, 2000, 4000, 8000, and 16000. Thus, volved). It is finally time to put forward my solu- the spacing required to fill out the line—i.e., the tion. amount of stretching of the inter-note spaces — will Figure 4 will clarify — for the case of a single be proportionally distributed in 1 : 2 ratios. voice — what the goal is when talking about ‘spac- This alone doesn’t work. TEX’s algorithm is ing’. The five notes involved are different from each designed to minimize stretching for text, so the dif- other only in their rhythmic value, which increases ference between spaces will be hardly noticeable. In from note to note: eighth-note, dotted-eighth-note, fact, this is what you would get from regular TEX quarter-note, dotted-quarter-note, half-note. The 19 spacing: ✉ ♦ ✇ . The difference is there, but spacing has to increase accordingly. it’s by far insufficient for a musician’s needs. So you 12.1 How to space the notes need to ‘fool’ TEX, telling it the box is much wider
The first thing to do is to generalize the goal, rig- 20 Under the heading “The spacing of notes”, the authors orously, for the many-voices situation. How is a of MusiXTEX write that “it can lead to interesting algo- many-staff character to be treated, since it usually rithms.” For them, however, “it is not an important point in practice.” Why? Because, owing to the fact that some- contains notes of different rhythmic values? For ex- times the spacing is not that of the shortest note present — as ample, back in Figure 3, the first note contains a happens at 80q in Figure 3 — “the typesetter has to take care of good readable spacings on his own.” [8, pp. 6–7] OK, to me 19 There are several models as to how the space is a func- this is plain upside-down reasoning: ‘since we’re leaving this tion of the rhythmic value. One is called ‘Fibonacci’, and task to the user, the algorithm has no practical relevance.’ works by assigning to each note a space equal to 0.618 the My preference would be something like ‘since it is totally im- space of the immediately longer note. I tend to go for this practical for the user to figure the spacing out, we should go model; but Figure 4 is actually set with a binary model, and look for the algorithm.’ whereby each note receives twice the space of the immedi- Devising the algorithm is not even the real difficulty. As ately shorter one. This seems to work better when, as in the we saw, it’s immediately solved by inserting ‘in the compound example, there are dotted notes. Obviously, this parameter rhythm’. The hard part is how to implement the rule in TEX. will be user-modifiable in TEXmuse. The quantized map of musical time offers a solution. TUGboat, Volume 24 (2003), No. 2 179
than it actually is, so that it will stretch more dra- to realize that, owing to a small mistake in the for- matically. For example, telling TEX the box is twice mulas, TEX and METAFONT were applying slightly as wide gives ✉ ♦ ✇ .21 In Figure 4 different ‘versions’ of the algorithm. I even corrected my formulas diligently. . . Only a couple days later, TEX was told the box was 2.5 times wider. The correct setting of this parameter, or more likely the I laughed when I noticed the real nonsense: the al- dependence of this parameter on the music involved, gorithm was being applied twice! METAFONT is yet to be discovered. So today this has changed. It is , Anyway, the same procedure took place in Fig- not TEX, who applies stretching, according to for- ure 3 (this time the box was doubled in width), mulas derived from TEX’s stretching algorithm. The only applying space factors according to the com- spacing is thus included in the font, and TEX limits pound rhythm. itself to printing the characters out, one after an- other, without any space.22 12.3 But. . . 12.4 Offset elements This looks great. It is as satisfactory an application The last aspect of spacing concerns elements that of TEX’s stretching algorithm as it can get. My main point is made. stick out to the left or to the right of their notes. And yet. . . it’s redundant. For one thing, you’ll Many musical elements do: an example is the treble ❧ have noticed that the in-text illustrations above lack clef in the middle of the bottom staff in Figure 3. a staff (the array of five lines). In the figures, the It sticks out to the left of the next note, being sep- staff has been printed on top of METAFONT’s char- arated from it ‘rigidly’. If the note moves, the clef acters with TEX’s \rule commands. Since the be- moves with it. ginning this was known to be a temporary solution. And, conversely, if the clef had to be moved, the A professional system needs to provide for modi- note would move with it. That is how offset elements fiable ‘staff-ing’, both vertically (more or less than could affect spacing. In this case it does not, because 5 lines), and horizontally (a portion with 5 lines, fol- the clef doesn’t have to be moved — there’s plenty lowed by a portion without lines, followed by . . . ). of room for it. But sometimes an offset element will The most reasonable solution is to attach the num- collide with something else, and then it has to be ber of lines to each note: METAFONT will draw the moved. Its note will also move, and, with it, all necessary lines when drawing the note. But if the other notes on the same vertical axis. spacing is simply the stretching of blank spaces, who This is implemented as follows: when META- will draw the lines there? FONT completes a note, it finds its right extreme r More important, however, is that the drawing of (with respect to the note’s axis), and saves this value horizontal elements involving many notes assumes, in memory. Then, when it is drawing the next note, as explained in section 11, that METAFONT knows it will calculate the left extreme l (of the current 23 “exactly where those notes were placed”. Otherwise note, with respect to its axis). As seen in the pre- it will be unable to draw slurs or beams that actu- vious subsection, METAFONT will know the space s ally ‘hit’ the notes involved. I had concluded this 22 This change actually raises a basic, qualitative ques- already in 2002: “METAFONT needs a way to calcu- tion: in addition to the spacing of the notes, there are many late beforehand the stretching that the construction other things whose handling can be done either by TEX or by METAFONT (for example, line breaking and justifica- of the line will perform. This amounts to imple- tion). Deciding where to handle them amounts to deciding menting the relevant equations of the algorithm in on the nature of TEXmuse: isitaTEX package with a META- a METAFONT function”. FONT underpinning, or a METAFONT package with TEX in- So I went ahead and did just that: I derived terface? Needless to say, the criteria for the decision are too subtle — it most likely will be an ‘arbitrary’ decision. the equations (see appendix B), implemented them 23 Now, just how is METAFONT to find the right and left in METAFONT, and thus made it able to ‘foresee’ extremes of a character? When I faced this question, I went where TEX would finally place the notes. In this confidently to the index of The METAFONTbook: there had way, it knew how long to draw the staff lines, and to be a function for this. Or at least one that would give me the width of a character. I was amazed to learn that META- where to find the notes under a beam. FONT offers no ‘widthof hpicturei’ function of any kind. The OK, until one day something strange happens: Grand Wizard introduces, in his ‘Dirty tricks’ appendix, an I see that METAFONT’s beams don’t quite hit their algorithm for METAFONT to find the extremes of a pen (this notes. It took a lot of burdensome debugging for me is necessary for some pen functions). The trick is truly dirty, and Knuth is justified if he takes pride on it. But does this not really hide an omission? I’m not the one to tell, but 21 This example was achieved, in the present LATEX article, given the way pictures are internally represented in META- with \makebox[2\width][s]. . . FONT, I would imagine that finding the extremes would be 180 TUGboat, Volume 24 (2003), No. 2