Skip to content

About

Self-contained LaTeX-to-SVG renderer for JavaScript. Embedded Latin Modern fonts, Markdown and streaming support. Works offline. ~440 KB gzip.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rapier Math

Offline TeX formulas as SVG or structured MathML. Embedded Latin Modern outlines for SVG; font-free native MathML. Synchronous, with no runtime downloads.

Use

npm install rapier-math
import {renderToString} from 'rapier-math';
const svg = renderToString(String.raw`\frac{a}{b}`);

For a browser script, load dist/rapier-math.js and use globalThis.RapierMath. The native ESM entry is dist/index.mjs. For one-file copying or inline-script embedding, use the classic file above. The native ESM entry imports relative src/math/ modules: install/serve the whole package or bundle that import; copying only dist/index.mjs is insufficient. A CDN must retain that graph or bundle it. Formula rendering stays synchronous and offline after its chosen script or module graph has loaded.

The SVG entry and classic script include the font. Use rapier-math/mathml for font-free MathML, rapier-math/combined for one-parse SVG and MathML, or rapier-math/accessible with its stylesheet for host composition. All return synchronously. Type declarations accompany the runtime files.

Develop

The classic script and native entry points live in dist/. Native entries import the editable modules in src/math/ directly, sharing one parser without a duplicate generated renderer. Build tools live in src/tools/. Optional adapters have one source copy in dist/. Examples and documentation each have their own directory. Only the current release is kept in this checkout.

Run node src/tools/build-math.mjs --package . to regenerate the classic and ESM files from source.

License

The renderer and adapters are MIT-licensed. Embedded Latin Modern outlines and metrics are licensed under the GUST Font License. LICENSE contains both complete grants. Component provenance and source hashes travel with the package.

Version 2.6.1. Classic payload: 733943 bytes; gzip (level 9): 418021 bytes.

About

Self-contained LaTeX-to-SVG renderer for JavaScript. Embedded Latin Modern fonts, Markdown and streaming support. Works offline. ~440 KB gzip.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages