Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
ExactTex. A gradually-typed superset of LaTeX (github.com/camilochs)
28 points by camilochs 5 days ago | hide | past | favorite | 22 comments
 help



This is the first time I've read that LaTeX's problem was a lack of types.

But one of its problems surely is "horrible error messages", and this project addresses it, too.

However, it doesn’t address the atrocious compile times, excessively verbose syntax and fragile macro system.

The thing is, my goal was to enhance the text editor and improve the error messages, but not to abandon TeX. That's the price I have to pay.

Types are just the mechanism. The real problem is the one fph pointed out: LaTeX reports errors in its own terms instead of the author’s, and review comments live somewhere else. Gradual typing is simply how the compiler can understand the names you introduce without pretending that all of LaTeX can be typed, because it can't.

I do not believe that writing native LaTeX code is difficult today, given the popularity of AI-assisted coding. In comparison, using a "compiler that outputs LaTeX code" may be less stable.

I used to take notes in latex. I was fast enough to do it with snippets etc. Just skip over mistakes and fix them later. So for that application I think AI assistance would still be not very useful?

Also if you were to do assignments with latex it could be sketchy too if the class prohibits AI and you "fixed" your code with some AI help.


It does not take some other language and compile it down to LaTeX. LaTeX itself is the source, and it goes through unchanged. What ExactTeX adds is a layer of checks and diagnostics based on the names and annotations you introduce. If anything, AI-assisted writing makes that layer even more valuable. Agents can generate LaTeX quickly, but they also make mistakes quickly, and an error like "Missing } inserted" is no more helpful to an agent than it is to a human.

I hope tex gets replaced by typst. It much more pleasurable to write in in my opinion.

It seems every article about LaTeX is a rallying call for Typst fans to inject their opinion of how amazing Typst is into a largely unrelated discussion, instead of reading and commenting on the actual article.

This is a repo for a new thing that is not identical to LaTeX, but intended as an improvement upon it. Typst seems apropos to bring up in related conversation.

If the parent compared the approach between typst and ExactTeX sure. The two probably should be compared.

"I like typst" doesn't quite seem to fit the substance I'd expect of a comment.


I agree that Typst is nicer to write. The difference is simply in the approach. Typst replaces LaTeX and expects you to migrate, while ExactTeX is a strict superset. You can rename a `.tex` file to `.xtex`, keep the exact same output, and add checks only where you need them. It is meant for the existing papers, templates, and journal classes that are not going away. Typst works well if you can leave LaTeX behind. ExactTeX is for cases where you cannot or do not want to.

The problem with latex is definitely not types, not unless you're maintaining hundred line macros and defs. I think one problem is just that it's hard to represent 2d stuff in 1d. Like let's not even talk about equations, what about drawing tikz? It's like writing regex, I don't want to touch it again after I'm done.

Sometimes I rather just draw in inkscape and embed the PDF.

Also, taste. It's still kind of a wild west so you see people using the italics d for derivatives instead of the differential operator upright bold form. I guess because it's hard to type those out compared to "d". There's probably a lot more, but this is the most common. Some common whiteboard things that are just not obvious when typing in latex.

In any case it's good enough for what it is and with AI it will probably improve further, maybe I will just get it to fix all italics "d"s in the future so poor typesetting just gets fixed in post. That will probably enrage some people though :)


> It's still kind of a wild west so you see people using the italics d for derivatives instead of the differential operator upright bold form.

Upright and italic are both valid, but I don't think that I've ever seen a bold "d" used for an ordinary (scalar) derivative. I've seen it occasionally used for vector derivatives, but even that's rare.

> I guess because it's hard to type those out compared to "d".

This is intentional in many cases [0]. (But similar things like writing "sin" in italics is never okay and is just pure laziness.)

[0]: https://tex.stackexchange.com/questions/14821/whats-the-prop...


I added types because I wanted a better text editor for LaTeX; I was tired of using Overleaf, so I created Vitela (https://vitela.artificialfallibility.com/). Types provide me with useful information before compiling, similar to what TypeScript does with JavaScript.

AI slop.

You can tell it's slop because of the way that it is.

The heading "The type system is gradual, and that is the whole design" is a dead giveaway.

Actually the whole "How young this is" section reads very LLM-y. Claude, I think? It's funny that LLMs have more distinctive authorial voices than so many people.


Yes, Claude, good ear :) The compiler was built with agents; the repo has an AGENTS.md describing how they're used. Without them this would have taken me months instead of days. But the design is mine, and so are the mistakes. The decisions that shape the whole thing, byte-for-byte compatibility with existing .tex, gradual typing with an explicit unknown (`?O`) instead of trying to type all of LaTeX, and review comments living inside the file, come from years of writing papers in Overleaf and wanting more from the compiler than "Missing } inserted". Vitela (https://vitela.artificialfallibility.com/) exists because once the compiler knows more, the editor can show it. Fair hit on the prose, though. I'll rewrite that section myself.

Have you seen Finding Forrester? It's a lot easier to write once you've got a frame and a few sentences you don't like on the page!

It's great to use these tools to give you more time to be a human, but the ReadMe is for humans, and is dramatically improved by being set in your voice. The problem is that when your project description looks like the result of a solid twenty minute prompt session it woefully undersells the rest of the project.

It might be cool! I might bother to learn it! But I'm not going to care more than you about it.


I rewrote it. The "how young this is" section is gone, and the design section is now in my own words. Thanks for the push!

Not to brag, but I caught it on the first sentence.

> ExactTeX is LaTeX with gradual annotation: you name the object you want checked, and what you do not name stays ordinary LaTeX, transported byte for byte.

This "byte for byte" phrase was the giveaway. You'll find it everywhere. I really detest these slop projects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: