This repository defines a ready-to-use LaTeX toolchain that runs inside a VS Code dev container. It bundles the standard LaTeX packages (via TeX Live), latexmk, biber, and a curated set of VS Code extensions so you can focus on writing while the container keeps your host system clean.
Dockerfilebased ondebian:stable-slimwithlatexmk,texlive-*collections,biber,make, and friends..devcontainer/devcontainer.jsonthat builds the image, mounts the workspace at/workspace, runslatexmk -vafter creation, and installs editor extensions: LaTeX Workshop, LaTeX formatter, spell checker, etc.- A convenience
Makefilefor runninglatexmkcommands from your host or inside the container.
- Docker running on your machine.
- VS Code with the Dev Containers extension (optional but recommended).
- Open the repository folder in VS Code.
- When prompted, choose Reopen in Container (or run the Dev Containers: Reopen in Container command).
- The dev container image is built from the provided
Dockerfile. After the container starts,latexmk -vruns automatically as a sanity check, and the configured extensions/settings load. - Create or open a
.texfile and hit save—LaTeX Workshop is configured to calllatexmkon save, and the PDF preview opens in a tab.
If you prefer the terminal, build the image and run commands directly:
docker build -t latex-env .
docker run --rm -v "$(pwd)":/workspace -w /workspace latex-env -pdf main.texReplace main.tex with your entry document. The LATEXMKOPTS environment variable (defined in the dev container) defaults to -pdf -interaction=nonstopmode -file-line-error -synctex=1—pass additional flags after the filename if needed.
The included Makefile wraps common workflows. Variables:
MAIN(default:main.tex) – entry document.LATEXMKFLAGS(default mirrorsLATEXMKOPTS).IMAGE(default:latex-env) – Docker tag when using containerized builds.
Targets:
make build # latexmk one-shot build -> PDF
make watch # latexmk -pvc for continuous builds
make clean # remove latexmk aux artifacts
make docker-build # docker build -t $(IMAGE) .
make docker-run # run latexmk inside the built containerWhen latexmk is available on your host, these targets call it directly. Otherwise make falls back to running the prebuilt Docker image (building it first if missing), so make build just works as long as Docker is running.
Override variables inline, e.g. make MAIN=thesis.tex watch.
- Add or remove TeX Live collections in
Dockerfileto fit your document needs. - Tweak
LATEXMKOPTS/LATEXMKFLAGSfor different engines (XeLaTeX, LuaLaTeX, etc.). - Extend the
devcontainer.jsonwith additional VS Code extensions orpostCreateCommandsteps (running tests, fetching templates, etc.).
Happy typesetting!