Skip to content

corca-ai/fastlatex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

287 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastLaTeX

An embeddable, browser-based LaTeX editor with real-time PDF preview — Monaco editor, an in-browser pdfLaTeX engine (WASM), and PDF.js. Documents that need XeLaTeX or LuaLaTeX (fontspec, unicode-math, CJK, \directlua) are auto-detected; the full multi-engine pipeline runs through the headless compiler on the client or a Node server. TeX Live packages stream from a public CDN, so there's nothing to host.

Live Demo

Quick Start

FastLaTeX is not on npm — install from GitHub. The install ships a prebuilt lib/ bundle, so it works with no build step. monaco-editor and pdfjs-dist are peer dependencies.

npm install monaco-editor pdfjs-dist
npm install github:corca-ai/fastlatex#main
import * as pdfjsLib from 'pdfjs-dist'
import { FastLatex } from 'fastlatex'
import 'fastlatex/style.css'

// Worker setup is REQUIRED — see the Integration Guide for the full block.
self.MonacoEnvironment = { /* monaco workers */ }
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(
  'pdfjs-dist/build/pdf.worker.mjs', import.meta.url,
).toString()

const editor = new FastLatex('#editor', '#preview', {
  files: { 'main.tex': '\\documentclass{article}\\begin{document}Hi!\\end{document}' },
})
await editor.init()

👉 Start here: the Integration Guide has the complete worker setup and copy-pasteable recipes. A minimal example lives in examples/embed.html.

Packages / Entry Points

Import Purpose
fastlatex Full editor + PDF preview SDK.
fastlatex/headless DOM-free compiler (your app owns editor/preview).
fastlatex/node Run the engines under Node (installNodeWorkerHost + FastLatexCompiler).
fastlatex/lsp Monaco-free LaTeX language service core.
fastlatex/lsp/monaco Monaco provider adapter.
fastlatex/lsp/server Transport-agnostic JSON-RPC language server.
fastlatex/style.css Optional built-in UI/viewer styles.

Documentation

Contributing to FastLaTeX itself? See AGENTS.md and docs/develop.md.

Language features

The built-in LaTeX language server (editor-neutral cores in src/lsp/, with a Monaco adapter) provides:

Feature Status
Completion (commands, refs, cites, packages, files)
Hover (commands w/ signature + package, citations)
Go-to-definition / references / rename
Document symbols / outline
Diagnostics + ChkTeX-style linter
Signature help (argument hints)
Folding ranges (environments, sections, % region)
Document highlight (occurrences under cursor)
Workspace symbols (labels/sections/commands) ✅ via fastlatex/lsp service + LSP server (Monaco has no workspace-symbol UI)
Code actions (insert ~, add \usepackage, create \label)
Inlay hints (resolved .aux numbers next to \ref)
Document links (\input/\include, \url/\href)
Semantic tokens (commands, math, comments, verbatim)
Formatting (latexindent-style) ⏳ planned

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors