tools / doc / latex-to-pdf.sh

doc/latex-to-pdf.sh

docdocuments○ hermeticlatex

Compile a LaTeX document to PDF (full TeX Live, offline, deterministic -- no runtime package fetching). Mounts input TeX file via fragletc file-shaped param (:file) to /input/tex_source.

Use when the user has LaTeX source and wants the compiled PDF.

Run it

1. Once per machine: install fragletc (Docker must already be running).

curl -fsSL https://raw.githubusercontent.com/ofthemachine/fraglet/main/install.sh | sh

2. Fetch the tool and print its contract.

curl -fsSLO https://tools.ofthemachine.com/doc/latex-to-pdf.sh && chmod +x latex-to-pdf.sh && ./latex-to-pdf.sh --fraglet-help

3. Run it.

./latex-to-pdf.sh -p tex_source="<tex_source>" [-p engine=pdflatex] --output paper.pdf

Parameters

nametyperequirementdescription
tex_sourcefilerequiredTeX source mounted at /input/tex_source
enginestringdefault pdflatexTeX engine: pdflatex, xelatex, or lualatex

Outputs

paper.pdf

Provenance

image
ofthemachine/latex@sha256:add4f310e2fb92ebeeb7bc7fa5a95f920fa78adabcc8565301bbb178eac2a0b3
reach
network=none — a run is a pure function of its inputs; results are safe to memoize.
procedure_hash
sha256:622b336d2bfb0c768489d11f83120619576f95d1882a5ce46cbd83a51122c052
receipt
add --receipt run.json to any run; receipt/attest.py verifies it against this hash without re-running.

Source

latex-to-pdf.sh · 16 lines · sha256 622b336d2bfb…
#!/usr/bin/env -S fragletc --image ofthemachine/latex@sha256:add4f310e2fb92ebeeb7bc7fa5a95f920fa78adabcc8565301bbb178eac2a0b3
#: d=Compile a LaTeX document to PDF (full TeX Live, offline, deterministic -- no runtime package fetching). Mounts input TeX file via fragletc file-shaped param (:file) to /input/tex_source.
#: when=Use when the user has LaTeX source and wants the compiled PDF.
#: network=none
#: stdin=none
#: param=tex_source:required:file:d=TeX source mounted at /input/tex_source
#: param=engine:default=pdflatex:description=TeX engine: pdflatex, xelatex, or lualatex
#: output=paper.pdf

case "${ENGINE}" in
  xelatex)  FLAG=-xelatex  ;;
  lualatex) FLAG=-lualatex ;;
  *)        FLAG=-pdf      ;;
esac
latexmk "$FLAG" -interaction=nonstopmode -halt-on-error \
  -jobname=paper -output-directory=/output "$TEX_SOURCE"