Live data from Hacker News

I ported LaTeX to Javascript

manuels.github.com

21–30 of 73 posts

Re: I ported LaTeX to Javascript

#22
post #4
post #2

Promising. I am getting some error messages though. lstat(/bin) failed ... /bin : No such file or directory warning: kpathsea: configuration file texmf.cnf not found in these directories:

These errors are save to ignore. You have to wait some seconds until compiling has completed. Note that the browser might prevent the website from opening the PDF (Pop-up blocking)

OOOOooh.

Re: I ported LaTeX to Javascript

#25
post #18

Some background would be nice. Wasn't LaTeX notoriously hard to port – to the point that a LateX app for iPad actually ran in an emulator initially [1]. Is this port based on web2c as well? [1] http://www.litchie.com/?p=419

Nevertheless it's a good effort as a proof of concept. I'd also appreciate info on whether Latex packages will be supported in the future. At the moment this does not seem to be the case, though I can imagine this would be a challenging problem to solve for in-browser compilation of documents.

Latex packages are not supported automatically. The script has to download the required files in advance which is currently only done for the font file etc.

In theory one could search the LaTeX code for '\usepackage' stings and download the required files and mount them into the virtual filesystem of emscripten.

See https://github.com/manuels/texlive.js/blob/master/website/ma...

Re: I ported LaTeX to Javascript

#26

This part of the document isn't rendered correctly in the resulting pdf: In printing, text is usually emphasized with an \emph{italic} type style. In my pdf it looks like the every other letter, starting with the first, is missing from the word italic. It looks like " t l c ". Maybe something is wrong with the fonts. I'm using the latest Chrome on OSX.

Yes, the font file for italic fonts are currently missing (See https://github.com/manuels/texlive.js/issues/1)

I could not figure out which file is missing, yet. but as soon as I find it, I will include it and fix this.

Re: I ported LaTeX to Javascript

#27
post #21

Does this presume a local Unix filesystem? It sure doesn't like the lack of a /bin directory on Windows.

No, emscripten emulates a virtual unix filesystem. That's why you see this error on a Windows machine.

It would probably be useful just to say something like "script output" - I expected the right pane to display the compiled result from the left pane, but instead saw error messages.

And yeah, expected error messages like the no-/bin should probably be filtered out. But man, great idea!

Re: I ported LaTeX to Javascript

#28
post #16

Nice, but this constantly crashes Safari when the content goes below the fold. The whole page goes white and then the browser dies.

Sad to hear that. I don't use Safari, but maybe it cannot compete with the JS engines of Firefox and Chrome's version of the Webkit engine.

This script reqiures a lot of computation in JS and communication between the website and the webworker (~300kb). Maybe Safari is unable to cope with this in a decent amount of time.

Re: I ported LaTeX to Javascript

#29
"Hurray, I'd love to hear more about every single software written in the past 70 years compiled to LLVM bytecode and then translated with Emscripten to JavaScript!"

I would hardly call this porting something.

EDIT: I just remembered I ported Microsoft Word to Linux by running it inside a Windows VM.

Post reply on HN