How it works¶
This article focuses on the technical side of the interactions between LaTeX Base and LaTeX. However, we’re eager to hear from users about their experiences using the service; please feel free to reach out to us at firstname.lastname@example.org with suggestions or if you’d like to beta test new features.
One unique aspect of LaTeX Base amongst web applications is that it can be used with or without an Internet connection! This is possible thanks to service workers: a recent development in the web platform that allows applications to intercept and cache network requests. That means that you can write your papers on a plane, in the park, or anywhere in between. While LaTeX Base isn’t the first web-based LaTeX editor, it is the only one with this capability.
Our design goal when considering the issue of packages was to make a large number of packages (eventually anything hosted on the CTAN registry) available to users while only ever downloading the packages needed to compile their documents. What we came up with is lazy package loading. Every time you include a new package in a document with LaTeX Base, you’ll download it from our servers. When you use that package in the future it’ll be cached in your browser. For this reason, using packages that a user hasn’t previously used while offline will not work. You can also expect compiling to take slightly longer the very first time you use a package. For the time being, we only support a small number (around 25) of the most commonly used packages, but our roadmap includes extending support to arbitrary hosted packages.
The only way that our implementation of LaTeX differs from a standard compiler is in how we handle external files (like images). We don’t currently give users direct access to the virtual Emscripten filesystem that LaTeX sees when it’s running on https://latexbase.com. Instead, we support calling \includegraphics with an image url that we’ll fetch and preload in Emscripten’s virtual filesystem. When you download your documents, we automatically convert these url identifiers to simple file names and bundle the downloaded images so that no changes are necessary to compile documents elsewhere. Our roadmap also includes allowing users to upload images and other local resources rather than supplying urls.
Web applications are great. They allow users to use software without permanently installing it. The abilities and permissions they’re granted by default are very limited compared to native applications, so they are preferable from a practical security perspective. They’re built on open standards, so they run anywhere and don’t need to be sanctioned by any organization or app store. Using cutting edge tools, LaTeX Base is able to offer many advanced capabilities right in the browser. In this author’s (absolutely biased) opinion, it’s on its way to becoming the best way to write LaTeX documents. In closing, I want to recognize Mozilla, not only for their tremendous standards work that’s made the web the wonderful thing it is today, but also for their work on components that made LaTeX Base possible including Ace, Emscripten, PDF.js, and localforage.