Skip to content
corca-aiPublic

About

WASM TeX engines (pdfLaTeX/XeLaTeX/LuaLaTeX)

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Latest commit

 

History

338 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WasmTex

An embeddable LaTeX SDK with a headless compiler, optional Monaco editor and PDF preview, and editor-neutral language services. The headless compiler runs pdfLaTeX, XeLaTeX and LuaLaTeX in browser workers or on Node. The built-in WasmTex component provides a pdfLaTeX editor and PDF.js preview. TeX Live packages load on demand; engine assets are hosted separately.

Live Demo

Quick Start

Install from GitHub with Node 24+. The package includes a committed lib/ bundle; package managers may also run its prepare build. Pin a commit instead of #main for reproducible installs.

npm install github:corca-ai/wasmtex#main

Download and serve the engine assets under /wasmtex/2025/, then compile in your browser app:

import { WasmTexCompiler } from 'wasmtex/headless'

const compiler = new WasmTexCompiler({
  assetBaseUrl: '/',
  files: {
    'main.tex': String.raw`\documentclass{article}\begin{document}Hello!\end{document}`,
  },
})
try {
  await compiler.init()
  const result = await compiler.compile()
  if (result.success && result.pdf) {
    // Hand these bytes to your PDF renderer or download handler.
    console.log(`Compiled ${result.pdf.byteLength} PDF bytes`)
  } else {
    console.error(result.errors, result.log)
  }
} finally {
  compiler.dispose()
}

For the built-in editor, install monaco-editor and pdfjs-dist, then follow the complete browser setup. For server compilation, use the Node recipe.

Packages / Entry Points

Import Purpose
wasmtex Full editor + PDF preview SDK.
wasmtex/headless DOM-free compiler (your app owns editor/preview).
wasmtex/node Run the engines under Node (installNodeWorkerHost + WasmTexCompiler).
wasmtex/lsp Monaco-free LaTeX language service core.
wasmtex/lsp/monaco Monaco provider adapter.
wasmtex/lsp/server Transport-agnostic JSON-RPC language server.
wasmtex/warmup Dependency-light TeX Live preload and learned-set helpers.
wasmtex/syntax Source-preserving syntax snapshots without Monaco.
wasmtex/synctex SyncTeX parser + PDF↔source mapping, for a custom viewer.
wasmtex/style.css Optional built-in UI/viewer styles.

Documentation

The documentation index also covers engine maintenance, release procedures, licensing and historical evidence.

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 wasmtex/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

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for setup, coding standards, and the PR process, and note the committed-lib/ rebuild rule.

  • 🐛 Bugs / features: open an issue.
  • 🔐 Security: report privately — see SECURITY.md.
  • 🤝 Conduct: participation is governed by our Code of Conduct.
  • 📓 Changes: notable changes are tracked in the Changelog.

License

Original WasmTex code and documentation are licensed under the MIT License. Third-party engines, generated WASM, TeX Live packages and fonts, ICU data, and peer dependencies retain their own licenses; see Third-Party Notices and the included license texts. The MIT SDK may be used in a closed-source product when the separately distributed engine assets satisfy their own terms; see the proprietary integration guide.

About

WASM TeX engines (pdfLaTeX/XeLaTeX/LuaLaTeX)

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages