Compile LaTeX in a container

Compile a rendered paper’s main.tex with latexmk inside a TeX Live (full) image, for a host with Docker but no TeX engine. The image carries TeX Live, latexmk, Pandoc, latexdiff, graphviz and poppler-utils; it does not run the content pipeline, which renders the chapters on the host first.

Skills it satisfies

A skill states the capability; this Tool is one way to exercise it. Each skill’s declared input and output contract follows, where it has one.

latex-build-cache

LaTeX build performance. What works is the iterative loop: a static preflight with no TeX, Tool tex-install for an engine, Tool paper-feature-build for quick changed-chapter builds with latexdiff, then the full build. Both standard preamble/diagram caching mechanisms failed on this toolchain, so there is no cache; read the negative results before attempting one.

Source: folio-assistant-sci/skills/content/folio-paper-adapter/latex-build-cache.md.

Also satisfied by: paper-feature-build, tex-install.

The skill declares no I/O contract (schemas/skills/latex-build-cache/{input,output}.schema.json).

Inputs and outputs

Each port names a shared type by IRI, so two Tools for one skill can be checked for interchangeability.

porttyperequireddescriptionconstraint
inmainTexRepoPathyesThe rendered paper’s top-level .tex, relative to the checkout.string · pattern ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ · A path relative to the repository root. No .. segments.
outpdfRepoPathThe compiled PDF beside the input.string · pattern ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ · A path relative to the repository root. No .. segments.

Processes and tasks

No process step names a skill this Tool satisfies.

How it is deployed and reached

  • Container. docker run --rm -v .:/workspace -w /workspace folio-latex latexmk -pdf -interaction=nonstopmode.
  • GitHub Actions. No workflow in this checkout runs its command.

As an API: its operation in the OpenAPI document and the MCP tool list of its layer.

installcontainer: docker build -t folio-latex -f folio-assistant-sci/scripts/docker-latex-build/Dockerfile folio-assistant-sci/scripts/docker-latex-build
runtimedocker
networkyes

When a host it reaches is refused:

host / errorremedy
archive.ubuntu.comnone: The image build installs texlive-full from apt; with the archive refused there is no image. tex-install needs the same host.
when to choose it
whenA step needs a compiled PDF, pdflatex is not on PATH, and Docker is available — the container alternative to tex-install.
limitsNeeds Docker. The first build pulls ubuntu:24.04 and texlive-full (several GB); later runs reuse the image.
costOne image build (10-20 minutes, once), then one latexmk compile per run.

What it is made of

Linked data

The Tool is published as its own JSON-LD document at its IRI, https://litlfred.github.io/folio-assistant/folio-assistant-sci/tools/latex-image.jsonld, partOf its layer’s document. The node below is the definition this page was drawn from, and is embedded in the page as application/ld+json.

{
  "@context": "https://litlfred.github.io/folio-assistant/folio-assistant-sci/folio-assistant-sci.context.jsonld",
  "@id": "https://litlfred.github.io/folio-assistant/folio-assistant-sci/tools/latex-image.jsonld",
  "@type": "https://litlfred.github.io/cat-harness/v0/ns/Tool",
  "partOf": "https://litlfred.github.io/folio-assistant/folio-assistant-sci/folio-assistant-sci.jsonld",
  "name": "latex-image",
  "title": "Compile LaTeX in a container",
  "description": "Compile a rendered paper's `main.tex` with latexmk inside a TeX Live (full) image, for a host with Docker but no TeX engine. The image carries TeX Live, latexmk, Pandoc, latexdiff, graphviz and poppler-utils; it does not run the content pipeline, which renders the chapters on the host first.",
  "install": {
    "container": "docker build -t folio-latex -f folio-assistant-sci/scripts/docker-latex-build/Dockerfile folio-assistant-sci/scripts/docker-latex-build"
  },
  "invoke": {
    "container": "docker run --rm -v .:/workspace -w /workspace folio-latex latexmk -pdf -interaction=nonstopmode"
  },
  "io": {
    "inputs": [
      {
        "name": "mainTex",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/RepoPath",
        "description": "The rendered paper's top-level `.tex`, relative to the checkout.",
        "required": true,
        "arg": {
          "positional": 0
        }
      }
    ],
    "outputs": [
      {
        "name": "pdf",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/RepoPath",
        "description": "The compiled PDF beside the input."
      }
    ]
  },
  "satisfies": [
    "latex-build-cache"
  ],
  "requirements": {
    "runtime": [
      "docker"
    ],
    "network": true
  },
  "remedies": [
    {
      "host": "archive.ubuntu.com",
      "none": "The image build installs texlive-full from apt; with the archive refused there is no image. `tex-install` needs the same host."
    }
  ],
  "selection": {
    "when": "A step needs a compiled PDF, `pdflatex` is not on PATH, and Docker is available — the container alternative to `tex-install`.",
    "limits": "Needs Docker. The first build pulls ubuntu:24.04 and texlive-full (several GB); later runs reuse the image.",
    "cost": "One image build (10-20 minutes, once), then one latexmk compile per run."
  }
}

folio-assistant — code under the Apache License 2.0, documentation under CC BY 3.0. Generated schema and API references are rebuilt from source on every push to main.

deployed dev