llmdoc
Math · Reference + live editor · Updated July 2026

LaTeX & math in Markdown

The syntax that works, where it renders, why it sometimes breaks — and how to export your equations to Word, PDF, and HTML.

The short answer

Plain Markdown has no built-in math — but nearly every modern renderer adds it as an extension with the same two delimiters:

  • Inline: wrap math in single dollar signs — $E = mc^2$ — on the same line as text.
  • Block: wrap math in double dollar signs — $$E = mc^2$$ — for a centered, full-size equation.
  • Inside the delimiters you write standard LaTeX, rendered by KaTeX or MathJax depending on the platform.

Whether it renders depends on where you publish — see the support table below.

Try it — type Markdown math

Edit the Markdown and watch it render with KaTeX, live. This is the same engine the export uses.

Live preview

Inline math sits in single dollars: E=mc2E = mc^2 and α+β=γ\alpha + \beta = \gamma.

Block (display) math uses double dollars:

ex2dx=π\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}

The quadratic formula:

x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Edit the left panel — the preview updates live. ChatGPT’s \( \) and \[ \] work too.

Export to Word / PDF / HTML
Inline

$ ... $

Single dollar signs around an expression render it inline with surrounding text — same line, same baseline. Use sparingly: complex fractions look cramped at body-text size.

  • $E = mc^2$E=mc2E = mc^2Mass–energy equivalence
  • $\alpha + \beta = \gamma$α+β=γ\alpha + \beta = \gammaGreek letters
  • $P(A \mid B) = \dfrac{P(B \mid A) P(A)}{P(B)}$P(AB)=P(BA)P(A)P(B)P(A \mid B) = \dfrac{P(B \mid A) P(A)}{P(B)}Bayes — display fraction inline
  • $x_i^2 + y_i^2 = r^2$xi2+yi2=r2x_i^2 + y_i^2 = r^2Subscripts and superscripts
Block

$$ ... $$

Double dollar signs put the equation on its own centered line at full display size. Use for anything bigger than a single fraction or summation.

  • Definite integral$$\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi}$$ex2dx=π\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi}
  • Sum$$\sum_{n=1}^{N} n = \frac{N(N+1)}{2}$$n=1Nn=N(N+1)2\sum_{n=1}^{N} n = \frac{N(N+1)}{2}
  • Matrix$$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$$(abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix}
  • Schrödinger equation$$i\hbar\,\frac{\partial}{\partial t}\Psi = \hat{H}\,\Psi$$itΨ=H^Ψi\hbar\,\frac{\partial}{\partial t}\Psi = \hat{H}\,\Psi

Markdown math cookbook

Copy the LaTeX on the left, wrap it in $…$ or $$…$$, done. Each recipe shows exactly what renders.

Subscripts, superscripts & powers

^ raises, _ lowers. Anything longer than one character must be braced — the #1 cause of broken math.

  • x^2x2x^2Power of 2
  • x^{10}x10x^{10}Multi-digit power — brace it
  • x_ixix_iSubscript
  • x_{max}xmaxx_{max}x_max only subscripts the m
  • x_i^2xi2x_i^2Both at once
  • e^{-x^2}ex2e^{-x^2}Expression in the exponent

Fractions & roots

\frac shrinks inside inline math; \dfrac forces full display size.

  • \frac{a}{b}ab\frac{a}{b}Basic fraction
  • \dfrac{1}{1+x}11+x\dfrac{1}{1+x}Display-size, even inline
  • \frac{\partial f}{\partial x}fx\frac{\partial f}{\partial x}Partial derivative
  • \sqrt{x}x\sqrt{x}Square root
  • \sqrt[3]{x}x3\sqrt[3]{x}nth root
  • \binom{n}{k}(nk)\binom{n}{k}Binomial coefficient

Greek letters

Lowercase spelled out; capitalize the command for uppercase (\delta → δ, \Delta → Δ).

  • \alpha, \beta, \gamma, \deltaα,β,γ,δ\alpha, \beta, \gamma, \delta\alpha \beta \gamma \delta
  • \epsilon, \theta, \lambda, \muϵ,θ,λ,μ\epsilon, \theta, \lambda, \mu\epsilon \theta \lambda \mu
  • \pi, \rho, \sigma, \tauπ,ρ,σ,τ\pi, \rho, \sigma, \tau\pi \rho \sigma \tau
  • \phi, \chi, \psi, \omegaϕ,χ,ψ,ω\phi, \chi, \psi, \omega\phi \chi \psi \omega
  • \Gamma, \Delta, \Sigma, \OmegaΓ,Δ,Σ,Ω\Gamma, \Delta, \Sigma, \Omega\Gamma \Delta \Sigma \Omega
  • \varepsilon, \varphiε,φ\varepsilon, \varphiVariant forms

Sums, integrals & limits

Bounds attach with the same _ and ^ used for sub/superscripts.

  • \sum_{n=1}^{N} nn=1Nn\sum_{n=1}^{N} nSum with bounds
  • \prod_{i=1}^{n} a_ii=1nai\prod_{i=1}^{n} a_iProduct
  • \int_0^1 x^2 \, dx01x2dx\int_0^1 x^2 \, dxDefinite integral
  • \oint_C \vec{F} \cdot d\vec{r}CFdr\oint_C \vec{F} \cdot d\vec{r}Contour integral
  • \lim_{x \to \infty} \frac{1}{x}limx1x\lim_{x \to \infty} \frac{1}{x}Limit
  • \infty\inftyInfinity

Vectors & calculus operators

