I acknowledge that PDF typesetting is probably a niche interest in the CS industry world. But in the STEM-related academic world, and especially CS academia, LaTeX is probably the single most widely-used piece of software. CS academics like me like to use Git/GitHub to manage our LaTeX source code, but lack a convenient means to provide easy-to-access pre-built PDFs:
either we git add the compiled PDF each time we make an update & rebuild (requires manually ensuring the source & compiled output are in sync, & generally I prefer to not store generated/compiled output under version control),
or we only include the LaTeX source & require visitors to download & build the PDFs themselves (extra burden on the visitors).
If Netlify were to support a tectonic builder, it would fit our use-case perfectly & quite easily. A sample usage flow may look like this:
Make a GitHub repo containing LaTeX source files,
Make a Netlify project with the build command tectonic <document>.tex & output directory / (project root). When the LaTeX source is modified & pushed, Netlify will build the PDF & host the output on somethingsomething.netlify.app/<document>.pdf.
Link to the PDF URL in the GitHub README.
This is quite analogous to, e.g., a Webpack building flow generating bundled HTML/CSS/JS output from SCSS/TS source, except we are generating downloadable/viewable PDF output from LaTeX source.
Existing solutions
I am not the only one who wishes to use Netlify to build LaTeX files; many others have run into the same need & have come up with various workarounds to doing so:
https://yoursunny.com/t/2017/latex-netlify/ describes a process of setting up scripts to automate building the PDFs locally & deploying them via the Netlify CLI (in order to make this process fully automatic, one could set these scripts to run via some external CI job, e.g. via GitHub Actions).
All of these solutions are sort of suboptimal, as they require writing complex scripts/configurations or invoking an additional CI runner to set up correctly.
Steps
The basic installation of Tectonic is quite straightforward & documented here: install some system libraries (libfontconfig1-dev libgraphite2-dev libharfbuzz-dev libicu-dev libssl-dev zlib1g-dev), then install Tectonic via cargo install tectonic (since Cargo already exists in the build image, this is trivially possible).
In addition to installing Tectonic, one additional thing that would be helpful is to cache downloaded packages (the same way, e.g., npm dependencies are cached between successive builds). Tectonic auto-detects dependencies from the LaTeX source code & downloads them on-demand, removing the need to explicitly specify dependencies in configs/lockfiles; all that would need to be done here is to (1) copy the Tectonic cache from Netlify cache to wherever Tectonic expects it (by default, ~/.cache/Tectonic) before building, then (2) save the new Tectonic cache back into the Netlify cache after building.
Conclusion
I'm starting this discussion to see if enough other people share my wish to build PDFs via Tectonic with Netlify. Personally, I believe that it would be a huge blessing to the academic CS community if Netlify did add support for Tectonic. If others are also interested in this idea, & Netlify maintainers would also be willing to incorporate such a feature, I would be happy to work on a PR & offer my help making this possible.
Proposal
It would be nice if the Netlify build image included Tectonic. Tectonic is a modern, well-behaved implementation of the LaTeX engine, which is universally regarded as the industry standard for typesetting publication-quality PDFs. Here is an example of such a document made with Tectonic, by one of my close friends.
Motivation
I acknowledge that PDF typesetting is probably a niche interest in the CS industry world. But in the STEM-related academic world, and especially CS academia, LaTeX is probably the single most widely-used piece of software. CS academics like me like to use Git/GitHub to manage our LaTeX source code, but lack a convenient means to provide easy-to-access pre-built PDFs:
git add
the compiled PDF each time we make an update & rebuild (requires manually ensuring the source & compiled output are in sync, & generally I prefer to not store generated/compiled output under version control),If Netlify were to support a
tectonic
builder, it would fit our use-case perfectly & quite easily. A sample usage flow may look like this:tectonic <document>.tex
& output directory/
(project root). When the LaTeX source is modified & pushed, Netlify will build the PDF & host the output onsomethingsomething.netlify.app/<document>.pdf
.This is quite analogous to, e.g., a Webpack building flow generating bundled HTML/CSS/JS output from SCSS/TS source, except we are generating downloadable/viewable PDF output from LaTeX source.
Existing solutions
I am not the only one who wishes to use Netlify to build LaTeX files; many others have run into the same need & have come up with various workarounds to doing so:
All of these solutions are sort of suboptimal, as they require writing complex scripts/configurations or invoking an additional CI runner to set up correctly.
Steps
The basic installation of Tectonic is quite straightforward & documented here: install some system libraries (
libfontconfig1-dev libgraphite2-dev libharfbuzz-dev libicu-dev libssl-dev zlib1g-dev
), then install Tectonic viacargo install tectonic
(since Cargo already exists in the build image, this is trivially possible).In addition to installing Tectonic, one additional thing that would be helpful is to cache downloaded packages (the same way, e.g., npm dependencies are cached between successive builds). Tectonic auto-detects dependencies from the LaTeX source code & downloads them on-demand, removing the need to explicitly specify dependencies in configs/lockfiles; all that would need to be done here is to (1) copy the Tectonic cache from Netlify cache to wherever Tectonic expects it (by default,
~/.cache/Tectonic
) before building, then (2) save the new Tectonic cache back into the Netlify cache after building.Conclusion
I'm starting this discussion to see if enough other people share my wish to build PDFs via Tectonic with Netlify. Personally, I believe that it would be a huge blessing to the academic CS community if Netlify did add support for Tectonic. If others are also interested in this idea, & Netlify maintainers would also be willing to incorporate such a feature, I would be happy to work on a PR & offer my help making this possible.