A LaTeX setup which sparks joy

A LaTeX setup can require a lot of packages. I keep them in a Dev Container so they don’t clutter my system.

I use VS Code with its Dev Containers extension and LaTeX Workshop. LaTeX Workshop builds the document and displays the PDF in an editor tab.

To use my setup, create a .devcontainer folder in your project root and add the two files below (devcontainer.json and Dockerfile). Then open the project in VS Code and choose Dev Containers: Reopen in Container from the command palette. Adjust the installed TeX packages to suit your document.

Content of the .devcontainer/devcontainer.json.
{
  "name": "My LaTeX document",
  "build": {
    "dockerfile": "Dockerfile",
    "context": ".."
  },
  "customizations": {
    "vscode": {
      "extensions": [
        "james-yu.latex-workshop",
        "streetsidesoftware.code-spell-checker"
      ],
      "settings": {
        "latex-workshop.latex.autoBuild.run": "onSave",
        "latex-workshop.view.pdf.viewer": "tab",
        "latex-workshop.latex.tools": [
          {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
              "-pdf",
              "-interaction=nonstopmode",
              "-synctex=1",
              "-file-line-error",
              "%DOC%"
            ]
          }
        ],
        "latex-workshop.latex.recipes": [
          {
            "name": "latexmk (pdf)",
            "tools": [
              "latexmk"
            ]
          }
        ],
        "latex-workshop.latex.recipe.default": "first"
      }
    }
  },
  "postCreateCommand": "latexmk --version && biber --version",
  "remoteUser": "vscode"
}
Content of the .devcontainer/Dockerfile.
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04

RUN apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        ripgrep \
        biber \
        chktex \
        latexmk \
        lmodern \
        texlive-extra-utils \
        texlive-bibtex-extra \
        texlive-fonts-recommended \
        texlive-lang-german \
        texlive-latex-base \
        texlive-latex-extra \
        texlive-latex-recommended \
        texlive-pictures \
        texlive-plain-generic \
        texlive-science \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*