1.0.0 • Published 7 months ago
latex-to-svg-converter v1.0.0
LaTeX to SVG Converter
A TypeScript library for converting LaTeX equations to SVG.
Installation
npm install latex-to-svg-converter mathjax
Usage
Conversion to SVG String
import { convertLatexToSvg } from 'latex-to-svg-converter';
// Convert to SVG string
const svgString = await convertLatexToSvg('E = mc^2');
Download SVG
import { downloadLatexSvg } from 'latex-to-svg-converter';
// Download SVG
await downloadLatexSvg('\\sum_{i=1}^{n} i', 'equation.svg');
Advanced Usage with Options
import { LatexToSvgConverter } from 'latex-to-svg-converter';
const converter = LatexToSvgConverter.getInstance();
const svg = await converter.convertToSvg('\\int_{0}^{1} x^2 dx', {
display: true,
throwOnError: false
});
Options
display
: Whether to render the equation in display (block) modethrowOnError
: Whether to throw an error on conversion failure
Requirements
- MathJax 3.x
1.0.0
7 months ago