Hacker News new | ask | show | jobs
by applecrazy 3065 days ago
I wonder if somebody has taken TeX and compiled to the browser in wasm using emscripten. That would be easier to port but heavy on load times.

Edit: it exists! https://github.com/manuels/texlive.js/ is a limited port of LaTeX to JS, rendered to PDF

2 comments

Classic TeX would be damn near useless in the age of Unicode, so you're looking at something like XeLaTeX or LUATex. The problem is that it's really easy to implement a really basic form of TeX, but unless you already planned for the really hard cases, maintaining your implementation is going to become intractible. TeX's real text typesetting is almost always woefully ignored even though _everything_ has to type beautifully, not just makes, and in modern version of TeX, that has to happen without insane syntax just to get a Unicode character we can already "just write" rather than needing all kinds of dedicated macros just for diacritics, it something as simple as mixing two writing scripts that necessitate two different fonts entirely.
> Classic TeX would be damn near useless in the age of Unicode

Unless you want to write in English, which i am going to bet it still has a somewhat large audience :-P

As soon you want to mention names of people, English text often requires Unicode characters. Looking up some examples, the first random paper I took from arxiv mentioned three surnames that needed Unicode, the second needed four, including the name of one of authors herself.

Even if you're talking purely about people in USA - for example, a page of MIT faculty https://www.eecs.mit.edu/people/faculty-advisors includes names like Jesús, Corbató and Tomás.

Doesn't TeX already handle that? A quick search shows http://vjimc.osu.cz/TeXform.html

FWIW my own name would need Unicode too (Κώστας Μιχαλόπουλος) but i always use its romanized form (Kostas Michalopoulos) in English. I think that is common when writing English text and names from languages that do not use the latin (or derived) alphabet.

An answer here would be way too long, but the short answer is "no". The technologies that were available at the time of TeX meant that TeX had to do all kinds of things that in today's world are bizarre.

TeX has seen a lot of improvements over the last 30 years, and modern TeX engines such as XeTeX and LuaTex have removed a lot of the insane painpoints that came with traditional TeX, which worked well only because there was literally nothing better at the time.

A modern TeX engine will let you just write what you want to write, using all of Unicode as your playground, using modern OpenType fonts, and with real vector graphics. None of those things can be done with original TeX, not just "it's hard to", it's literally impossible without rewriting it from the ground up. Which is why we HAVE modern TeX engines: just because it worked, doesn't mean it was good. It was merely the best available at the time.

Time moved on.

There is no "you". If the idea is to make a thing for the web, the audience is everyone there, not that one guy who insist they will only ever use English.
Compiling to wasm certainly seems like the right place to start, though it might be non-trivial to get the output to render into a canvas.