md2docx
No signups · No document retention

Math and Equations in Word

md2docx supports TeX-style math in Markdown and embeds it into your DOCX. This is useful for technical reports, academic writing, and specs where equations need to look consistent.

If you’ve ever tried to paste LaTeX into Word and ended up with broken formatting, screenshots, or a document that doesn’t survive copy/paste between editors, this workflow is for you: write equations in Markdown, convert once, and review in Word like a normal document.

Inline math

Wrap the equation in single dollar signs:

Einstein’s mass–energy equivalence: $E = mc^2$

Inline math works best for short expressions. If the equation is long, Word will try to wrap it in a way that can look awkward — switch to block math for anything more than a few symbols.

Block math

Wrap the equation in double dollar signs:

$$
\\int_{0}^{\\infty} e^{-x} \\, dx = 1
$$

Block math is ideal for multi-line derivations and larger equations.

For multi-line equations, you can include line breaks inside the block. Keep lines reasonably short so the output stays readable in a portrait-oriented Word page.

Common TeX patterns (copy/paste friendly)

Here are a few TeX snippets that work well in technical docs and convert cleanly:

  • Fractions: $\\frac{a}{b}$
  • Subscripts / superscripts: $x_{i}^2$
  • Summations: $\\sum_{i=1}^{n} i$
  • Greek letters: $\\alpha, \\beta, \\gamma$
  • Matrices: $\\begin{matrix} a & b \\\\ c & d \\end{matrix}$

If you’re generating math with an AI tool, ask it to output equations using $...$ and $$...$$ delimiters, and avoid mixing math with raw HTML.

How math appears in the DOCX

For consistent output across Word versions, equations are rendered and embedded as images. This keeps the visual layout stable, especially when documents are opened on different devices.

The trade-off is that the equation is not a native Word “Equation” object by default. If you need to edit the equation inside Word, you can recreate it using Word’s equation editor after conversion.

If you need editable equations in Word

Some teams require equations to be editable for publication workflows. A practical compromise is: convert normally for layout and review, then replace only the handful of critical equations using Word’s Insert → Equation tool.

  1. Convert your Markdown and open the DOCX in Word.
  2. Insert a Word equation where needed (Insert → Equation).
  3. Paste or retype the final TeX/LaTeX for that equation.

This keeps 95% of the workflow in Markdown while still satisfying “editable equation” requirements for the final draft.

Best practices

  • Keep equations in plain text (not in code blocks) so the math renderer can detect them.
  • Prefer block math for long expressions so Word layout stays readable and doesn’t wrap awkwardly.
  • If your equation includes a literal dollar sign (for example currency), escape it or avoid using math delimiters in that paragraph.

If your document mixes math and tables, consider using a template to tune paragraph spacing so the document doesn’t feel cramped (see Custom templates).

Troubleshooting

My equation doesn’t render

  • Check for mismatched delimiters: every $ must have a closing $.
  • Ensure the equation isn’t inside a fenced code block.
  • If you use Markdown that contains many currency symbols, prefer block math ($$) so it’s unambiguous.

It renders, but the size looks off

Math is embedded as an image for consistent DOCX output. If the equation is too small, use block math and keep the surrounding paragraph styles consistent via templates.

Backslashes look wrong

TeX relies heavily on backslashes (\\). If an AI tool “helpfully” removes them or converts them into other characters, the renderer won’t understand the equation. When in doubt, re-check the raw Markdown and ensure commands like \\frac or \\sum are intact.

Ready to try it? Convert a math-heavy document on /convert.