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 (http://mathbook.pugetsound.edu/index.html), 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.

3 thoughts on “LaTeX and XML”

  1. I have long been certain (about 10 years) that html (now cum MathJax) etc was the way to go because animation is what is needed for a student population that finds it hard to acquire knowledge through print reading and impossible to read “pencil in hand”. For instance, a proof should be presented line by line rather than in bulk. Linking for instant reference (i.e. without having to go through some index) to something done earlier, e.g.a definition, is also an absolute must but that can be done in LaTeX-pdf. However, after about 15 years, I am still struggling with LaTeX—fortunately, there is StackExchange—so learning PreText is way beyond the pale for me. Still, I wouldn’t mind a soft—but very, very soft, initiation to PreText.

    1. Thanks for your comment (and visit), Schremmer. I was a university professor in another lifetime and exposed to a variety of learning styles. Perhaps that experience with engineers leaves me with a little different perspective. But I understand what you’re saying and it’s a valid point.

      I took to LaTeX quickly although I still have my references that are regularly used when I’m writing. StackExchange is good and so is the mailing list. I also found a program called “Dash” that looks like a specialized browser for documentation. It will scrape StackExchange, has HTML entities, and a reference for LaTeX maths. It also has an R reference, that is another tool I use quite a lot.

      However, I’m also a programmer and perhaps that explains why markup languages, like HTML and LaTeX, were not difficult for me to learn. And, I think PreTeXt is worth a look. I’ll also have to go review MathJax as well. Thanks for that tip.

      1. Re. variety of learning style. Yeah. Still, first you have to acquire at least a modicum of knowledge. And professional mathematicians have no idea of course of what aspiring non-professional mathematicians need to even approach said knowledge. As I am sure you know, physicists used Dirac and Heaviside functions a long time before Schwartz made them “legal”. Why can’t beginners do the same with plain vanilla functions? But I am rambling. As for LaTeX and me, if you look at my stuff, you will see that the formatting is fairly complex but for the life of me I cannot dig into the simplest of the macros I am using.

Comments are closed.