Hacker News new | ask | show | jobs
by quotemstr 617 days ago
C-f r u s t RET

But of course.

I'd rather see effort go into improving LaTeX performance instead of creating some new incompatible thing in a trendy language. One could also imagine an Elixer-style "resyntaxing" of LaTeX that would preserve compatibility with decades of packages. I don't think a long-developed ecosystem should be given up lightly.

2 comments

Speed and nice error messages in (La)TeX, and to some extent ease of programming, are entirely doomed because of fundamental design choices. Being based on unhygienic macro expansion means that there is only one way to evaluate (the slow way), there will never be incremental compilation (everything can possibly be stateful in horrible ways), there will never be good error messages because there's basically no AST information anywhere (begin/end is a joke).

Regarding ecosystem: tons of undecipherable LaTeX packages are basically one-liners (ok, 10 liners) in typst. I know it from experience: I've written my PhD manuscript in typst. So perhaps one reason why there are so many (basically frozen) packages in LaTeX is because they are so hard to write and maintain.

edit: of course, being only a few years old, typst is nowhere near as solid as TeX, but you can already use it for a lot of things and its a breeze to use.

> Speed and nice error messages in (La)TeX are entirely doomed because of fundamental design choices.

Have you checked out KeenType?

https://gitlab.com/DaveJarvis/KeenType

It's a Java-based implementation of TeX, forked from NTS, that was optimized to render 500 to 1,000 equations in real-time on commodity hardware. My text editor, KeenWrite, uses the KeenType library to preview the document. The final output is passed to ConTeXt for typesetting, by way of first converting Markdown to an XHTML file. (This means that KeenWrite can export as both HTML and PDF.)

https://keenwrite.com/screenshots.html

AST information, hygienic macros, and a ton of other things can be added without starting over. What do you think of LuaTeX? I think we as an industry habitually overestimate the difficulty of evolving older platforms and underestimate the value of doing so.
TeX has three actively-maintained engines, and there are a lot of folk putting work into improving LaTeX and its ecosystem. So effort is going into LaTeX, including performance, right now. Probably someone committed a perf improvement today, or in the last week.

There are problems with TeX which can't be fixed, problems which Typst is directly addressing. I wish them all success. I will never understand the attitude which holds that because some established system exists, nothing in the same category of program should ever be written. Let people cook.

I do understand Rust fatigue but the swipe here is uncalled for. This isn't a "rewrite it in Rust", it's a new language which happens to be implemented in Rust, and y'know what? Good choice frankly. There are tasks where "fast enough" isn't a meaningful concept, and compiling raw documents into a finished form is one of those tasks.

TeX and LaTeX aren't going anywhere, and Typst has years of work ahead of it to ever offer a comparable richness of capability. If it incrementally replaces the use of LaTeX over time, that will be because it earned it.

Have you used troff lately? Probably not. Things change. And yet man pages are written in nroff to this day. Dr. Knuth wrote TeX because what existed at the time wasn't working for him. Typst likewise.

What problems with TeX is Typst fixing?

I ask because most issues I got using LaTeX tend to be the result of LaTeX additions, very rarely are they issues from TeX itself.

Heck I even took to using TeX macros at some point because while they can be an amazing footgun they're also a lot simpler.

The user interface / language design. See talk "LaTeX: It's Not You, It's Me" by Martin Haug (cofounder). TeX's language design is at the level of Basic's. Which is in fact not surprising given the timeframe.
Ah I see, so not exactly the kind of thing you'd notice making a document but you would if trying to extend the actual language. I mean TeX is basically an overpowered lambda calculus with a focus on text markup and generation.

I suppose the fact that LaTeX works at all is a testament to TeX's power, but yes I can imagine a better base language could be relevant for something like Typst.

> so not exactly the kind of thing you'd notice making a document

By "user interface" I mean (like Martin, in the linked video) the surface language, the way you interact with TeX, its syntax and how it presents itself to the user, the programming model. So definitely the kind of thing you'd notice making a document. Leaky abstractions and footguns are basically everywhere when you write a big LaTeX document.

> I mean TeX is basically an overpowered lambda calculus with a focus on text markup and generation.

No, lambda calculus has capture-avoiding substitution, aka hygienic macro expansion if you will. TeX has naive substitution. By the way, macro expansion is typically CBN, which is very much a rare and weird evaluation order (yes, Haskell, i know). TeX is much closer to some kind of assembly language for a virtual machine.