Nabla (\nabla) covers gradient, divergence, and curl; \partial for partial derivatives.

  • \nabla ff\nabla fGradient (nabla)
  • \nabla \cdot \vec{F}F\nabla \cdot \vec{F}Divergence
  • \nabla \times \vec{F}×F\nabla \times \vec{F}Curl
  • \vec{v}, \hat{n}, \mathbf{A}v,n^,A\vec{v}, \hat{n}, \mathbf{A}Vector, unit vector, bold matrix
  • \frac{dy}{dx}, \dot{x}, \ddot{x}dydx,x˙,x¨\frac{dy}{dx}, \dot{x}, \ddot{x}Derivatives
  • a \cdot b, \ a \times bab, a×ba \cdot b, \ a \times bDot and cross products

Matrices, cases & aligned equations

Environments use \begin…\end inside $$…$$. Rows split on \\, columns on &.

  • \begin{pmatrix} a & b \\ c & d \end{pmatrix}(abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix}
  • bmatrix → square brackets, vmatrix → determinant bars[1001]\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
  • \begin{cases} … \end{cases} for piecewise functionsf(x)={x2x0xx<0f(x) = \begin{cases} x^2 & x \geq 0 \\ -x & x < 0 \end{cases}
  • \begin{aligned} aligns equation systems on &2x+y=5xy=1\begin{aligned} 2x + y &= 5 \\ x - y &= 1 \end{aligned}

Relations

  • \leq
  • \geq
  • \approx
  • \neq
  • \equiv
  • \sim
  • \propto
  • \in
  • \notin

Arrows

  • \to
  • \rightarrow
  • \Rightarrow
  • \leftrightarrow
  • \mapsto
  • \implies

Brackets

  • \left( ... \right)
  • \lvert x \rvert
  • \lVert v \rVert
  • \langle a, b \rangle

Where Markdown math renders

Math is never part of core Markdown — it’s a renderer extension, so the same$…$ works in some places and not others.

PlatformMath?
GitHubYes
GitLabYes
ObsidianYes
JupyterYes
VS Code previewYes
PandocYes
NotionPartial
Reddit / Slack / DiscordNo

Exporting equations to documents

Paste Markdown into LLM to Doc and your equations carry through to real documents:

HTML

Rendered with KaTeX — equations are styled, selectable spans, and the LaTeX source is preserved in MathML so it stays copy-pasteable.

DOCX (Word)

Translated to native Office Math (OMML) via Pandoc. Word treats each equation as a real, editable object — compatible with Word, Google Docs, and LibreOffice.

PDF

Rendered via KaTeX and rasterized faithfully, so fractions, integrals, and matrices land print-ready on the page.

Why your math isn’t rendering

  • ChatGPT’s delimiters. ChatGPT often emits\( ... \)and \[ ... \]instead of dollar signs. LLM to Doc rewrites these automatically; elsewhere, search-and-replace them with $ / $$.
  • Math inside backticks. Wrapping a formula in inline code (`$x$`) renders it as literal text, not math. Use the math delimiters directly.
  • Unbraced subscripts. Underscore is the subscript operator, so $x_max$ only subscripts the m. Brace it: $x_{max}$.
  • Cramped inline fractions. Use \dfrac instead of \frac for a full-size fraction inside inline math.

Frequently asked questions

Does Markdown support LaTeX or math?

Plain Markdown (CommonMark) has no math syntax. Almost every modern renderer adds it as an extension using $…$ for inline math and $$…$$ for display math, powered by KaTeX or MathJax. So whether math renders depends entirely on where you publish it.

How do I write a math formula in Markdown?

Wrap inline math in single dollar signs — $E = mc^2$ — and display (block) math in double dollar signs on their own lines — $$ … $$. Inside the delimiters you write standard LaTeX: \frac{a}{b}, x^2, \sqrt{x}, \sum, \int, Greek letters like \alpha, and so on.

What's the difference between $ and $$?

$…$ renders inline at the surrounding text size and baseline. $$…$$ renders as a centered display block at full size — use it for anything larger than a simple fraction or summation.

Why isn't my Markdown math rendering?

Usual causes: the platform doesn't support math (e.g. Reddit, Slack); the formula is inside backticks so it's treated as code; a multi-character subscript wasn't braced (x_max only subscripts the m — use x_{max}); or it came from ChatGPT using \( \) / \[ \] delimiters instead of $ / $$.

Can I convert Markdown math to Word or PDF?

Yes. LLM to Doc converts $…$ and $$…$$ to native, editable Word equations (OMML) in DOCX, and renders them faithfully in PDF and HTML — paste your Markdown, preview it, and export.

How do I write subscripts and superscripts in Markdown math?

Use _ for subscripts and ^ for superscripts inside the math delimiters: $x_i$, $x^2$. Anything longer than one character must be wrapped in braces — $x_{max}$ and $x^{10}$, not $x_max$ or $x^10$, which only apply to the first character.

How do I write a fraction in Markdown?

Inside math delimiters, use \frac{numerator}{denominator} — for example $\frac{a}{b}$. Inline fractions render small; use \dfrac{a}{b} to force full display size, or put the formula in a $$…$$ block.

How do I write math in GitHub Markdown?

GitHub renders $…$ inline math and $$…$$ display math in READMEs, issues, PRs, and gists. For expressions with characters that clash with Markdown (like | in tables), use a fenced code block with the math language: ```math on its own lines around the LaTeX.

See your formulas render & export

Paste Markdown, watch the live preview, and export to Word, PDF, or HTML. The homepage has a one-click Formulas example pre-loaded with the equations on this page.

Open the converter