Victor Eijkhout, The Computer Science of TeX and LaTeX, Victor Eijkhout, 2012. 234 pp. Lulu. Paperback, US$17.05. ISBN 978-1-105-41591-3. PDF available (free) at http://eijkhout.net/texsci.
Victor Eijkhout wrote one of the best TeX reference books—TeX by Topic (https://www.eijkhout.net/tex/tex-by-topic.html). Therefore the publication of his book about the computer science of TeX is an interesting and important event for the community.
The book is a collection of lecture notes for the computer science course the author taught in 2004. They still have the unmistakable look and feel of notes we may have read in our student years: obligatory blurbs about the textbooks used, including their library call numbers; “to do” footnotes, addressed to the professor himself rather than to the students; an unfinished chapter, and even missed sections (nevertheless mentioned in the table of contents).
The idea of teaching computer science based on a large program written by one of the founders of the field is very interesting. It is controversial too: unlike toy programs written in order to illustrate the theory, TeX is a “real life” program, with its real life compromises and errors. It is also a large and intricate program, and thus difficult to separate into parts, each neatly illustrating this or that computer science topic. On the other hand, we do teach students of biology and medicine by dissecting “real” organisms and explaining in this process both the general laws and specifics of this individual. However, the study of complex organisms usually takes place in quite advanced courses; for introductory ones a teacher usually chooses examples with simpler anatomy, like ringed worms.
Eijkhout avoids the complexity of TeX the program by the following device: he never quotes the actual Pascal (or Web) code. Instead he talks about the algorithms and design decisions of TeX. Which is, in my opinion, a good decision for an introductory course, but one that makes the rather ambitious title of the book slightly misleading. A more fitting name would be “Introduction to Computer Science with Examples from TeX Algorithms”.
The first chapter of the book contains a concise introduction to TeX and LaTeX. Most of this material will be familiar within the TeX community, but Eijkhout’s characteristic style makes the chapter good reading. The second chapter, on parsing, introduces generative grammars and automata. While the author mentions the role of parsing in the tokenization process of TeX, most of the material is illustrated by lex and yacc—in my opinion, a good decision. TeX becomes prominent in the next chapter, where line-breaking and page-breaking algorithms are discussed. This allows the author to introduce complexity, NP-complete problems and other more or less standard notions of an introductory computer science course. This is probably one of the best chapters of the course since it blends computer science and TeX in the most natural way. The fourth chapter discusses fonts, curves, rasterization and other geometric-related algorithms used by METAFONT and other font-drawing software. The fifth chapter should discuss TeX macro language—unfortunately, it is unfinished. The author returns to fonts in the sixth chapter, where he introduces encodings, Unicode and the way LaTeX deals with encoding issues. The last chapter is devoted to software engineering as a human activity; the lectures included literate programming (the notes for these are absent), teamwork and related concepts.
Thus, the book is rather uneven in its style. Some chapters, like Chapter 2, are very detailed and well written. Some, like Chapter 5, are unfinished or, like Chapter 7, just sketchy.
I think the best audience for this book is teachers of computer science and related courses. They might find many interesting ideas for explaining complex concepts. This book might be also interesting for the people who know the basics of computer science and want to look at the field from a different angle. It is more difficult for me to imagine a novice using this book for an independent study: it is what it is, lecture notes rather than a full-blown textbook. As long as one does not approach it as a textbook, it makes for very interesting reading.