A minimal, browser-based LaTeX authoring tool with real PDF compilation and a Claude AI co-author.
TeXPad is a self-hosted, AI-first slice of Overleaf. Write LaTeX in the browser, watch a real PDF render in the preview pane, and ask Claude to draft or revise sections via the chat sidebar — Claude can also search the web to ground its writing in real facts before editing your document.
| Feature | Description |
|---|---|
| Real LaTeX compilation | Server-side Tectonic compiles .tex → PDF on every edit (debounced). No WASM, no quirky JS subsets — real publisher-quality output. |
| AI chat sidebar | Type "Write an introduction on quantum tunneling" and Claude edits your document in place via three in-process tools (get_document, replace_range, replace_document). |
| Web research | Claude's built-in WebSearch tool grounds claims in real sources before writing. |
| Templates | One-click NeurIPS, IEEE, Physical Review Letters / D, arXiv, and blank starters. |
| Claude subscription auth | Uses the local claude CLI — no API key, just your Claude.ai Pro / Max session. |
| Open any local file | Uploaded files become reusable user templates. |
| Save / Export | Cmd/Ctrl+S writes .tex to disk; one click downloads the compiled PDF. |
| Undo AI edits | Every assistant edit is reversible from the chat panel. |
| Dark / light theme | Minimalist UI, dark by default. |
| Category | Tools |
|---|---|
| Frontend | Vanilla JS (ES modules), HTML5, CSS custom properties, browser-native <iframe> PDF viewer |
| Backend | Node.js 18+, Fastify, @fastify/static |
| LaTeX engine | Tectonic (Rust, auto-fetches packages on demand) |
| AI | @anthropic-ai/claude-agent-sdk with custom MCP tools, Claude WebSearch |
| Auth | Claude Code CLI (subscription OAuth) — no API key required |
┌──────────────────────── Browser ────────────────────────┐
│ │
│ Editor ──┐ ┌─── PDF iframe ───┐ Chat panel │
│ <textarea>│ │ (browser PDF) │ (SSE) │
│ │ └──────────────────┘ │
└─────────────┼─────────────────────────────┬─────────────┘
│ POST /api/compile │ POST /api/chat (SSE)
▼ ▼
┌──────────── Node.js · Fastify ─────────────────────────┐
│ │
│ compile.mjs ──spawn──▶ tectonic ──main.pdf──┐ │
│ │ │
│ chat.mjs ───query()──▶ Claude Agent SDK │ │
│ │ │ │ │
│ │ MCP tools: │ WebSearch │ │
│ │ get_document │ (Anthropic) │ │
│ │ replace_range │ │ │
│ │ replace_document│ │ │
└───────┼───────────────────────┼───────────────┼────────┘
│ │ │
▼ ▼ ▼
In-process doc state claude CLI PDF bytes
(per chat session) (subscription)
texpad/
├── server/
│ ├── index.mjs # Fastify app + routes
│ ├── compile.mjs # Spawns Tectonic, returns PDF
│ └── chat.mjs # Claude Agent SDK + 3 doc tools
├── public/
│ ├── index.html # Single-page UI
│ ├── app.js # Editor, PDF preview, chat client
│ ├── styles.css # Minimalist theme tokens
│ └── templates.js # Built-in LaTeX templates
├── package.json
├── .env.example
└── README.md
- Node.js 18+
- Tectonic —
brew install tectonic(macOS) · other platforms - Claude Code CLI —
npm install -g @anthropic-ai/claude-codethen runclaude /loginto authenticate with your Claude.ai subscription
git clone https://github.com/alfredang/texpad.git
cd texpad
npm install
npm run devOpen http://localhost:3030.
- Click cfg (top right) → Test connection to verify Claude auth.
- Pick a template from the dropdown.
- In the AI panel: "Add a Methods section with the equation for self-attention from the Transformer paper."
| Method | Path | Description |
|---|---|---|
| GET | /healthz |
Sanity check + Tectonic version |
| POST | /api/compile |
Body {source} → PDF bytes or {ok:false, log} |
| POST | /api/test-claude |
Verify Claude Code subscription auth |
| POST | /api/chat |
SSE stream of text/tool/edit events |
TeXPad needs a real Linux host (Fly.io, Railway, a VPS, your laptop) because:
- Tectonic is a system binary, not a JS package — not available in Vercel functions.
- Claude Agent SDK spawns the
claudeCLI subprocess, which can't run in serverless. - Subscription OAuth tokens (
sk-ant-oat01-…) only work via the localclaudeCLI.
If you want a hosted demo, the right move is a Dockerfile on Fly.io / Railway with a regular sk-ant-api03-… API key in env. Run locally otherwise.
- Fork the repo
- Create a feature branch:
git checkout -b feature/amazing-thing - Commit:
git commit -m "feat: add amazing thing" - Push:
git push origin feature/amazing-thing - Open a Pull Request
Tertiary Infotech Academy Pte. Ltd.
- Tectonic — modernised, self-contained LaTeX engine
- Anthropic — Claude Agent SDK and
WebSearchtool - Fastify — fast Node.js web framework
If you find TeXPad useful, please ⭐ star the repository.
