LaTeX and XML

And now for something completely different…

It is no secret (at least to those who know me) that I use Leslie Lamport’s LaTeX as my principal tool for producing written output. LaTeX is based on (one of my heroes) Donald Knuth’s TeX typesetting system. TeX was developed to support Knuth’s writing of computer science texts. Because of TeX’s beautiful output (especially of maths), others soon took up the tool.

(I despise Microsoft Word… and in general any word-processing software.)

Some time later Lamport wrote a set of macros that make TeX typesetting easier for those of us unfamiliar with the intricacies of TeX, which is decidedly low-level (but provides extreme control over output). I took up LaTeX in the 1990s while working with/on hydraulic models for U.S. Geological Survey. I loved the ease of producing very nice looking text, textbook quality maths, and working in a non-WYSIWIG environment. (Windows was just coming along at the time and I hated it.)

During that time, I actively supported something called Literate Programming, which was another Knuth creation in which both source code and documentation derive from the same file. I used the literate paradigm to produce several programs and maintained the Literate Programming FAQ list for the mailing list associated with users and interested parties of literate programming. Because there was a need to publish the FAQ in a variety of formats, I ultimately cast the source in an XML (eXtensible Markup Language) variant called Docbook. I had tools that converted the source to HTML and LaTeX (and plain text as well).

There are times when I’d like to publish maths here on my site. Yes, topics that involve mathematics still interest me and will continue to do so while I draw breath. But publishing maths in HTML is problematic. There is no standard approach that can produce beautiful mathematics rendering.

I just learned about a project, PreTeXt (, that is based on XML and can produce EPUB, PDF, and HTML from a single XML source. TeX is used to set mathematics. I have not yet experimented with the work, but the prospect of producing e-reader formatted output, as well as HTML, that contains TeX maths is very interesting to me.

Therefore, once I finish working through my backlog of paying work, I think some experimentation with PreTeXt is needed. It might change the way I approach writing work. It will be interesting.