CLI reference
The compact reference for the platex binary. For a walkthrough with examples
and watch mode, see CLI & watch mode.
platex <input.tex> [options]Compile a LaTeX file to PDF — locally via system TeX Live or the bundled
Tectonic binary, or remotely via a platex HTTP service. Pass - as the input to
read LaTeX source from stdin.
npx @nandan-varma/platex main.tex # → main.pdf (no TeX install required)Options
Section titled “Options”| Flag | Argument | Default | Description |
|---|---|---|---|
-o, --output |
<path> |
input with .pdf |
Output PDF path (directories are created) |
-e, --engine |
<name> |
pdflatex¹ |
pdflatex | xelatex | lualatex | tectonic |
-p, --passes |
<n> |
auto |
auto | 1 | 2 | 3 |
-b, --bib |
<name> |
bibtex |
bibtex | biber | none |
-f, --file |
<path> |
— | Attach a file or directory (repeatable); directories are walked recursively |
-t, --timeout |
<ms> |
30000 |
Overall wall-clock budget for the whole pipeline |
-s, --service-url |
<url> |
PLATEX_SERVICE_URL |
Compile via a remote platex service |
--api-key |
<key> |
PLATEX_API_KEY |
Bearer token for the remote service |
--retry |
<n> |
0 |
Extra attempts on retryable remote failures |
-w, --watch |
— | off | Recompile whenever the input or attached files change |
--json |
— | off | Print the full CompileResult as JSON (pdf base64-encoded); writes the PDF file only with -o |
-q, --quiet |
— | off | Only print errors |
-h, --help |
— | — | Show help |
-V, --version |
— | — | Print the version |
¹ The engine only affects local system-TeX compiles; remote and bundled compiles are always Tectonic.
File attachment keys
Section titled “File attachment keys”- A single file
-f refs.bibis keyed relative to the input file’s directory. - A directory
-f figures/is walked recursively; each file is keyed relative to that directory. - Files outside the input’s directory tree fall back to their basename.
Pass - to read source from stdin. --watch cannot be combined with stdin
(there’s no file to watch) and exits with a usage error.
cat main.tex | platex - -o main.pdfExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
Success |
1 |
Compile failed (errors printed with file:line locations) |
2 |
Usage or environment error |
Ctrl-C aborts the in-flight compile cleanly — no orphaned TeX processes.
See also
Section titled “See also”CLI & watch modeExamples, watch mode, and JSON output.
API referenceThe CompileOptions these flags map to.