- Home
-
/ Math to Word
Markdown Math to Word: LaTeX Equations, Formulas & Symbols Guide
The definitive guide to converting Markdown documents with LaTeX math equations into Word. Covers inline math, display equations, matrices, integrals, and complex formulas using Pandoc, KaTeX, and MathJax.
Math equations are, without question, the hardest part of converting Markdown to Word. Headings, bold text, and even tables translate relatively smoothly between the two formats. But the moment your document contains a fraction, an integral sign, a summation, or a matrix, things fall apart. LaTeX math notation—the standard for writing equations in Markdown—has no direct equivalent in Word's rich-text model. Word uses its own equation format called OMML (Office Math Markup Language), and bridging the gap between LaTeX and OMML requires specialized tools.
If you have ever opened a converted Word document only to find raw LaTeX code like \frac{d}{dx}\int_a^x f(t)\,dt = f(x) printed as plain text instead of a beautifully rendered equation, you understand the frustration. This guide will show you exactly how to solve that problem. We cover three distinct methods—Pandoc, KaTeX pre-rendering, and MathJax—so you can choose the approach that best fits your workflow.
Whether you are writing an academic paper, a technical report, a physics homework assignment, or engineering documentation, this guide ensures your equations arrive in Word looking exactly as you intended.
LaTeX Math Syntax in Markdown
Before diving into conversion methods, you need a solid understanding of how math equations are written in Markdown. Most Markdown processors that support math use LaTeX syntax wrapped in dollar-sign delimiters. There are two fundamental modes: inline math and display math.
Inline Math
Inline math appears within a line of text. You wrap the LaTeX expression in single dollar signs. For example, writing $E=mc^2$ in your Markdown will render Einstein's famous mass-energy equivalence formula right inside your paragraph. Inline math is ideal for referencing variables, simple expressions, and short formulas that flow naturally within prose. Other common examples include $x^2 + y^2 = r^2$ for the equation of a circle and $\alpha + \beta = \gamma$ for Greek letter expressions.
# Markdown source:
The energy is given by $E=mc^2$ where $m$ is mass.
Display Math
Display math renders equations on their own line, centered and visually prominent. You wrap the LaTeX expression in double dollar signs ($$...$$). Display mode is used for important equations, derivations, and any formula complex enough to deserve its own visual space. Display equations are typically numbered in academic papers and are the standard for multi-line derivations.
# Markdown source:
$$\int_0^\infty e^{-x}\,dx = 1$$
Common Symbols Quick Reference
Here are the most commonly used LaTeX symbols you will encounter in Markdown math. Knowing these will help you both write and debug equations during conversion.
| Symbol | LaTeX Code | Category |
|---|---|---|
| Greek alpha | \alpha | Greek Letters |
| Greek beta | \beta | Greek Letters |
| Greek pi | \pi | Greek Letters |
| Summation | \sum_{i=1}^{n} | Operators |
| Integral | \int_a^b | Operators |
| Fraction | \frac{a}{b} | Structure |
| Square root | \sqrt{x} | Structure |
| Infinity | \infty | Symbols |
| Not equal | \neq | Relations |
| Arrow (right) | \rightarrow | Arrows |
Common Math Notations in LaTeX
This section provides a comprehensive reference of the math notations you are most likely to use in Markdown documents. Each example shows the LaTeX source code you would write in your Markdown file. Understanding these patterns is essential because conversion tools handle each construct differently, and knowing the LaTeX input helps you troubleshoot when output does not look right.
Fractions
Fractions are one of the most common mathematical structures. LaTeX provides the \frac{numerator}{denominator} command.
$$\frac{a}{b}$$
$$\frac{x^2 + 1}{x - 1}$$
$$\frac{\partial f}{\partial x}$$
Subscripts & Superscripts
Use the caret ^ for superscripts and underscore _ for subscripts. Braces group multi-character exponents.
$x^2$, $x^{n+1}$
$a_1$, $a_{i,j}$
$x_i^2$, ${}^{14}_{6}C$
Greek Letters
Greek letters are written with a backslash followed by the letter name. Capitalize the first letter for uppercase variants.
$\alpha, \beta, \gamma, \delta$
$\epsilon, \theta, \lambda, \mu$
$\Gamma, \Delta, \Theta, \Omega$
Integrals
Integrals use \int with subscript and superscript for limits. Double and triple integrals use \iint and \iiint.
$$\int_0^1 x^2\,dx$$
$$\iint_D f(x,y)\,dA$$
$$\oint_C \vec{F}\cdot d\vec{r}$$
Summations & Products
Summation and product operators work like integrals, with limits specified using subscripts and superscripts.
$$\sum_{i=1}^{n} i^2$$
$$\prod_{k=1}^{n} k$$
$$\sum_{n=0}^{\infty} \frac{x^n}{n!}$$
Matrices
Matrices use the \begin{pmatrix}...\end{pmatrix} environment. Use & to separate columns and \\ for new rows.
$$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$$
$$\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$$
Method 1: Pandoc (Best for Math)
Pandoc is the gold standard for converting Markdown with math to Word. It is the only tool that translates LaTeX math into Word's native OMML (Office Math Markup Language) equation objects. This means your equations are not images or static text—they are fully editable, native Word equations that you can modify using Word's built-in equation editor. This is a critical advantage for collaborative documents where reviewers need to adjust formulas.
Step 1: Install Pandoc
Pandoc is available on all major platforms. Install it using your system's package manager or download the installer from the official website. On Windows, the easiest method is using the MSI installer or Chocolatey. On macOS, use Homebrew. On Linux, most distributions include Pandoc in their package repositories.
# Windows (Chocolatey)
choco install pandoc
# macOS (Homebrew)
brew install pandoc
# Ubuntu / Debian
sudo apt-get install pandoc
Step 2: Write Your Markdown with Math
Create a Markdown file with your content and math equations. Here is a complete example file that demonstrates both inline and display math, along with various equation types. Save this as document.md.
# document.md
# Calculus Fundamentals
The derivative of $f(x) = x^2$ is $f'(x) = 2x$.
## The Fundamental Theorem of Calculus
$$\frac{d}{dx}\int_a^x f(t)\,dt = f(x)$$
## Taylor Series Expansion
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
## Matrix Multiplication
$$\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} e \\ f \end{pmatrix} = \begin{pmatrix} ae + bf \\ ce + df \end{pmatrix}$$
Step 3: Convert with Pandoc
Run the Pandoc conversion command. The basic command is straightforward, but there are several useful options for controlling math rendering and document styling.
# Basic conversion (math is converted to OMML by default)
pandoc document.md -o document.docx
# With a custom reference document for styling
pandoc document.md --reference-doc=template.docx -o document.docx
# Explicitly specify math rendering (usually not needed)
pandoc document.md --mathml -o document.docx
# From stdin (useful for piping)
echo '$$E=mc^2$$' | pandoc -f markdown -o equation.docx
Step 4: Verify and Edit in Word
Open the generated .docx file in Microsoft Word. You should see fully rendered equations. Click on any equation to enter the equation editor. You can switch between Professional (visual) and Linear (text-based) views using the toggle in the Equation Tools ribbon. Inline equations will appear within the text flow, and display equations will be centered on their own line.
Tip: If you need to edit an equation, click on it and press Alt + = to open Word's equation editor. You can also type LaTeX directly in the editor—Word recognizes many LaTeX commands in its linear input mode.
Method 2: KaTeX Pre-Rendering
KaTeX is a fast, lightweight JavaScript library for rendering LaTeX math in the browser. While it cannot produce native Word equations directly, it offers an alternative workflow: render the equations to images (PNG or SVG) and then embed those images in your Word document. This method works well when you do not have Pandoc installed or when you need pixel-perfect rendering that matches your web preview exactly.
How KaTeX Pre-Rendering Works
The workflow involves three steps: first, you render your LaTeX equations to HTML using KaTeX in a browser or Node.js environment. Second, you capture the rendered output as images (using a screenshot tool, html2canvas, or a headless browser). Third, you insert those images into your Word document at the positions where the equations should appear.
The advantage of this approach is fidelity: the equation in Word looks identical to the equation on your website. The disadvantage is that the equations become static images—they cannot be edited in Word's equation editor. If someone needs to change a variable name or fix a typo in a formula, they must go back to the LaTeX source, re-render, and replace the image.
Node.js Script for Batch Rendering
You can automate KaTeX rendering using Node.js. Install the required packages and use a script to extract all math expressions from your Markdown file, render each one, and save the output.
# Install KaTeX
npm install katex
# Example: render a single equation to HTML
const katex = require('katex');
const html = katex.renderToString('E=mc^2', {
displayMode: false,
throwOnError: false
});
console.log(html);
Using Our Online Converter with KaTeX
The Markdown to Word online converter at markdown-to-word.online supports KaTeX-rendered math. Write your equations using standard $...$ and $$...$$ syntax, and the converter will pre-render them before generating the Word document. This is the easiest way to get math into Word without installing any software—just paste your Markdown and download the result.
Method 3: MathJax to Word
MathJax is the most widely used math rendering engine on the web. It powers equation display on sites like Stack Exchange, arXiv, and countless academic blogs. While MathJax does not directly export to Word, it offers a browser-based workflow that can produce high-quality equation output for Word documents.
The Copy-Paste Method
MathJax renders equations as MathML in the browser. Modern versions of Word (2016 and later) can accept MathML input and convert it to native OMML equations. The workflow is as follows: render your Markdown document in a browser with MathJax enabled, right-click on a rendered equation, select "Show Math As" and then "MathML Code," copy the MathML, and paste it into Word. Word will interpret the MathML and create an editable equation object.
This method works well for individual equations but becomes tedious when your document contains dozens of formulas. For batch processing, consider using Pandoc instead. However, if you need to convert just a few key equations and want full control over how each one looks, the MathJax copy-paste approach gives you that precision.
Note: MathJax v3 has improved MathML output significantly compared to v2. Make sure you are using MathJax 3.x for the best results when copying MathML to Word.
Automated MathJax to Word Pipeline
For larger documents, you can build an automated pipeline using a headless browser (Puppeteer or Playwright) to render a MathJax-enabled HTML page, extract the MathML for each equation, and inject it into a Word document using a library like docx.js or python-docx. This is an advanced approach suited for teams that frequently produce math-heavy documents and want a fully automated build system.
# Conceptual pipeline (pseudocode)
1. Parse Markdown, extract math blocks
2. Render HTML page with MathJax
3. Use Puppeteer to open page, wait for MathJax
4. Extract MathML from each rendered equation
5. Build .docx with OMML converted from MathML
6. Insert non-math content as regular Word paragraphs
Handling Complex Equations
Simple equations like $E=mc^2$ convert without any issues in all three methods. The real challenge comes with complex mathematical structures: aligned multi-line equations, piecewise functions, large matrices, and numbered equation systems. This section covers the LaTeX patterns for these constructs and explains how each conversion method handles them.
Aligned Equations
The aligned environment lets you align multi-line equations at a specific point, typically the equals sign. This is essential for showing step-by-step derivations. Pandoc handles aligned environments well, converting them to multi-line OMML equations in Word. KaTeX and MathJax render them visually as images.
$$\begin{aligned}
f(x) &= (x+1)^2 \\
&= x^2 + 2x + 1 \\
&= (x+1)(x+1)
\end{aligned}$$
Piecewise Functions (Cases)
The cases environment defines piecewise functions with conditions. This is commonly used for absolute values, step functions, and conditional definitions. Pandoc converts cases environments to OMML using Word's built-in bracket and stack structures.
$$f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}$$
Large Matrices
Matrices larger than 3x3 can cause rendering issues in some tools. Pandoc handles matrices up to approximately 10x10 without problems. For very large matrices, consider breaking them into sub-matrices or using the ellipsis notation (\cdots, \vdots, \ddots) to indicate patterns.
$$A = \begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{bmatrix}$$
Numbered Equations
Academic papers typically require numbered equations. In LaTeX, you use the equation environment for automatic numbering. Pandoc does not support automatic equation numbering natively, but you can use the pandoc-crossref filter to add this capability. Alternatively, you can manually add equation numbers using a \tag{} command.
# Manual numbering with \tag
$$E = mc^2 \tag{1}$$
$$F = ma \tag{2}$$
# Using pandoc-crossref filter
pandoc document.md --filter pandoc-crossref -o output.docx
Troubleshooting Math Conversion
Even with the right tools, math conversion can produce unexpected results. This section covers the most common issues and their solutions, drawn from real-world experience with hundreds of document conversions.
Raw LaTeX Appears as Plain Text
Cause: The conversion tool does not recognize your math delimiters. This commonly happens when using \(...\) instead of $...$, or when there are spaces between the dollar sign and the equation content.
Fix: Ensure you use $...$ for inline and $$...$$ for display math with no space after the opening delimiter. If using Pandoc, add the --from markdown+tex_math_dollars flag to explicitly enable dollar-sign math parsing.
Equations Render but Look Wrong in Word
Cause: Font substitution. Word uses Cambria Math as its default equation font. If this font is missing or corrupted, equations will render with incorrect spacing, missing symbols, or garbled characters.
Fix: Verify that Cambria Math is installed on your system. In Word, go to File > Options > Advanced > Font Substitution to check. If the font is missing, reinstall it from the Microsoft Office installation media or download it from a trusted source. For LibreOffice users, install the STIX or Latin Modern Math font as an alternative.
Matrices Display as a Single Row
Cause: The line break command \\ inside the matrix environment is not being interpreted correctly. This often happens when the Markdown processor escapes the backslashes.
Fix: Use four backslashes (\\\\) in your Markdown source to produce two backslashes in the output, which LaTeX interprets as a line break. Alternatively, use Pandoc's --from markdown+raw_tex extension to pass LaTeX through without escaping.
Greek Letters Show as Boxes or Question Marks
Cause: The equation font does not contain the required Unicode glyphs. This is more common with less common Greek letters like \varsigma or \digamma and on systems with minimal font installations.
Fix: Switch to a comprehensive math font. Cambria Math (Windows default) covers nearly all mathematical symbols. If you are on Linux, install the XITS Math or Latin Modern Math fonts. After installing, select the equation in Word, go to the Design tab, and change the equation font.
Display Equations Not Centered
Cause: Word treats the equation as an inline object rather than a display-mode equation. This happens when Pandoc generates inline OMML instead of display OMML, typically because the $$...$$ delimiters were not on their own separate lines in the Markdown source.
Fix: Ensure your display equations have blank lines before and after the $$ delimiters in the Markdown source. In Word, click the equation and use the small dropdown arrow on the right side of the equation box to switch between "Inline" and "Display" mode. You can also set display mode by selecting the equation and pressing Ctrl+Shift+= (center alignment shortcut).
Math Style Comparison Table
Different tools produce different levels of math quality in Word. This comparison table summarizes the key differences to help you choose the right method for your needs. The ratings reflect real-world testing with a standard set of equations including fractions, integrals, matrices, and aligned environments.
| Feature | Pandoc | KaTeX (Image) | MathJax (MathML) | Online Converter |
|---|---|---|---|---|
| Output Format | Native OMML | PNG/SVG Image | Native OMML | Image-based |
| Editable in Word | Yes | No | Yes | No |
| Inline Math Quality | Excellent | Good | Very Good | Good |
| Display Math Quality | Excellent | Excellent | Very Good | Good |
| Matrix Support | Full | Full | Full | Limited |
| Aligned Equations | Full | Full | Partial | Limited |
| Setup Difficulty | Easy (CLI install) | Moderate (Node.js) | Complex (pipeline) | None (browser) |
| Batch Processing | Yes | Yes | Yes | No |
| Print Quality | Excellent | Very Good (DPI-dependent) | Excellent | Good |
| Best For | Academic papers | Web-to-Word | Advanced pipelines | Quick conversions |
Frequently Asked Questions
Can I convert LaTeX math to Word without installing any software?
Yes. You can use the Markdown to Word online converter at markdown-to-word.online. Simply paste your Markdown with $...$ and $$...$$ math notation, preview the result, and download the Word document. The converter uses KaTeX to render equations as high-quality images embedded in the .docx file. For native editable equations in Word, you will need Pandoc, which requires a local installation. However, for most use cases—reports, homework, presentations—the image-based rendering is more than sufficient and produces excellent print quality.
Does Word support LaTeX math input natively?
Partially. Microsoft Word 2016 and later versions support a subset of LaTeX commands in the equation editor's linear input mode. Press Alt + = to insert an equation, then type LaTeX-like syntax such as \frac{a}{b} or \sqrt{x} and press Space to convert it to a visual equation. However, Word's LaTeX support is limited compared to full LaTeX. Advanced environments like aligned, cases, and custom macros are not supported. For complex equations, converting from Markdown via Pandoc remains the most reliable approach.
How do I handle numbered equations and cross-references in Word?
For equation numbering, you have two options. First, use the \tag{} command in your LaTeX to manually number equations (e.g., $$E=mc^2 \tag{1}$$). Pandoc will include the tag in the OMML output. Second, install the pandoc-crossref filter, which adds automatic equation numbering and cross-referencing. Write equations with labels like {#eq:einstein} and reference them with @eq:einstein in your text. After conversion, Word will contain the numbered equations and their references. For post-conversion editing, you can also use Word's built-in caption and cross-reference features (References tab > Insert Caption).
What is the best math font for Word documents?
Cambria Math is the default and most widely compatible math font for Word. It ships with every installation of Microsoft Office and is specifically designed for OMML equations. It covers a comprehensive range of mathematical symbols, operators, and script alphabets. If you prefer a font that more closely matches LaTeX's Computer Modern look, install Latin Modern Math—it is freely available and works in Word's equation editor. Other excellent options include STIX Two Math (designed for scientific publishing), XITS Math (an extension of STIX), and Asana Math (a Palatino-style math font). To change the equation font in Word, click on an equation, go to the Design tab in the Equation Tools ribbon, and select a different font from the dropdown.
Can I convert a Word document with equations back to Markdown with LaTeX?
Yes, and Pandoc is the best tool for this reverse conversion as well. Run pandoc document.docx -o document.md and Pandoc will extract OMML equations from the Word file and convert them back to LaTeX notation wrapped in dollar signs. The round-trip is not always perfect—some formatting nuances may be lost, and manually edited equations in Word might not convert back to clean LaTeX—but for most equations the result is accurate. For documents with many equations, verify the output by rendering the Markdown in a LaTeX-capable viewer and comparing it to the original Word file.
Ready to Convert Your Math Equations?
Our free online converter handles LaTeX math notation, rendering equations beautifully in your Word document. No signup required—just paste your Markdown and download.
Try the Converter NowFree, no account needed. Supports inline math, display equations, matrices, and more.
Related Articles
Academic Writing with Markdown
Write academic papers in Markdown and convert to Word with proper citations, figures, and formatting.
Pandoc Markdown to Word Guide
Master Pandoc for Markdown to Word conversion with custom templates, filters, and advanced options.
Code Blocks to Word
Preserve syntax highlighting and monospace formatting when converting Markdown code blocks to Word.
Markdown to Word Converter
Free online tool to convert Markdown to Word documents instantly. Supports math, tables, code, and more.