diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0937d..a22aef9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,33 @@ base** rather than reusing `base-6f3b20266de1`. read-only preview, and an on-host `curl` that tells "chain up" (`403`) from "Studio down or on another port" (empty reply). A remote session hit exactly that: Studio was started on `18765` while only `8765` is published. +- **README said PDF export from Studio works out of the box. It does not.** + Since v1.4.0 (`67da05b`) the README's Studio section has said that + `/studio-pdf` and `studio_export_pdf` use `typst`. Since v1.9.1 + (`6353d59`) the image-tags section has also said that "PDF export from + Studio/pandoc works out of the box". That holds for pandoc run directly + (`pandoc doc.md --pdf-engine=typst -o doc.pdf`), but not for Studio. + pi-studio runs pandoc with `$PANDOC_PDF_ENGINE`, falling back to `xelatex`, + and the image has never set that variable (`git log -S PANDOC_PDF_ENGINE` + finds no commit). So `/studio-pdf` and `studio_export_pdf` fail with + `xelatex not found`. That was seen at v1.6.3 and again at v1.11.2. The + README now says so in both places that made the claim, and adds a + "PDF export from Studio needs LaTeX" section with two warnings and a + working recipe: + - **Setting `PANDOC_PDF_ENGINE=typst` makes it worse.** The error message + suggests it, but pi-studio adds its own LaTeX header to the document + (unless the document sets `header-includes`). Under typst, pandoc exits + 0 and prints that header as text above the first heading. Seen in the same PDF through two renderers, MuPDF and + Chromium. + - **`texlive-xetex` alone, which the README offered as the fallback, is + not enough.** The export then still lacks `lmodern.sty`, `ulem.sty` + and the `pzdr` font. Adding `lmodern texlive-plain-generic + texlive-fonts-recommended` makes it work: 37 packages and 491 MB + installed, after `apt-get update`. Measured on v1.11.2 with pi-studio + 0.10.1. The exported page was looked at, not only its exit code. + + The same claim also appears in `AGENTS.md` ("What we DON'T install") and + in comments in `Dockerfile.base`. Neither is changed here. ## v1.11.2 — 2026-10-14 diff --git a/README.md b/README.md index 22a8aee..b422d06 100644 --- a/README.md +++ b/README.md @@ -175,10 +175,12 @@ Currently published: | `joakimp/pi-devbox:latest-studio` | `latest` + [pi-studio](https://github.com/omaclaren/pi-studio) (browser prompt editor, KaTeX/Mermaid preview, tmux-backed literate REPLs) | ~3.25 GB | | `joakimp/pi-devbox:vX.Y.Z-studio` | pinned-version studio equivalent | ~3.25 GB | -Both variants ship **`typst`** as the pandoc PDF engine -(`pandoc --pdf-engine=typst`), a single ~30 MB static binary, so PDF export from -Studio/pandoc works out of the box — no separate `-tex` variant needed. -`texlive-xetex` stays the higher-fidelity fallback (install on demand). +Both variants ship **`typst`**, a single ~30 MB static binary, as a PDF engine +for pandoc, so `pandoc doc.md --pdf-engine=typst -o doc.pdf` works out of the +box (see [Generating a PDF with pandoc + typst](#generating-a-pdf-with-pandoc--typst)). +**pi-studio's PDF export does not use typst.** `/studio-pdf` and +`studio_export_pdf` need a LaTeX engine, which neither variant ships (see +[PDF export from Studio needs LaTeX](#pdf-export-from-studio-needs-latex)). ## Using pi-studio (`-studio` variant) @@ -345,10 +347,43 @@ Assuming the compose file publishes `127.0.0.1:8765:8765` (see method B): > an empty reply means the bridge has nothing behind it, i.e. Studio is down > or on another port. -> PDF export (`/studio-pdf`, `studio_export_pdf`) uses **`typst`**, shipped in -> the base image as the pandoc PDF engine (`pandoc --pdf-engine=typst`). For -> LaTeX-exact output you can install `texlive-xetex` on demand as a heavier -> fallback. HTML export, KaTeX, Mermaid, and all REPL features work regardless. +### PDF export from Studio needs LaTeX + +Studio's PDF export (`/studio-pdf` and the `studio_export_pdf` tool) fails out +of the box: + +```text +pandoc PDF export failed with exit code 47: xelatex not found +``` + +pi-studio runs pandoc with the engine named in `PANDOC_PDF_ENGINE`, and uses +`xelatex` when that is unset. The image ships no LaTeX engine and does not set +`PANDOC_PDF_ENGINE`. HTML export, KaTeX, Mermaid and the REPLs are not +affected. + +**Do not set `PANDOC_PDF_ENGINE=typst`**, even though the error message +suggests setting it. pi-studio adds its own LaTeX header +(`\usepackage{titlesec}`, `\titleformat…`) to the document, and typst does +not understand LaTeX. pandoc exits 0, and the header is printed as text above +your first heading. There is no error, only a wrong PDF. + +There are two ways out: + +- **Run pandoc yourself** (nothing to install): + `pandoc doc.md --pdf-engine=typst -o doc.pdf`. See the next section. +- **Install the LaTeX packages Studio needs.** This adds 37 packages and + about 490 MB, and they are gone when the container is recreated: + + ```bash + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + texlive-xetex lmodern texlive-plain-generic texlive-fonts-recommended + ``` + + `texlive-xetex` on its own is not enough. Studio's export then still lacks + `lmodern.sty`, `ulem.sty` and the `pzdr` font, which come from the other + three packages. The image starts with an empty package index, so run + `apt-get update` first. (Measured on v1.11.2 with pi-studio 0.10.1.) ### Generating a PDF with pandoc + typst