Live data from Hacker News

I ported LaTeX to Javascript

manuels.github.com

61–70 of 73 posts

Re: I ported LaTeX to Javascript

#61

Earlier quoted context omitted.

I don't mean to offend, but I still fail to understand the excitement around this.

It's OK, you don't have to be excited about things others are excited about. You also don't have to rain on their parade.

If I had an email signature, I'd set it to this.

Re: I ported LaTeX to Javascript

#62
post #58

EDIT: I managed to find the answer to this question myself. I want to generate a bunch of bytes programmatically, then have the user click on a button, and allow the user to save a file containing the generated bytes. This should run entirely client-side, with no talking to the server (except for static loading of the HTML page, JS files, images, css, etc). I've been wanting to do this since I wrote my first Java app…

data: URIs are deprecated for generating content. Use object URLs and Blobs (https://developer.mozilla.org/en-US/docs/DOM/Blob). If you want to force saving the file to a disk use

Re: I ported LaTeX to Javascript

#63
post #62
post #58

EDIT: I managed to find the answer to this question myself. I want to generate a bunch of bytes programmatically, then have the user click on a button, and allow the user to save a file containing the generated bytes. This should run entirely client-side, with no talking to the server (except for static loading of the HTML page, JS files, images, css, etc). I've been wanting to do this since I wrote my first Java app…

data: URIs are deprecated for generating content. Use object URLs and Blobs ( https://developer.mozilla.org/en-US/docs/DOM/Blob ). If you want to force saving the file to a disk use

Yeah. Interestingly I got all the way to the download with Chrome 25 Beta (for Android) but then it couldn't handle the data URI.

Re: I ported LaTeX to Javascript

#64

Earlier quoted context omitted.

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.

I've seen emscripten-generated JS crash Safari before. It's not a performance issue; jsc is plenty fast and beats SpiderMonkey in most benchmarks. However, emscripten seems to exercise certain corners of JS that pose stability problems for jsc.

Which benchmarks are you looking at? And are they actually JSC vs SpiderMonkey or JSC+WebKit vs SpiderMonkey+Gecko? I.e. are they JS benchmarks or DOM benchmarks?

Re: I ported LaTeX to Javascript

#67
post #53

Something completely off-toppic: I don't like TeX. I use it and i like the output, but I have never realy understood the language and therefore I don't like it. The syntax for optional arguments([]) seems very odd to me, aswell as the separation between mouth and the rest. The support for named parameters is IMO very hacky. Wouldn't be a Tcl based macro processor with the tex-Backend nice? Or is this silly?

Yes, the TeX language is pretty horrible (indeed, the whole concept of TeX is a testament to the strength of cannabis available in the Bay Area in the 70s - it's not a typesetting system, it's two separate programming languages which typeset as a side effect!). LuaTeX is an attempt to remedy this situation by embedding lua in the TeX engine: http://www.luatex.org/

(It's also no coincidence that the development of BibTeX coincides with the crack epidemic, but I digress.)

Re: I ported LaTeX to Javascript

#69
post #62
post #58

EDIT: I managed to find the answer to this question myself. I want to generate a bunch of bytes programmatically, then have the user click on a button, and allow the user to save a file containing the generated bytes. This should run entirely client-side, with no talking to the server (except for static loading of the HTML page, JS files, images, css, etc). I've been wanting to do this since I wrote my first Java app…

data: URIs are deprecated for generating content. Use object URLs and Blobs ( https://developer.mozilla.org/en-US/docs/DOM/Blob ). If you want to force saving the file to a disk use

Although, annoyingly, data: URIs are your only option in Safari (including the latest version), and they also happen to crash the PDF viewer. Safari does have createObjectURL, but then doesn't understand the URL it creates!

Just as annoyingly, IE10 has createObjectURL too, but only allows the created URLs to be used for , and . To save a blob, you have to use something ms-prefixed instead, and this doesn't allow inline PDF viewing.

Re: I ported LaTeX to Javascript

#70

Thanks for your hints! I added a 'Open PDF' button to circumvent popup blockers. Yes, I used emscripten to port it to Javascript. It was not that hard. Emscripten had three bugs I had to fix (the hardest was to find that the %g format was not supported by emscripten's sscanf). But it was compiled almost like for x86: first convert the pdftex 'web' souce code to c using web2c, then compile it to LLVM bytecode and the…

This is awesome. Or witchcraft.

Top, top work. I love it. Now to try with my monster list of packages...

Post reply on HN