Texel
Lightweight PDF-Centric AI LaTeX Editor for VS Code
✨ Why Texel?Reading raw LaTeX text diffs makes it hard to judge how an edit actually looks on the page—especially for equations, layout, and spacing. Texel keeps the whole review loop inside VS Code:
🚀 Quick Start1. Install a Local TeX DistributionMake sure
2. Install Texel (Choose One)
3. Revise a Paper in 4 Steps
🤖 AI Backend SetupOpen VS Code Settings ( Option A:
|
| Provider | texel.apiBaseUrl |
texel.model (examples) |
|---|---|---|
| OpenAI | https://api.openai.com/v1 |
gpt-4o-mini, gpt-4o |
| Google AI Studio (Gemini) | https://generativelanguage.googleapis.com/v1beta/openai |
gemini-3.5-flash-lite, gemini-3.8-flash |
| DeepSeek | https://api.deepseek.com/v1 |
deepseek-chat, deepseek-reasoner |
| Ollama (Local) | http://localhost:11434/v1 |
qwen2.5:14b, llama3.1 |
Option C: cli (Local CLI Agents)
- Set
Texel: Ai Providertocli. - Set
Texel: Cli Commandto a local command that reads a prompt from stdin (for exampleclaude -por another local CLI tool).
🧠 Built-in & Custom Workspace Skills
6 Built-in Skills
Select regions on the PDF and click a skill button (you can also combine it with extra text in the instruction box):
| Skill | Best For | What It Does |
|---|---|---|
| Grammar | Copy-editing | Fixes grammar, spelling, punctuation, articles, and minor LaTeX syntax errors without rephrasing clean sentences |
| Clarity | Readability | Rewrites convoluted sentences into clear academic English while preserving meaning, terminology, and math |
| Tighten | Cutting length | Removes redundancy and filler (~25% shorter) without dropping results, equations, or citations |
| Notation | Math & consistency | Checks signs, indices, dimensions, and symbol/term consistency across the selected regions |
| Address Comment | Rebuttals & co-authors | Paste a reviewer/co-author comment in the instruction box; revises minimally and summarizes the response |
| Build Warnings | Compiler diagnostics | Automatically attaches warnings from the last compile (overfull boxes, undefined refs) and fixes them minimally |
Custom Workspace Skills (.texel/skills/*.md)
Add project-specific skills by creating Markdown files in <workspace>/.texel/skills/*.md. The filename becomes the skill ID, a leading # Title becomes the button label, and the body becomes the prompt (using a built-in ID overrides that built-in skill):
# Abstract Check
Keep this abstract under 150 words while keeping the problem statement, method, and quantitative results intact.
Save as .texel/skills/abstract-check.md, then click Compile PDF or reopen the panel to load it.
⚙️ Commands & Settings Reference
| Kind | Name | Description |
|---|---|---|
| Command | Texel: Compile LaTeX & Open PDF Workspace |
Compile the active .tex file and open the PDF workspace |
| Command | Texel: Open PDF Annotator & AI Workspace |
Open an existing PDF (compiles if missing) |
| Command | Texel: Set API Key (Secure Storage) |
Store or remove your API key in VS Code SecretStorage |
| Setting | texel.language |
Interface language: auto (default, follows VS Code), en, or zh-CN (also switchable live from the PDF toolbar) |
| Setting | texel.aiProvider |
AI backend: vscode-lm (default), openai-compatible, or cli |
| Setting | texel.apiBaseUrl |
Base URL for OpenAI-compatible APIs (User/Machine scope only) |
| Setting | texel.model |
Model name or preferred vscode-lm family hint |
| Setting | texel.cliCommand |
Local CLI command (default claude -p, User/Machine scope only) |
| Setting | texel.texBinPath |
Directory containing TeX binaries (default /Library/TeX/texbin, User/Machine scope only) |
🔒 Security & Workspace Trust
Because LaTeX repositories can include executable latexmkrc files or workspace configs, Texel enforces three boundaries by default:
- Machine-scoped sensitive settings:
texel.apiBaseUrl,texel.cliCommand, andtexel.texBinPathuse"scope": "machine", so a repository's.vscode/settings.jsoncannot hijack local commands, TeX binaries, or API endpoints. - Untrusted Workspace protection: In Restricted Mode, Texel only displays an existing PDF. Compiling LaTeX, running AI revisions, and loading custom prompts from
.texel/skills/*.mdall require a trusted workspace. - Nonce-based Webview CSP: Inline scripts are disallowed; all webview scripts load with a per-panel cryptographic nonce.
📂 Project Structure
Texel/
├── src/
│ ├── extension.ts # Extension entry, webview panel lifecycle, commands & trust checks
│ ├── ai.ts # Built-in/workspace skills, prompt building, response parsing & providers
│ ├── compiler.ts # latexmk compilation, symlink temp workspace, latexdiff & safe edits
│ ├── synctex.ts # SyncTeX mapping, LaTeX environment expansion & text-selection matching
│ ├── i18n.ts # English / Simplified Chinese UI strings & locale resolution
│ ├── protocol.ts # Typed discriminated-union messages between extension and webview
│ └── test/
│ ├── unit.test.ts # Pure-function unit tests (no TeX required)
│ └── integration.test.ts # End-to-end latexmk + synctex + latexdiff integration test
├── media/
│ ├── icon.png # 512×512 extension icon (vector source in icon.svg)
│ ├── texel-action-*.svg # Adaptive light/dark editor title bar icons
│ ├── webview.js # PDF rendering, Box/Text annotation tools, review UI & state
│ └── webview.css # Webview theme styles and pdf.js text layer rules
├── examples/
│ └── sample.tex # Demo paper for F5 debugging and integration tests
├── .github/workflows/
│ ├── ci.yml # Automated unit & integration tests on main pushes / PRs
│ └── release.yml # Tag-triggered tests, VSIX packaging & release publishing
├── THIRD-PARTY-NOTICES.md # License notice for bundled pdf.js files
└── package.json # Extension manifest, commands & configuration schema
❓ FAQ & Known Limitations
1. Compilation fails because latexmk, synctex, or latexdiff is not found
- macOS: Install MacTeX and verify
/Library/TeX/texbinexists. - Windows / Linux:
texel.texBinPathdefaults to the macOS path. Ensure your TeXbindirectory is onPATH, or settexel.texBinPathin User Settings.
2. Annotations report SyncTeX could not map page ...
- Make sure a matching
.synctex.gzfile exists next to the PDF (compiled with-synctex=1). ClickingCompile PDFin Texel compiles with-synctex=1automatically.
3. No VS Code Language Model found
- The default
vscode-lmprovider requires a signed-in VS Code Language Model provider (such as GitHub Copilot). Otherwise switchtexel.aiProvidertoopenai-compatibleorclias shown above.
4. Why does Typeset Diff sometimes show Updated PDF instead of red/blue diff markup?
- On unusual custom macros or complex tables,
latexdiffoutput can fail to compile. Texel automatically falls back to showing the clean updated PDF so your workflow isn't blocked; you can still inspect exact source edits viaView .tex Diff.
5. Known Limitations (v0.1.0)
- When a single revision modifies multiple
.texfiles, the typeset PDF diff currently previews the first edited file (other files still supportView .tex Diffand apply normally). - Applying accepted edits updates each modified file as a single document replace, so Undo (
Cmd+Z/Ctrl+Z) reverts the batch in one step.
🧪 Development & Testing
npm install
npm test # Type check + unit tests (no TeX needed)
npm run test:integration # Integration test (needs latexmk, synctex, latexdiff)
npx @vscode/vsce package # Build a local .vsix package
Open this repository in VS Code and press F5 to launch an Extension Development Host window.
📈 Star History
📄 License
Released under the MIT License. Third-party license notices for bundled pdf.js files are in THIRD-PARTY-NOTICES.md.