Art Kavanagh

Criticism, fiction and other writing


LaTeX as a writing tool: a comparison with Markdown and HTML

I’m prompted to write this by a series of Micro.blog posts by Ciaran Connelly about text-based document creation tools for lawyers. In my day job, I’ve dealt with lawyers’ documents — precedents of various kinds, forms etc. — for more than 25 years. In the very early days I used WordPerfect, then developed a strong liking for Word, a preference that has soured over the years as Microsoft has added more ill-considered features, presumably intended to give users a reason to upgrade but often breaking long-established workflows and patterns of use. The addition of a plethora of minimally differing built-in styles, making it difficult to find the one you’re looking for, or even to remember the ones you’ve already used, is one example.

At one point I was reasonably familiar with LaTeX, having used it as my main writing tool for about a year, around 1999/2000. I initially wrote a chapter of my doctoral thesis in LaTeX. That came to 18,000 words. I haven’t used the system more recently than 2000 or thereabouts. As I’ve written before, I really enjoyed writing in LaTeX. Somehow, it’s a lot more satisfying to type \section{Writing tools} than it is to type <h1>Writing tools</h1>. (I think it’s partly because, on the keyboards I was using at the time — though not on the one I’ve got at the moment — I typed that opening backslash with the little finger of my left hand.) I’ve often missed being able to write in LaTeX but, on the face of it for someone in my situation, it doesn’t make a lot of sense to go back to it.

Note: the chapter I wrote in LaTeX That chapter, which is about the theme of justice in Marvell’s lyric poetry, is the kernel of the thesis and by far my favourite chapter. I put that down in part to the enjoybale process of writing it.

The first reason for that is that LaTeX is a system primarily intended to prepare documents and text for print. Documents written in LaTeX look typeset: they have generous margins, columns of text that aren’t so wide as to impede readability, a well judged amount of space around headings and titles. By default they have a justified right edge and hyphenation. Footnotes will be in an appropriate font size, proportional to the main text (without any calculation on your part) and neatly laid out at the foot of the page. If your document is going to be printed on paper or presented as a pdf, it’ll look great. But I find that I’m actually printing very little these days.

Much of what I write ends up on the web, where it may be displayed at a variety of screen sizes. It will be unhyphenated and will almost invariably have a ragged right edge. It may need to reflow and might appear in a font face and at a size that I could never have foreseen. For a variety of reasons, LaTeX isn’t a great match for this kind of writing. The type of markup that is suitable — that’s expressly designed for it — is HTML. But I haven’t been able to get as enthusiastic about writing in HTML as I used to be about LaTeX.

One of the main things I find unsatisfactory about HTML is the redundancy. I can’t see any good reason why a block element should need to be closed. It obviously ends when the next block element starts or the parser/browser encounters an empty line. Inline elements need to be closed but it shouldn’t be necessary to spell out which element is being closed: compare \emph{unnecessarily longwinded} with <em>unnecessarily longwinded</em>. Clearly “emph” is twice as long as “em” but to my mind that’s more than compensated for by not having to type it twice or do that awkward manoeuvre of following a left angle bracket with a slash. As I’ve said before, it’s this redundancy that makes Markdown (and other lightweight markup languages) possible. The problem with Markdown is that it’s not a final format: at some point it has to be processed to turn it into HTML.

So, having read Ciaran Connelly’s series of microposts on the topic, and motivated no doubt in part for nostalgia I decided to take another look at LaTeX, nearly 20 years on. One thing I was quickly reminded of was the rather inelegant way that LaTeX (by default) handles characters which fall outside the ASCII character set. One of my biggest complaints against HTML when I first used it was the need to type entities for curly quotes (e.g. &ldquo;), apostrophes (&apos;), dashes, ellipses and so on. UTF-8 eliminates that irritation and, I’ll admit, has made HTML much more pleasant to write in. In LaTeX, I used to have to type two backticks for an opening double quote, two hyphens for an en dash and three for an em dash. I think of that as making the document uglier in the short term in order to make it prettier eventually. Would I really be willing to go back to that?

But if HTML has been able to accommodate itself to Unicode, why shouldn’t the same thing be true of LaTeX? And it seems that it is. So maybe I’m ready to pay a gentle, nostalgic visit to LaTeX. If I do, I’ll post about my impressions and experiences here.

As I was Googling to refresh my memory and catch up on more recent developments in LaTeX, I found this piece by Daniel Allington: The LaTeX fetish (Or: Don’t write in LaTeX! It’s just for typesetting). Quite apart from his brilliant labelling of excessive enthusiasm for LaTeX as a “fetish”, Allington makes some very telling points as to why LaTeX is not a good choice as a writing tool. He’s particularly good on the alleged superiority of LaTeX over word processors like LibreOffice and Word. I’ll probably post separately about that here, soon.

Posted by Art on 22-Sep-2019.