Skip to content
manuels edited this page Jan 4, 2014 · 18 revisions

Welcome to the texlive.js wiki!

FAQ

Adding custom files/images

If you want to add a file (for example an image) to your latex document, you can add these files to the virtual filesystem of the latex compiler. Note that this filesystem is always UNIX-like, even if the browser runs on Windows. So use slashes (/) instead of backslashes (). Adding files can be achieved by using the wrappers for emscripten's Filesystem API

For example, the latex command

\includegraphics{/images/my_kitten}

will try to include an image file named mykitten.jpg in the directory /images. This file must be mapped to an URL. Say, the compiler should automatically download the image /images/mykitten.jpg from the URL http://www.kittens.net/cute_kitten2312.jpg. Then you must call these commands before invoking pdftex.compile():

pdftex.FS_createPath('/', 'images', /*canRead=*/true, /*canWrite=*/true);
pdftex.FS_createLazyFile('/images', 'mykitten.jpg', 'http://www.kittens.net/cute_kitten2312.jpg', /*canRead=*/true, /*canWrite=*/true);

Note that the same-origin policy applies.

The state of the virtual filesystem is only saved in memory and will be reset for each PDFTeX instance (and after the page is reloaded, of course).

What are these binary files?

The latex compiler PDFTeX is written using WEB. When compiling PDFTeX the Makefile will require these binary programs (ctangle, ctangleboot, fixwrites, splitup, tangle, tangleboot, tie and web2c) to convert the WEB code to C. Since we are generating javascript instead binaries, we need these binary copies of these tools.

Clone this wiki locally