Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available: 6.12.0
metadata
title: LaTeX Editor
emoji: π
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.12.0
app_file: app.py
pinned: false
license: mit
LaTeX Editor
A real-time LaTeX editor with instant PDF preview, optimized for speed and concurrency.
Features
- Live Preview: See your PDF update as you type (500ms debounce)
- Syntax Highlighting: Full LaTeX syntax highlighting with Dracula theme
- Fast Compilation: ProcessPoolExecutor for parallel compilations
- Caching: LRU cache skips recompilation for identical content
- Resizable Panels: Drag the divider to adjust editor/preview ratio
- Zoom Controls: Zoom in/out on the PDF preview
Local Development
Install TeX Live:
# macOS brew install --cask mactex # Ubuntu/Debian sudo apt-get install texlive-latex-base texlive-latex-recommended texlive-fonts-recommended texlive-latex-extraInstall Python dependencies:
pip install -r requirements.txtRun the server:
python app.py
Deployment on Hugging Face Spaces
The packages.txt file automatically installs TeX Live packages when deployed to HF Spaces.
Architecture
βββββββββββββββββββ WebSocket ββββββββββββββββββββββββ
β Browser βββββββββββββββββββββΊβ FastAPI Server β
β - CodeMirror β β - WebSocket Handler β
β - PDF.js β β - ProcessPoolExec β
βββββββββββββββββββ β - LRU Cache β
ββββββββββββ¬ββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β pdflatex β
β (parallel workers) β
ββββββββββββββββββββββββ
Tech Stack
- Backend: FastAPI + uvicorn
- Frontend: Vanilla JS + CodeMirror 5 + PDF.js
- Compilation: pdflatex (TeX Live)