LaTeX to SVG
Render LaTeX, MathML or AsciiMath to SVG, PNG and MathML with speech alt text, offline with MathJax.
Install
irm https://raw.githubusercontent.com/chayprabs/localtools/main/latex-to-svg/install.ps1 | iexlocaltools-latex-to-svg updatelocaltools-latex-to-svg uninstall
curl -fsSL https://raw.githubusercontent.com/chayprabs/localtools/main/latex-to-svg/install.sh | bashlocaltools-latex-to-svg updatelocaltools-latex-to-svg uninstall
brew install chayprabs/localtools/localtools-latex-to-svgbrew upgrade localtools-latex-to-svgbrew uninstall localtools-latex-to-svg
scoop bucket add localtools https://github.com/chayprabs/homebrew-localtools; scoop install localtools-latex-to-svgscoop update localtools-latex-to-svgscoop uninstall localtools-latex-to-svg
winget install localtools.LatexToSvgwinget upgrade localtools.LatexToSvgwinget uninstall localtools.LatexToSvg
npm i -g localtools-latex-to-svgnpm i -g localtools-latex-to-svg@latestnpm rm -g localtools-latex-to-svg
Opens at http://127.0.0.1:47133 in your browser. Run localtools-latex-to-svg --help for the command line. Set LOCALTOOLS_NO_OPEN=1 to install without opening it.
Direct download
| Platform | File | Size |
|---|---|---|
| Windows x64 | latex-to-svg-1.0.3-windows-x64.zip | 48.7 MB |
| macOS Apple Silicon | latex-to-svg-1.0.3-macos-arm64.zip | 35.8 MB |
| macOS Intel | latex-to-svg-1.0.3-macos-x64.zip | 37.4 MB |
| Linux x64 | latex-to-svg-1.0.3-linux-x64.zip | 46.0 MB |
| Linux ARM64 | latex-to-svg-1.0.3-linux-arm64.zip | 46.3 MB |
SHA-256 checksums are in the release notes; the install scripts verify them for you.
See it
How to use
- Run localtools-latex-to-svg; the page opens at http://127.0.0.1:47133.
- Type TeX, MathML or AsciiMath; preview and copy SVG/MathML/data URI/an <img> tag, or download SVG and PNG.
- Choose display or inline style, colour and PNG scale. Tagged equations are refused: remove \tag or use align*/equation*.
- Drop a .tex/.md/.txt file in Batch, or run localtools-latex-to-svg batch paper.tex -o out/ for images and manifest.json; balanced multiline document macros are supported.
- Long formulas display notices when speech is omitted or glyph reuse is enabled. Downloads/copies remain complete; code preview is limited to 1 MB.
- CLI/API options and limits: https://github.com/chayprabs/localtools/blob/main/latex-to-svg/USAGE.md
FAQ
Does it need TeX or the internet?
No. MathJax 4 with its New Computer Modern font, the Speech Rule Engine and the resvg rasterizer are built into the program; nothing is downloaded. \require of a package that is not built in is refused.
Which LaTeX packages work?
amsmath/amssymb, mathtools, physics, mhchem, braket, cancel, color, boldsymbol, amscd, bussproofs, cases, empheq, enclose, extpfeil, gensymb, units, upgreek, textmacros, unicode and verb, plus newcommand/def/DeclareMathOperator. Balanced multiline .tex definitions are applied in batch; incomplete definitions are skipped with a notice. Tagged/numbered standalone exports are refused.
Is the SVG the same as MathJax in a browser?
The original 162-formula corpus verifies 161 supported SVGs byte for byte against stock MathJax and one explicit tagged-equation refusal; nine named MathML entities also match the stock promise API. Exports remove event handlers, external URLs and unsafe styles. Multline uses intrinsic width.
How are PNG sizes chosen?
Scale 1 is a 16 px font size; the default 4 gives 64 px, and --dpi N equals scale N/96. PNGs are limited to 64 megapixels; the background is transparent unless you pick a colour.
What happens with bad input?
Recursive macros, over 400 nesting levels and over 256 KB are refused. Each formula has a killable 10 s worker budget (30 s above 64 KB). Speech is optional: above 2048 source characters, 16384 MathML characters or 256 tree nodes it is omitted with a notice; provide alt text. Above 16384 source characters, embedded glyph reuse is enabled and reported.