Erik's Blog - A Successor to LaTeX

A Quick Note on Typesetting to the Uninitiated

Typesetting programs process source files written in markup language which specifies the content and layout of the document and produce (typically) a PDF document. Some examples in order of inception are troff, LaTeX, and Typst.

On the other side of the spectrum we have What You See Is What You Get (WYSIWYG) editors like MS Word or LibreOffice which allow you to do the formatting and layout directly on the document file inside the application.

Humble Beginnings

As someone who studied mathematics at university before they stumbled their way into the software world, the feature scope of common WYSIWYG editors typically did not cut it when it came to mathematical formulas or properly embedding graphs and images. The obvious - and really the only - choice at the time was LaTeX.

The pitch was very simple: you’re telling me that I can just write a plain text file specifying some macro names to get the Greek letters and format the expressions, run it through a compiler, and get a properly typeset PDF out of it? Without having to scroll through lists of symbols and without having to worry about accidentally moving an image a pixel to the left and thus forever destroying the previous layout that I had worked so hard to get right? And I can change the general style of the document later without having to go through it manually and move around every single image? Where do I sign?

Mind you, at the time, I was not aware of the commonly cited advantages of working with plain text files; like having free choice of the text editor you want to use or putting the entire document under version control. Not having to wait for the behemoth that is MS Word to open was already enough to at least give it a try, even if a lot of characters commonly used by LaTeX macros were rather tricky to input on the standard German keyboard layout that I was using at the time, like curly braces {} or brackets []. On German keyboards these kinds of symbols are usually locked behind a complicated combination of the Alt and Shift keys.

A lot of professors at my university did not see the need to provide lecture notes for their classes, so there was a lot of opportunity to familiarize oneself with this new world of typesetting. There were working groups, a contest of who had the best self-defined macros among the student body and a general spirit of camaraderie in suffering (both due to the nature of studying mathematics, and large negative integer value badness and overfull hboxes).

I even wrote my philosophy papers in LaTeX. Since I already had the pipeline, might as well use it, right? It was, all in all, a rather pleasant experience; you defined the preamble once and could just write the content for all following papers resulting in the same style of document. Bibliography was taken care of more or less automatically and everything built nicely on the previous work that had already been done.

Atrophy

After leaving university and entering the world of corporate software development, however, I found myself faced with a culture that neither understood nor appreciated my beloved typesetting tools.

Word documents as an information exchange format instead of PDFs - you know, the thing that was specifically built for exchanging documents, Powerpoint slide decks (sometimes with transitions!) as functional documentation… I digress.

MS Office was, and still is, the prevalent set of tools to use in corporate contexts, “because everyone already knows how to use them”, right?. In that statement itself lies a question, in my opinion, whether it would not be better to teach people how to use proper tools instead of just relying on the lowest common denominator.

I’d love to say that I stuck with proper typesetting tools for the love of the game, but when you start a new job in an unfamiliar field you are not technically trained for, there’s enough to occupy your mind for a while. Modern software development - and probably most things that are not university homework assignments - is a team effort and not using the same tools as everybody else makes collaboration difficult.

“Hey, can you send me your slides so we can put them in the same slide deck?”

“Here are the corporate templates to be used for presentations. Makes things easier, right?”

These conversations usually don’t last very long, if you try to explain the advantages of proper typesetting. Even if you manage to convince your team to use something other than MS Office, there will inevitably come a moment when you need to collaborate with someone who refuses to use anything else, most likely someone with more authority than you. And so, my LaTeX muscles atrophied.

A Successor

After not having done any typesetting for a year or two, I realized a bit of a misconception regarding LaTeX the next time I worked with it though. What I had seen as this wonderful and intuitive tool, was in fact a collection of arcane secrets that is very hard to maintain in your mind if you don’t constantly use it.

Learning it is great when you’re a university student with too much time on your hands, a reason to practice it, and a community of like-minded people to discuss things with. It’s less enjoyable when you’re working full-time and are surrounded by people wondering out loud why you always want to take the complicated route.

Don’t get me wrong here, I would still prefer LaTeX to Word any day of the week, but that does not mean that everything is great.

I have this habit of updating my CV every 6 months or so, more as an opportunity for reflection than for any immediate job hunting. The latest version of it had been written in LaTeX based on someone else’s template to which I had made a number of modifications, so that it fit my needs.

Was this overkill? Probably. Did it make the mind-numbing act of listing all your best qualities in the most positive light a little more interesting? Absolutely.

Now, I wanted to change the layout of some parts and was in the middle of figuring out why the hbox that contained my custom minipage was overfull when I was distracted by a Reddit post announcing the 0.1.0 release of Typst, a new typesetting system, which had the express purpose of addressing some of the issues one might have using LaTeX.

So, I gave it a shot. Now, I know there is a web app, but I haven’t tried it personally; it looks great and especially in an academic context I can imagine that the collaborative features and easy access are major advantages. I remember once spending about two days getting a workable LaTeX setup to run on my iPad because my computer had broken. For my personal workflow the open source compiler was more than sufficient.

Recreating the layout I had had in my LaTeX-based CV (something that had cost me a week or two with decent working knowledge of the language) took about a day, including picking up the Typst language. Making the layout changes I had wanted to make to the LaTeX version took about an hour. It was a revelation!

In general, the language flows quite pleasantly and the features complement each other. The standard functions can be composed to allow for powerful scripting. Error messages are clear and nicely formatted, inspired by how the Rust compiler does it, if you’re familiar with that. The compiler also utilizes memoization, so that compile times are significantly faster than with LaTeX. Typst uses its own library comemo for that.

I got so excited about this language that I ended up making a small contribution to the compiler diagnostics output, so that I could integrate it even more nicely into my vim-centric workflow without the need for a language server. The interactions I have had with the Typst community have been nothing but pleasant. The fact that they offer a Nix flake is an added bonus, especially in a quickly evolving language that may have breaking changes.

Recently, Typst even got a package manager. Their blog post about it is an interesting read about trade-off decisions made during software development regardless of whether you are interested in the language or not.

Spending my workday building and maintaining corporate software, the grassroots origin story of two guys in Berlin, Germany, being annoyed at LaTeX and setting out to create an alternative hit a nerve and brought back that excitement I had had for typesetting in university. Looking at the current state of the language and the topics on the roadmap, Typst seems like a viable contender for the title of LaTeX successor.