In the paper ‘Should TeX be extended’ Michael Vulis described how extensions to TeX would make four problems simpler – text rotation, graphics inclusion, index preparation and font selection. Eighteen years later, all of these problems are solved in LaTeX, but TeX extensions would make it much simpler. So how these problems would affect writing documents in the general purpose programming language-based system which I proposed yesterday?
The first problem, typesetting rotated text, is solved by drivers allowing rotating of characters and ‘rotation’ of boxes in TeX. This requires computing the sine and cosine of the rotation angle. Nearly all modern programming languages support operations on floating-point numbers and have builtin trigonometric functions – simpler to use, faster, more precise than these computed by the LaTeX trig package. So this problem is solved just by writing texts in Python (or Lisp, or any other useful general purpose programming language; I will use Python as an example) instead of TeX.
The next problem is graphics inclusion. Here a picture is typeset as a box of appropriate dimensions with a special command for the driver to put the graphics there. Determining dimensions of such boxen requires parsing the graphics files in TeX, this is easy only for formats like Encapsulated PostScript or additional header files with a line specifying the size of the picture. Clearly, this would be trivial in a language with libraries like PIL.
The third problem is index processing. In LaTeX, a document contains commands to put certain index terms with the page number of the place where this command occurs. Writing a file with terms and page numbers is easy in TeX, but processing it to merge page numbers of the same entry and to sort the entries alphabetically is impossible without using external programs. This requires just some string processing, an associative array and a sorting function. I’m too young to know a programming language other than TeX or METAFONT that does not have all of these elements builtin or in its standard library. This would allow making an index in parallel to typesetting the publication if it refers only to the previous parts of the work (otherwise index entries from previous attempt would be used, like now).
The last problem is font selection, i.e. changing each font parameter like size or boldness separately. This clearly requires different font model than the one of TeX where font families did not exist except in typesetting super- and subscripts in mathematics. Here a general purpose programming language would have only one advantage – less time would be spent on the above problems and more on font representation and similar less trivial problems.
