Skip to main content

Math: Latex To SVG

Render a LaTeX-flavored text to SVG markup via MathJax.

Mixed prose and math is supported: every $$...$$, \[...\], \(...\) and math-like $...$ region is treated as math, and the prose between them is kept, so the whole input renders as a single SVG. Long paragraphs are wrapped onto multiple lines of bounded width. Input without any math delimiter is treated as one raw formula.

Simple formulas that have a plain-text Unicode equivalent (x^2, \alphaα, H_{1}H₁) skip SVG entirely and output that text; SVG is only produced for layout plain text cannot express (fractions, roots, big operators, matrices, …).

Cleanup applied before rendering: common HTML entities are decoded (&&), empty math delimiters ($$, $ $, \[ \], \( \)) are stripped, and \tag{...} labels are inlined as trailing text. Currency-style dollars (costs $5 and $10) stay prose. The node fails when MathJax cannot parse the resulting formula.

Example
Input: \frac{a}{b}
Output: <svg ...>...</svg>

Input: E = mc^2
Output: E = mc² (plain text, no SVG needed)

Parameters

Inline mode

When on, renders without display-equation styling so the SVG flows with surrounding text. Off (default) renders as a centered display equation.

Input

Textrequired

The LaTeX text to render. Can be a raw formula or prose containing delimited math regions.

Output

Text

The rendered <svg>...</svg> markup, or the plain Unicode text equivalent when the formula is simple enough.