C9, LaTeX, Node, and Emscripten


#1

Hello!

I’m attempting to create a NPM package that would allow the following workflow:

  • Create JSON data structure; create output stream
  • Pass data and stream to the installed NPM package.
  • The package converts the data structure to a valid TeX string/stream
  • The TeX string/stream is parsed by a LaTeX engine (included as part of the NPM package), with the output put on the output stream.

The first three parts of this are entirely do-able with relatively simple Node (optionally with templating for the third part). The last part is where I’m having the issue, due to unfamiliarity with the LaTeX infrastructure.

For the sake of clarity, my requirements do not necessarily include Node-only - I’d be happy with a Node-only solution, but one that works in the browser would be a small plus.

My own research has led me to a few useful-looking packages.

My issue with the first is that it requires pdflatex to be available and offers no automatic way of including it as part of installation. Ideally I would be able to npm install myNpmPackage and, as per normal NPM packages, any dependencies would come with it. node-latex does not seem to offer this, so while I could probably get it working it becomes more of a pain. I’ve not looked into it much for that reason.

The other two seem much more suitable for my needs, with texlive.js seeming particularly interesting but my complete unfamiliarity with Emscripten (particularly usage within C9 and NPM packages) is causing me to question whether it’s right for my use-case.

I’m fairly uncertain as to how Emscripten fits in here in the context of NPM packages - would it add other requirements to the installation environment outside of having to do npm install myNpmPackage?

Does anyone have any experience with any of the libraries above in the context of NPM packages (and developing them on C9)? Is there perhaps another library/NPM package that I haven’t considered that would be right for my needs? This is all stuff I can research myself, I’m just looking to tap into the vast pool of knowledge and experience here so that I can get going on the real meat of my project faster.

Any pointers regarding JSON -> PDF and/or using Emscripten in NPM packages (and any caveats involved in developing them on C9) much appreciated.