Complexity of HTML and LaTeX

Sometime around 1994, my office mate introduced me to HTML by saying it was 10 times simpler than LaTeX. At the time I thought he was right. Now I’m not so sure. Maybe he was right in 1994 when the expectations for HTML were very low.

It is easier to bang out a simple, ugly HTML page than to write your first LaTeX document. When you compare the time required to make an attractive document, the effort becomes more comparable. The more sophisticated you get, the simpler LaTeX becomes by comparison.

Of course the two languages are not exactly comparable. HTML targets a web browser while LaTeX targets paper. HTML would be much simpler if people only used it to create documents to print out on their own printer. A major challenge with HTML is not knowing how someone else will use your document. You don’t know what browser they will view it with, at what resolution, etc. For that matter, you don’t know whether they’re even going to view it at all — they may use a screen reader to listen to the document.

Writing HTML is much more complicated than writing LaTeX if you take a broad view of all that is required to do it well: learning about accessibility and internationalization, keeping track of browser capabilities and market shares, adapting to evolving standards, etc. The closer you look into it, the less HTML has in common with LaTeX. The two languages are not simply two systems of markup; they address different problems.

Related links

8 thoughts on “Complexity of HTML and LaTeX

  1. Drop in a little css and some java script, plus all the behaviors (browsers) you described and it’s a h— of a lot harder. Although I have beaten my brain senseless with both of them.

  2. I certainly love LaTeX – I write most of my stuff in it. But I do wish it could be just a little more orthogonal.

  3. I have wondered about similarities and differences between the two as well. Their development has also been conducted very differently. In the case of LaTeX, a few people drove language development. It’s a remarkably portable, cohesive markup system. I believe few people code HTML from scratch nowadays. Conversely, a vast majority of people edit LaTeX source rather than using front-ends like LyX. Even if (La)TeX is much humbler in its goals, it is a remarkable success story.

  4. I think the relation goes the other way around: the larger and more complex your needs, the less reliable TeX variants become. Styles (read: arbitrary macros, really) interact in odd, unpredictable ways, and it’s very hard to determine where spacing comes from in a particular document – particularly if you’re deviating from the “default” latex a lot.

    Also, the more complex something becomes, the more reasonable some form of auto-generation and multi-authorship becomes. Indeed, TeX’s macro’s actively encourage that. Unfortunately, TeX deals with syntax and other errors very poorly, probably partially because it’s a self-modifying language: I doesn’t look to be possible to write a parser that’s not also an interpreter of the underlying semantics. So – when something “breaks” in (macro)generated code you may not get the error anywhere near the root cause, but possibly pretty much anywhere – which isn’t good for complex documents.

    Then there’s the fact that TeX is slow – this is a problem for complex documents because it implies discrete compilation steps – which in turn mean that any errors do not immediately become apparent, which exacerbates TeX’s inherent brittleness.

    So, TeX works best if you’re using prepackaged styles for as much as possible of your layout and only combining these from as few as possible sources. By contrast, html+css doesn’t suffer from these problems, but also lacks the small-scale (but no less valuable) handy math-markup.

  5. Eamon: You make some interesting points. You’re thinking about scaling in a different direction. I was just thinking about the complexity of typesetting a single document by a single author, but you’re looking at combining input from multiple sources.

  6. Some things in Latex are just damn near impossible compared to HTML, like making an image fill the remainder of a page. Other things in Latex just don’t work the way one would expect. When making a full-page image in Latex, I often get a blank page before the image, for no apparent reason. Something as dead simple as “don’t create a new page when there’s no content to put on it” is like pulling teeth with Latex. These days I’m looking at ways to generate PDFs with javascript so that I can simply generate document pages with HTML and convert them to PDF single-pages, then merge all pages using jsPDF or something.

Comments are closed.