Skip to main content

nantex

PyPI version Python License: MIT

LaTeX-to-PDF live preview in your browser — no local LaTeX install needed.

Write .tex, save, see the result. That's it.

Website: nantex.nandish.online

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 to PDF and exit (no preview)
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
nantex --version                     # print the installed version

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 to PDF and exit; no preview server or browser
--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
--version — Print the installed version and exit

One-shot builds

--once compiles to PDF and exits. It starts no preview server, opens no browser and needs no free port, so it fits scripts, pre-commit hooks and CI:

nantex resume.tex --once --output dist/resume.pdf

It exits 0 when the PDF is written and 1 on a lint error, compile error or missing --snippet target, so a failed build fails the job. --share is ignored with --once.

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(content, compiler, api_url) compiles once and returns success, pdf_path (a temp file), errors and message. It never raises and never starts a preview.
  • get_compile_status() returns the result of the last compile.

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.

Development

uv sync
uv run pytest

Every merge to main publishes a patch release to PyPI (.github/workflows/publish.yml); site-only changes don't.

Website

site/ is the static page at nantex.nandish.online: plain HTML, CSS and JS with no build step. Preview it with uv run python -m http.server -d site 7476. tests/test_site.py fails when a CLI flag, MCP tool or example is missing from the page. .github/workflows/site.yml deploys it on merge and posts a preview URL on pull requests.

License

MIT

Metadata

Release files for nantex 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nantex 0.1.8
File Size Uploaded
nantex-0.1.8.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nantex 0.1.8
File Interpreter ABI Platform
nantex-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 31.9 kB

Release files / nantex-0.1.8.tar.gz

Download URL nantex-0.1.8.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
67f36c498a1d35be711d01cb1f3a8242a22cee1a359ee191c05b1ffec67eb02f
BLAKE2b-256 checksum
How to use checksums
5d14a7a8702b186ffd2a13c354a3dc26151372e8240a8e98466f2b060273c296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}

Release files / nantex-0.1.8-py3-none-any.whl

Download URL nantex-0.1.8-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11b61c025486e1a06f18dd8dcf9af3afd10164ea1095cfb13dda92adc1369d80
BLAKE2b-256 checksum
How to use checksums
46c0968c5447ec94c0ffe8c948574915e7952fcc88dcdaa8056ed00686fed3b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}

Release history Release notifications | RSS feed

0.1.9

2 release files

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page