Claude Code-style terminal chat app for LaTeX papers
Project description
Claude Code, but for LaTeX academic papers
Installation · Quick Start · Commands · Configuration · Guide
The Problem
Every conference deadline, the same painful ritual repeats. Your figure overflows the margin at width=1.4\columnwidth. You used bare \cite{} instead of \citep{} — 47 times. Three TODO markers are still in the paper. The bibliography has a hallucinated reference your co-author added from ChatGPT. You forgot to anonymize the acknowledgments section. And it's 2 AM.
You've spent more time fighting LaTeX formatting than writing the actual research.
The Solution
TexGuardian is an interactive CLI that reads your entire paper, understands venue requirements, and fixes every issue through reviewable diff patches — so you never lose work.
One command audits your entire paper:
texguardian chat
>>> /review full
It runs a 7-step pipeline: compile → verify → fix → validate citations → analyze figures → analyze tables → visual polish. Every edit is shown as a unified diff you approve before it touches your files. Automatic checkpoints mean you can always roll back.
Think of it as Claude Code, but for LaTeX.
Highlights
- 26 slash commands covering every stage of paper preparation
- LLM-powered fixes — figures, tables, citations, sections, anonymization, camera-ready
- Real citation validation — checks your
.bibagainst CrossRef and Semantic Scholar, catches hallucinated and outdated references - Visual polish loop — renders your PDF to images, sends pages to a vision model, catches overlapping figures and spacing issues text analysis misses
- Unified diff patches — every edit is reviewable, with checkpoints and instant rollback
- Natural language — ask for anything in plain English, or use slash commands
- 14 venue templates — NeurIPS, ICML, ICLR, AAAI, CVPR, ACL, ECCV, and more
- Two LLM providers — AWS Bedrock or OpenRouter, switch with one command
Installation
From PyPI (recommended)
pip install texguardian
From source
git clone https://github.com/arcAman07/TexGuardian.git
cd TexGuardian
pip install -e ".[dev]"
External tools
TexGuardian needs LaTeX and Poppler installed on your system for compilation and visual checks:
| Tool | Purpose | Install |
|---|---|---|
| Python 3.11+ | Runtime | python.org |
| LaTeX (latexmk) | Compilation | See below |
| Poppler | PDF rendering for visual checks | brew install poppler (macOS) / apt install poppler-utils (Ubuntu) |
LaTeX installation
Option A: TinyTeX (~250 MB) — recommended:
# macOS / Linux
curl -sL "https://yihui.org/tinytex/install-bin-unix.sh" | sh
# Add to PATH (add to your ~/.zshrc or ~/.bashrc):
export PATH="$HOME/Library/TinyTeX/bin/universal-darwin:$PATH" # macOS
export PATH="$HOME/.TinyTeX/bin/x86_64-linux:$PATH" # Linux
# Install common academic packages:
tlmgr install booktabs natbib hyperref pgfplots xcolor float geometry \
amsmath amssymb graphicx tikz caption subcaption
TinyTeX is a minimal, portable TeX Live distribution. Missing packages are auto-installed on first compile, or install manually with tlmgr install <pkg>. See yihui.org/tinytex for details.
Option B: Full TeX Live (~4 GB) — includes every package, no missing-package issues:
# macOS
brew install --cask mactex-no-gui
# Ubuntu/Debian
sudo apt install texlive-full
Verify installation
texguardian doctor
TexGuardian Doctor
Checking external tools...
✓ latexmk ~/Library/TinyTeX/bin/universal-darwin/latexmk
✓ pdflatex ~/Library/TinyTeX/bin/universal-darwin/pdflatex
✓ pdfinfo /opt/homebrew/bin/pdfinfo
✓ pdftoppm /opt/homebrew/bin/pdftoppm
All tools found. You're good to go!
Quick Start
1. Initialize your project
cd /path/to/your/latex/paper
texguardian init
This creates three files:
| File | Purpose |
|---|---|
texguardian.yaml |
LLM provider, model, safety limits, LaTeX settings |
paper_spec.md |
Venue, deadline, thresholds, custom checks, system prompt |
.texguardian/ |
Runtime data (checkpoints, history) |
2. Configure credentials
AWS Bedrock (recommended):
# Create a .env file in your project root:
AWS_ACCESS_KEY_ID=your-key
AWS_SECRET_ACCESS_KEY=your-secret
AWS_REGION=us-east-1
OpenRouter:
# In texguardian.yaml:
providers:
default: "openrouter"
openrouter:
api_key: "sk-or-..." # Get from https://openrouter.ai/keys
3. Start chatting
texguardian chat
On startup you'll see a styled welcome panel with paper stats:
╭──────────────────────────────────────────────────────────╮
│ TexGuardian │
│ │
│ Paper Scaling Sparse MoE for Long-Context Doc... │
│ Venue NeurIPS 2026 Deadline 2026-05-15 │
│ Model claude opus 4.5 Provider bedrock │
│ File demo_paper.tex Figures 4 · Tables 3 │
│ │
│ Type /help for commands or ask a question. │
╰──────────────────────────────────────────────────────────╯
❯ _
Then interact with commands or plain English:
❯ /figures fix
Figure Pipeline
Step 1: Verifying Figures
Found 4 figures, 3 issues detected
Step 2: LLM Fix
Analyzing figure issues...
✓ Generated 3 patches:
1. demo_paper.tex (+1/-1) — width=1.3\columnwidth → width=\columnwidth
2. demo_paper.tex (+1/-1) — width=1.8\textwidth → width=\columnwidth
3. demo_paper.tex (+1/-1) — width=2.0\columnwidth → width=\columnwidth
[A]pply all | [R]eview | [N]o: a
✓ Checkpoint created
✓ All patches applied
❯ The tables use \hline — please fix them to use booktabs
Commands
Paper Analysis
| Command | Aliases | Description |
|---|---|---|
/verify |
/v, /check |
Run all verification checks (figures, citations, custom rules) |
/figures [verify|fix] |
/figs, /fig |
Verify and fix all figures |
/tables [verify|fix] |
/tabs, /tab |
Verify and fix all tables |
/citations [verify|fix] |
/cite, /refs |
Verify, validate (CrossRef/S2), and fix citations |
/section <name> [fix] |
/sec |
Deep analysis of a specific section |
/page_count |
/pages, /pc |
Page count with section breakdown and limit check |
/feedback |
— | Comprehensive paper review with scoring |
/suggest_refs |
/suggest_citations |
AI-powered citation recommendations |
Paper Preparation
| Command | Aliases | Description |
|---|---|---|
/anonymize |
/anon, /blind |
Make paper anonymous for double-blind review |
/camera_ready |
/cr, /final |
Convert draft to camera-ready version |
/venue <name> [year] |
/template, /conf |
Download conference LaTeX templates |
/compile |
/c, /build |
Compile LaTeX document with latexmk |
/review |
/full, /pipeline |
Full pipeline: compile -> verify -> fix -> repeat |
/polish_visual |
/pv, /visual |
Visual verification with vision model |
Configuration
| Command | Aliases | Description |
|---|---|---|
/model |
/m |
Show current model configuration |
/model list |
List all available models | |
/model set <name> |
Change the LLM model | |
/model search <query> |
Search for models by name |
File Operations
| Command | Aliases | Description |
|---|---|---|
/read <file> |
/cat |
Display file contents |
/write <file> |
— | Write content to a file |
/grep <pattern> |
/g |
Search for pattern in files |
/search <pattern> |
/find, /ls |
Find files by name |
/bash <cmd> |
/sh, /! |
Run a shell command |
Version Control
| Command | Aliases | Description |
|---|---|---|
/diff |
/d |
Show changes since last checkpoint |
/revert |
/undo, /rollback |
Revert to a previous checkpoint |
/approve |
/apply, /a |
Apply pending patches |
/watch |
/w |
Toggle auto-recompile on file changes |
Other
| Command | Aliases | Description |
|---|---|---|
/help |
/h, /? |
Show all available commands |
/report |
/r |
Generate a comprehensive verification report |
Natural Language
You can also just type in plain English. TexGuardian will understand:
❯ The figure on line 44 has width=1.3\columnwidth which causes overflow. Please fix it.
❯ Please make this paper anonymous for double-blind review
❯ Can you suggest more citations for the related work section?
The /venue and /model commands also accept natural language:
❯ /venue please download the neurips 2026 style files
❯ /model we need to switch to claude sonnet 4 on bedrock
Configuration
texguardian.yaml
project:
main_tex: "main.tex" # Your main .tex file
output_dir: "build" # Output directory for PDF
providers:
default: "bedrock" # "bedrock" or "openrouter"
bedrock:
region: "us-east-1"
# Credentials loaded from .env automatically
openrouter:
api_key: "sk-or-..."
base_url: "https://openrouter.ai/api/v1"
models:
default: "claude opus 4.5" # Main model for analysis and fixes
vision: "claude opus 4.5" # Vision model for visual polish
safety:
max_changed_lines: 50 # Max lines per patch
max_rounds: 10 # Max auto-fix iterations
max_visual_rounds: 5 # Max visual verification loops
allowlist: # Files the LLM can modify
- "*.tex"
- "*.bib"
- "*.sty"
- "*.cls"
denylist: # Files the LLM cannot touch
- ".git/**"
- "*.pdf"
- "build/**"
latex:
compiler: "latexmk" # Build tool
engine: "pdflatex" # TeX engine
shell_escape: false # Enable --shell-escape
timeout: 240 # Compilation timeout (seconds)
visual:
dpi: 150 # PDF render resolution
diff_threshold: 5.0 # Convergence threshold (%)
pixel_threshold: 15 # Per-pixel diff threshold (0-255)
max_pages_to_analyze: 0 # 0 = all pages
paper_spec.md
The paper spec defines venue-specific rules, custom checks, and your system prompt:
---
title: "Your Paper Title"
venue: "NeurIPS 2026"
deadline: "2026-05-15"
thresholds:
max_pages: 9
min_references: 30
max_self_citation_ratio: 0.2
human_review:
- "Changes to abstract"
- "Deletion of more than 10 lines"
---
## Custom Checks
```check
name: citation_format
severity: warning
pattern: "\\cite\\{(?!p|t)"
message: "Use \\citep{} or \\citet{} instead of \\cite{}"
```
```check
name: todo_remaining
severity: error
pattern: "TODO|FIXME|XXX"
message: "Remove TODO/FIXME markers before submission"
```
## System Prompt
```system-prompt
You are an expert academic writing assistant specializing in machine learning.
Use formal academic English. Every claim must be backed by evidence.
```
Environment Variables
| Variable | Default | Description |
|---|---|---|
AWS_ACCESS_KEY_ID |
— | AWS access key for Bedrock |
AWS_SECRET_ACCESS_KEY |
— | AWS secret key for Bedrock |
AWS_REGION |
us-east-1 |
AWS region |
TEXGUARDIAN_MAX_CONTEXT_TOKENS |
100000 |
Max conversation context tokens |
TEXGUARDIAN_SUMMARY_THRESHOLD |
80000 |
Token threshold for auto-compaction |
TEXGUARDIAN_MAX_OUTPUT_TOKENS |
32000 |
Max LLM output tokens |
TEXGUARDIAN_MAX_THINKING_TOKENS |
16000 |
Max thinking/reasoning tokens |
Available Models
AWS Bedrock
| Friendly Name | Model ID |
|---|---|
claude opus 4.5 |
us.anthropic.claude-opus-4-5-20251101-v1:0 |
claude opus 4 |
us.anthropic.claude-opus-4-20250514-v1:0 |
claude sonnet 4 |
us.anthropic.claude-sonnet-4-20250514-v1:0 |
claude-3.7-sonnet |
us.anthropic.claude-3-7-sonnet-20250219-v1:0 |
OpenRouter
| Friendly Name | Model ID |
|---|---|
claude opus 4.5 |
anthropic/claude-opus-4.5 |
claude opus 4 |
anthropic/claude-opus-4 |
claude sonnet 4 |
anthropic/claude-sonnet-4 |
gpt-4o |
openai/gpt-4o |
Plus any model from openrouter.ai/models.
Development
# Run tests
pytest tests/ -v
# Run tests with coverage
pytest tests/ --cov=texguardian --cov-report=term-missing
# Lint
ruff check src/
# Type check
mypy src/texguardian
See docs/GUIDE.md for the full architecture and project layout.
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
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 texguardian-0.3.5.tar.gz.
File metadata
- Download URL: texguardian-0.3.5.tar.gz
- Upload date:
- Size: 665.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b67c5b6d6bc291d331721a49fbf99b4608ad59f67e29c5dd17f61a37f103ae1
|
|
| MD5 |
79978c24b03a011c21f77bdd3f50a84e
|
|
| BLAKE2b-256 |
b3bdabee3f40df9d70c6f8ca32bfd2ceaa3042cf6bd17ace72dc0034ed81730a
|
File details
Details for the file texguardian-0.3.5-py3-none-any.whl.
File metadata
- Download URL: texguardian-0.3.5-py3-none-any.whl
- Upload date:
- Size: 180.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6360023ed9c732c16500a71beb9657bf88835b70178ffec23156af4343d899b7
|
|
| MD5 |
287df503077bec21645b38113f6d8ad8
|
|
| BLAKE2b-256 |
0845eb3f752200e9b6f762d919fc72b7f0d67ea2b7023d2582e32b60b3a8ff6e
|