LaTeX or Typst
January 31, 2025When I started my second year of my Bachelor's studies, I suddenly had to write scientific reports every week. I remember being in the lab on Mondays to collect measurements, and having to submit a four-pages report on Thursdays. The reports at that time were perhaps not the best, but it was for sure a first step in the process of writing about a research topic.
Before starting with these weekly appointments, we were told that we would need to write everything with LaTeX. The name didn't ring a bell, because before that I'd only used softwares such as Microsoft Word for text processing. I downloaded a local LaTeX editor and took a look at it. It didn't take me too long to understand the appeal of it.
From page layout to writing mathematical expressions and inserting tables and graphs, everything was pretty straightforward. All I needed to do was googling the things I wanted, and the more time passed, the more familiar I became with these new concepts. This is how I was able to create presentations with the “beamer” class, or posters with the “baposter” class, but also forms for exams, or even my CV. Collaborating with people was also possible: all we needed to do was to create an account on Overleaf, and there we could store our projects. Plus, it gave us access to libraries without even having to install them locally on our computer. So by the time I got to the end of my Master's degree, and had to write my thesis (consultable on the CERN Document Server), I was able to use more advanced layout tools, and create the desired effects with ease.
Once I reached the PhD, I was able to refine my knowledge, creating a whole system of sub-files put together to create papers, research notes, or even my PhD thesis (available on the Belle II Document Server). Although there are still many aspects I could explore, I think I can say that I've used quite a few features. And that's when I heard about Typst.
Unlike LaTeX, which has been around since 1985 (!!), Typst emerged only in 2019. But despite the fact that it's been available for less time, Typst already boasts many features that give it great potential. As in the case of LaTeX with Overleaf, Typst can be used online through Typst app. The first thing I noticed, probably like most of the users, is that the text I wrote was instantaneously appearing on the preview page on the right. As I'm familiar with the sometimes record compilation times with LaTeX, this ability to render text directly pleased me right from the start. After learning a few bits and pieces, just as I'd learned LaTeX back in the day, I realized that there were other things I liked about it: changing fonts was a breeze, tables could be composed quickly, there was no need to backslash to use Greek letters in expressions, and so on. But it's true that it's hard to break habits established over 10 years ago. And so some of these advantages also bother me.
Nevertheless, I wanted to do a little test. I took a scientific paper and tried to reproduce it as faithfully as possible using both LaTeX and Typst. For that, I wanted an article that didn't contain a lot of plots, and concise enough to not spend 3 months on this comparison. So Unitary Symmetry and Leptonic Decays submitted in 1963 by Nicola Cabibbo (10.1103/PhysRevLett.10.531) appeared as a good choice given these contraints. As this paper is available to everyone, I'm taking the liberty of showing its contents here, while obviously pointing out that it doesn't belong to me. I've deliberately hidden the articles before and after the one I'm interested in to highlight the comparison I'm about to make.
I first started with LaTeX. I hesitated to extract the text with a machine learning tool, but preferred to use good old copy and paste. After a couple of tweaks here and there, I managed to get the content of the paper. It was time to add the final touches: change the overall style, add the right page numbers, draw the horizontal bars, underline some parts of the text and create the table of values. Margins have been estimated so as to have the same layout of the text. And instead of building a bibliography as I should have, I chose to take a shortcut by just copying what was written. And here is the result:
To add transparency to my comparison, I also wanted to make available the code I used to generate the LaTeX PDF document. The same applies to the Typst version. And speaking of the latter, here's how I proceeded in this case. Instead of copying and pasting the text again from the original source, I used the text written for the LaTeX document. That was probably not the best choice, as I had the great pleasure of removing most of the backslashes, and seeing all the little differences in conventions between the two languages. But that didn't stop me from my initial goal. And finally, after a little slower progress, I was able to produce the following document:
I had to use a little trick to get the two columns at the same height on the last page, but apart from that detail, the rest of the document was pretty intuitive to write. But despite this possible ease of use, I have a preference for LaTeX. But there's a nuance to be made. For writing small texts, such as notes to be taken during a lesson, or a simple document to be made, Typst has a clear advantage over LaTeX in terms of speed of execution and ease of use. To be honest, I never thought I'd say this, but I think Typst lends itself wonderfully to this kind of use. On the other hand, and more than likely because I've used LaTeX for years and I'm biased, I find that for more advanced documents, I would prefer LaTeX.
So if I have to give an honest answer to the question LaTeX or Typst?, that is actually the title of this post, I'd actually answer the following: why not both, LaTeX and Typst. Moreover, I'm convinced that more features will be developed on Typst, and the more people who know about this language, the faster progress will be made.