Convert Markdown with LaTeX Math to PDF

Scientists, engineers, and researchers write papers filled with equations. Markdown is an excellent format for drafting these documents, but rendering LaTeX math inside Markdown and exporting it to a clean PDF has traditionally been a challenge. This guide shows you exactly how to do it.

What is LaTeX Math?

LaTeX is a typesetting system that has been the standard for academic and scientific writing for decades. Its math syntax lets you express everything from simple fractions to complex integrals and matrices using plain text commands.

When people talk about "LaTeX in Markdown," they mean embedding LaTeX math expressions directly inside a Markdown document using special delimiters. The rendering engine (typically KaTeX or MathJax) then converts these expressions into properly formatted equations.

ConvertMD2PDF uses KaTeX, which is known for extremely fast rendering and excellent coverage of common LaTeX math commands. This means your equations appear instantly in the preview and render crisply in the final PDF.

LaTeX Syntax in Markdown

There are two types of math expressions you can use: inline and display. Here is how each works.

Inline Math

Wrap an expression in single dollar signs to render it within a paragraph:

The famous equation $E = mc^2$ shows mass-energy equivalence.

This renders the equation inline, right next to the surrounding text. Use inline math for variables ($x$), simple formulas ($a^2 + b^2 = c^2$), or brief references to expressions.

Display Math

Wrap an expression in double dollar signs to render it on its own line, centered:

$$
\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$

Display math is ideal for important equations, proofs, or any expression that deserves visual emphasis. The equation gets its own line and is rendered larger than inline math.

Matrices

You can create matrices using the \begin{matrix} environment:

$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\begin{pmatrix}
x \\
y
\end{pmatrix}
=
\begin{pmatrix}
ax + by \\
cx + dy
\end{pmatrix}
$$

Use pmatrix for parentheses, bmatrix for square brackets, and vmatrix for vertical bars (determinants).

Fractions and Greek Letters

Fractions use the \frac{numerator}{denominator} syntax:

The quadratic formula: $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$

Greek letters are accessed with a backslash prefix:

$\alpha$, $\beta$, $\gamma$, $\delta$, $\theta$, $\lambda$, $\pi$, $\sigma$, $\omega$

Capitalize the first letter for uppercase variants: $\Omega$, $\Sigma$, $\Delta$.

How to Convert Markdown with LaTeX to PDF

Converting a Markdown document with embedded LaTeX math to PDF is straightforward with ConvertMD2PDF:

  1. Open ConvertMD2PDF. Navigate to convertmd2pdf.com in your browser. No signup required.
  2. Paste your Markdown. Copy your Markdown content (with LaTeX expressions) into the editor on the left side. You can also drag and drop a .md file.
  3. Verify the preview. The right panel shows a live preview. Check that all equations render correctly. KaTeX will display an error message in red if a LaTeX command is unsupported or has a syntax issue.
  4. Choose your settings. Select an academic-friendly theme. Pick your paper size (A4 is standard for most journals). Choose a serif font if the document is for academic submission.
  5. Download the PDF. Click "Download PDF" to generate and save the file. All equations will be embedded as high-quality vector graphics in the PDF.

The entire process runs in your browser. Your document, including all equations, never leaves your device.

Tips for Best Results

  • Use the correct delimiters. Single $ for inline, double $$ for display. Mixing them up is the most common cause of rendering errors.
  • Test complex equations first. If you are unsure whether a particular LaTeX command is supported, paste it into ConvertMD2PDF and check the live preview before writing the rest of your document.
  • Choose an academic theme. ConvertMD2PDF offers themes optimized for documents with heavy math content. These themes use appropriate spacing and font sizes for equations.
  • Avoid deprecated commands. KaTeX does not support every LaTeX command. Stick to the core math commands documented in the LaTeX Math Formulas guide.
  • Use \\ for line breaks in environments. Inside matrices, aligned equations, and cases, use \\ to separate rows.

Convert Math-Rich Documents to PDF

Render LaTeX equations beautifully and export to PDF in seconds.

Try ConvertMD2PDF Free