Skip to main content

LaTeX-to-PDF CLI with browser live preview — no local LaTeX install needed

Project description

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.

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

nantex-0.1.5.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nantex-0.1.5-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file nantex-0.1.5.tar.gz.

File metadata

  • Download URL: nantex-0.1.5.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

Hashes for nantex-0.1.5.tar.gz
Algorithm Hash digest
SHA256 7b4d4d5de5ac7992b5987b2f704e1e21afe7388443e12dfad4b642b45ed2c3a3
MD5 824ae8fee7089d007bba469d6173fce6
BLAKE2b-256 ece65ebb3fb582c2703ec3446a3c7dfa7cc8ed099f87c64088e5a082ef712464

See more details on using hashes here.

File details

Details for the file nantex-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: nantex-0.1.5-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

Hashes for nantex-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 07ec4844e671ccf28118c90a270f0dc9f1d4e765731224d2e729b1e1bd641afc
MD5 89ae4c905d35a44f6cffa4aacfee3338
BLAKE2b-256 1d1d8cc1757ec127d86b6272fbad4f2b93a9463a3c669e910ebd4b2ffc12e512

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page