LaTeX-to-PDF CLI with browser live preview — no local LaTeX install needed
Project description
nantex
LaTeX-to-PDF live preview in your browser — no local LaTeX install needed.
Write .tex, save, see the result. That's it.
How it works
nantex watches your .tex file, compiles it via the latex-on-http public API, and serves the PDF through a local HTTP server with automatic browser refresh via Server-Sent Events. No Overleaf switching. No Skim install. Just your editor and a browser.
Install
# via uv (recommended)
uv tool install nantex
# zero-install run
uvx nantex main.tex
# via pip
pip install nantex
Usage
nantex main.tex # watch mode, opens http://localhost:7474
nantex main.tex --once # compile once and exit
nantex main.tex --port 8080 # custom port
nantex main.tex --compiler xelatex # use xelatex instead of pdflatex
nantex main.tex --output ~/out.pdf # custom output path
nantex main.tex --api https://... # self-hosted latex-on-http instance
nantex main.tex --share # print LAN URL for collaborators
nantex main.tex --snippet fig:label # preview a single figure or line range
nantex --mcp # run as MCP server for AI agents
Flags
| Flag | Default | Description |
|---|---|---|
--compiler |
pdflatex |
LaTeX compiler: pdflatex, xelatex, lualatex |
--api |
https://latex.ytotech.com/builds/sync |
Compile API endpoint |
--output |
<file>.pdf |
Output PDF path |
--port |
7474 |
Preview server port |
--once |
off | Compile once and exit |
--share |
off | Print local network URL for live collaboration |
--snippet |
off | Compile a label (fig:x) or line range (10-25) in isolation |
--mcp |
off | Run as an MCP server for AI agent integration |
Project config
Add a .nantex.toml in your project directory to persist settings:
compiler = "xelatex"
port = 7475
CLI flags always override the config file.
Multi-file projects
nantex automatically detects \input{} and \include{} directives, watches all discovered files, and bundles them in the API call. No extra configuration needed.
Collaboration
nantex main.tex --share
# Preview: http://localhost:7474
# Share: http://192.168.0.113:7474 ← anyone on your network can open this
MCP server
Run nantex as an MCP server so AI agents (Claude, etc.) can compile LaTeX autonomously:
nantex --mcp
Exposes two tools: compile_latex and get_compile_status.
To wire it into Claude Code, add to .mcp.json:
{
"mcpServers": {
"nantex": {
"command": "uvx",
"args": ["nantex", "--mcp"]
}
}
}
Examples
Ready-to-run examples are in the examples/ folder:
nantex examples/01-hello-world.tex # minimal quickstart
nantex examples/02-math.tex # equations, Maxwell's laws, matrices
nantex examples/03-resume.tex # CV / resume template
nantex examples/04-report.tex # report with table of contents + tables
Privacy
Your .tex file content is sent to the configured API on every compile. For sensitive documents, run a self-hosted latex-on-http instance and point --api at it.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nantex-0.1.4.tar.gz.
File metadata
- Download URL: nantex-0.1.4.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a193724dd1a3be282a4f77caa18697c580e50bd5dabbdc2000bc33370f62cc11
|
|
| MD5 |
14ff64a82fecdd421c2a60f784b45d73
|
|
| BLAKE2b-256 |
69b67132985b8a76d1b2190fa2f64b83bcc9cdce59e3a16e6c0877fe2620e572
|
File details
Details for the file nantex-0.1.4-py3-none-any.whl.
File metadata
- Download URL: nantex-0.1.4-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c2fff458643a112d739d97fc9b5d0bfa488198d644660b223f5ae789ec506a5
|
|
| MD5 |
927fa945b9ef28d6870fda2637bc0286
|
|
| BLAKE2b-256 |
63ddfb2839cf8e71652bbb62c7c50d4eeff921dd5aa4dae6899b345b19137c75
|