* TeX's boxes-and-glue-and-penalties model is remarkably simple and flexible, as the author says. I've long been planning to write a post about this; the Knuth–Plass paper has some beautiful examples of how much you can cleverly achieve with such simple primitives. Really a model of elegance.
* This simplicity allows some ingenious solutions. With TeX (especially LuaTeX) one can do things that require knowledge of where on what page a paragraph is on: see for example this "demo" of mine: https://tex.stackexchange.com/a/403353 — of course one is fighting the system to some extent, but it is possible.
* Of the three “Challenges” it discusses, the first two “Varying container width” and “Side-floating elements” are both examples of things that are possible in TeX with caveats (parshape and wrapfig), but currently not possible in Typst — would be nice to see those limitations removed in Typst in a clean way.
The margin calculations can definitely be improved, but in order to swap typesetting systems I need to be able to do at least this much (including the TikZ/PGF rendering for the images).
This was a really great write-up, and gives me a lot of hope for the future of Typst. I think one of the best ways to overcome the enormous momentum of TeX is to point out its limitations (while still keeping an eye on Typst's limitations), and explain how Typst overcomes them.
> I think one of the best ways to overcome the enormous momentum of TeX is to point out its limitations (while still keeping an eye on Typst's limitations), and explain how Typst overcomes them.
One of the other easy ways to overcome it is to provide as many templates as possible for journals. I’ve used LaTeX for years, but would by no means consider myself an expert in LaTeX, as I’ve almost exclusively been able to grab a template from a journal or from my university, and then just draft in the relevant blocks, write equations, add figures, and, rarely, add a package. I would guess that there are a huge amount of LaTeX users like me out there. I do all my drafting on Overleaf. I love TeX (and curse my PI whenever he requires that we use Word/365 instead of LaTeX/Overleaf)… but so much of the benefit, for me at least, comes from the fact that templates are readily available for any journal I would want to submit to; my masters thesis was built in a template provided by my university; etc. I don’t have to deal with any of the cognitive overhead of styling and formatting (except for flowing the occasional figure) and can just focus on drafting.
For me to even consider typst, it’s pretty much a requirement that there is some degree of template parity actively being worked on. The most natural way to approach that would be to just sort every journal by impact factor and start working top to bottom; given that so many journals share templates due to being within elsevier, springer etc, it should be straightforward to reach a reasonable degree of parity relatively quickly.
Getting the major publishers to support and offer their Typst templates would make me try it out immediately for what it’s worth.
Many journals require LaTeX due to their post-acceptance pipeline. I use Typst for letters and those docs for which my PDF is the final version (modulo incomplete PDF/A in Typst), but for many journals in my field, I'd need a way to "compile to LaTeX" or the journal would need to implement a post-acceptance workflow for Typst (I'm not aware of any that have).
Right, I guess that’s my point: If Typst wants to compete with LaTeX, IMO it needs some sort of mechanism by which journals will deem a Typst submission acceptable, along with readily available templates for said submissions. That’s a big hill to climb probably, but probably the single most valuable development they could achieve from a product diffusion perspective.
Interestingly enough, e.g. Elsevier accepts latex but has their own typesetting backend. Which typically means that the last editing steps are quite annoying, because even if one is using the provided latex templates, what actually happens for the final typesetting is done by some mechanical turk editor on a slightly different publishing system.
Exactly - they require LaTeX not only to make it match the style, but because the final document is a prepared LaTeX work. Sometimes you can even see all the hooks and such that are waiting for \include and similar.
One of the big benefits of LaTeX is the ecosystem of packages, but that only happens because so much effort was put into creating a package mechanism for the typesetting system. LaTeX has a long history of providing the technical infrastructure for package creation, and that was one of the main focus since its inception. No typesetting system can compete with LaTeX without a focus on package and template creation. My personal view is that LaTeX will continue to be king in this area for the foreseeable future.
Typst has a far easier to use packaging system but the default feature set is already good enough for the most.
Don't forget that many LaTeX packages exist solely because TeX and LaTeX suck and they are very underengineered save-the-day type of languages. They survived since everybody else asked money for their better typesetting systems. It is quite similar to how Unix and Unix-like systems survived despite the mountains of OS research and many new, more secure (usually paid) OS implementations.
I don't think it generates better results than Adobe Indesign nor it is easier to use.
One wonders why LaTeX has many users?Larger userbase can easily explained by being free. Students and PhDs usually don't have extra money to buy or nowadays rent Indesign but LaTeX is there for free. It doesn't mean it is technically superior or nice to use.
It does if one is doing typesetting math-heavy documents. Nothing really matches TeX quality or flexibility in math typesetting, not even typst (yet, at least).
Yeah, exactly. Having used LaTeX for around two decades, I'm really eager for something to replace it, because honestly, it's very old and it shows (for example, among many other issues, dealing with non-English characters is still a pain, in spite of hack upon hack upon hack).
But if there is no available template for the venues where I publish (in my case mostly conferences, although also some journals) it's not feasible for me to replace it. Maybe I could for slide presentations, posters or other documents that I design from scratch, but I'd say that's no more than 20% of the time I spend with LaTeX. The majority of the time I'm working with conference or journal templates.
I remember in word for windows (Either 2 or 6, not sure) on my 40MHz 386, you could watch it reflowing text if you edited a paragraph near the beginning of a multi-page document. It would correct for widows and orphans, which would cause surrounding pages to potentially do the same. It could take a non-trivial amount of time to stabilize, and if you printed a document before it did, you could end up with duplicated or missing lines at page breaks.
I find it mildly irksome that Hacker News readers often assume that blog posts are always written for someone like them - i.e. someone unfamiliar with the author who happened upon the post without context.
That used to be the way blogs work, just written for a broad, unknown audience, but these days most blogs are written with a specific audience in mind, often one that knows the author reasonably well. Sometimes the blog is even just a secondary place to have an archive of the post, the main intended place being a post on a close-knit forum.
Once you take away the assumption that you're the intended audience, it's much easier to see the article - and the things it says and doesn't explicitly say - in a clearer light.
I didn't get that impression at all. The first paragraph includes the sentence:
> I want to use this post to explore these differences, to identify the benefits and limitations of both models, and to present my thinking on the future of Typst’s layout engine.
Which immediately made me think the author of the post was involved in Typst development.
Typst is a re-flowable document description language; TeX spends more computation on the One True text justification and hyphenation paragraph builder.
PDF has recently implemented a limited reflow feature by marking up text elements with metadata tags originally introduced to add accessibility features, hints for text to speech...
Meanwhile, Amazon has moved new books and user-submitted documents from its own Kindle format to ePub.
ePub is the e-book standard format that extends a subset of HTML.
Web browser teams have been hurling themselves against the walls of nearly-intractable layout cases for decades now.
We take it for granted: on your Kindle e-ink reader, change the font size. Boom: the whole book has to re-compute its layout.
Typst is far more computationally efficient, even elegant, but as yet it can't flow text around embedded sidebars or images.
Great article. Appears to be one of those articles where writing it forces you to think and leads to new solutions like relayout.
As for myself I've completely abandoned LaTeX for Typst and couldn't be happier. My life will be better if I never have to touch LaTeX again. (Have written almost a dozen books with LaTeX.)
> As we’ve seen, TeX’s model falls short on everything that requires knowledge of exact vertical positions:
Interestingly, classical CSS had a similar limitation, that height is determined by content size, leading practitioners to search for the Holy Grail [1].
Not surprising, of course, given that both are (originally) document-layout systems first and foremost, and given that we write horizontal lines, the primary layouting constraint has always been the width of the page/monitor/clay tablet/whatever, and the text (and possible other content) then just flows to whatever "height" is required (or until one runs out of space).
Also interestingly, Chrome began supporting pagination recently[0] which until now required something like pagedjs. I wonder to what extent Typst's (or TeX's) layout model can map onto CSS now. I would assume concepts like widow and orphan prevention are not implemented but I haven't looked into it.
For my own work, I already find Typst superior to TeX and I use it in some of my PDF creation pipelines. One can debate the differences of math syntax, of course.
For documents whose source is likely to be shared or handed over to other people, writing in TeX rather than expecting them to learn a new language is still good citizenship.
The big differences for me are:
(1) TeX has the feeling of separating the author and editor, I get to write my stuff and someone else (Elsevier etc.) handles the template and layout. This is a good thing when the two are actually different people, but when I'm asked to do both ("write this up in the style of that") there's a whole lot of Yak Shaving to get it right. For Typst it's much more intuitive to say here's the page layout, this is the font to use. (yes XeTeX exists, but that has other problems over here)
(2) TeX ends up in dependency hell sooner or later where package X is incompatible with Y when you've also loaded Z. There's a lot in the comprehensive LaTeX symbol list where you just want to load some symbol to draw a triangle and you end up fighting the Type1/Type3 fonts thing and getting stmaryrd to play nice. I still don't have a clean solution for making some basic shapes (circle, triangles pointing in several directions, square, diamond) that come in outline and filled versions and take up space exactly from the baseline to the cap line (I could probably live with just the x-height instead).
"For documents whose source is likely to be shared or handed over to other pe ople, writing in TeX rather than expecting them to learn a new language is still good citizenship."
Conversely, my entire interest in Typst is have an input format more efficiently read by AI. We've passed the inflection point where one can responsibly only write for humans.
Typst is Markdown-adjacent, while PreTeXT is XML-adjacent. More characters but even easier for AI to process. I'd switch for the HTML and ePub support, but no syntax coloring for code blocks?
Calling writing for just humans irresponsible is quite the claim. Personally, I'd rather AI did not injest anything I write whatsoever. Not that there's much I can do about it.
The one thing the Typst could do to eclipse TeX is market itself to authors outside of STEM disciplines who still possess a willingness to get their hands techy.
I view Typst on the high-end of software that can encourage more people who are into the "arts" or "humanities" into coding.
I used it once to typeset a booklet and had a lot of fun. One of the benefits of it being new and having an engaged community and being just fun to use is that I got to explore different workarounds to achieve certain layouts, learning more about how it works along the way.
* TeX's boxes-and-glue-and-penalties model is remarkably simple and flexible, as the author says. I've long been planning to write a post about this; the Knuth–Plass paper has some beautiful examples of how much you can cleverly achieve with such simple primitives. Really a model of elegance.
* This simplicity allows some ingenious solutions. With TeX (especially LuaTeX) one can do things that require knowledge of where on what page a paragraph is on: see for example this "demo" of mine: https://tex.stackexchange.com/a/403353 — of course one is fighting the system to some extent, but it is possible.
* Of the three “Challenges” it discusses, the first two “Varying container width” and “Side-floating elements” are both examples of things that are possible in TeX with caveats (parshape and wrapfig), but currently not possible in Typst — would be nice to see those limitations removed in Typst in a clean way.
* In the TeX world, note that there is Martin Ruckert's ongoing HINT project, which moves some of the TeX layout to the client (custom viewer), and thus supports arbitrarily varying widths (really cool to read a hint "book" on a phone): https://hint.userweb.mwn.de/#:~:text=TEX-,HINT,-%2C%20follow... (demo videos here: https://hint.userweb.mwn.de/hint/video/ and articles in TUGboat: https://tug.org/TUGboat/Contents/listauthor.html#Ruckert,Mar... )
On the whole, happy to see this post and that more attention is getting paid to text layout.