Markdown to PDF with math

Matrices, fractions, subscripts and superscripts typeset with TeX spacing rules, set on a shared baseline, with the math font embedded. Sharp on screen and on a 600 dpi printer.

Pro · preview is free

Quantum harmonic oscillator — problem set 3

The Hamiltonian restricted to the first three levels, in matrix form:

H=ℏω[120003200052]

The energy of level n is En=ℏω(n+12), so the ratio E2E0=5 and the spacing is constant.

Ladder operators satisfy a†a|n⟩=n|n⟩ and [a,a†]=1.

The ground state is ψ0(x)=(mωπℏ)1/4e−mωx2/2ℏ, normalised so that ∫−∞∞|ψ0|2dx=1.

— 1 —

Converted in your browser. Your file never leaves your device.
1

Paste Markdown with math

Inline $…$ and display $$…$$. Matrices, fractions, roots, sub- and superscripts in the LaTeX notation you already use.

2

Check spacing and baselines

The preview lays out math with the same rules as the PDF, so a tall fraction inside a sentence looks in the preview exactly as it will on paper.

3

Download a print-ready PDF

Glyphs are vector outlines from an embedded math font. Fraction bars and radicals stay crisp at any zoom and on any printer.

What good math typesetting in a PDF actually requires

Most "Markdown to PDF" tools pass math to a browser, take whatever the browser draws, and print it. The result is readable but not typeset: superscripts sit too high, fraction bars are a pixel too thick on one line and invisible on the next, and a matrix in a sentence pushes the lines above and below apart. This page explains the four things MDtoDOCX does differently for math and why each one matters on paper. If you want the list of supported LaTeX commands and the overall pipeline, that lives on Markdown to PDF with LaTeX; this page is about spacing, baselines, fonts and print quality.

Spacing follows TeX's atom classes, not the font's advance widths

TeX does not put a fixed gap between symbols. It classifies each symbol as an ordinary atom, a binary operator, a relation, an opening or closing delimiter, punctuation or an inner formula, and then looks up the gap for each pair of classes in a table: a thin space (3 mu) between an ordinary atom and a large operator, a medium space (4 mu) around binary operators like + and −, a thick space (5 mu) around relations like = and ≤, and no space at all between an ordinary atom and its subscript. One mu is one eighteenth of an em, so the gaps scale with the font size. MDtoDOCX implements this table, which is why a+b=c comes out with the visibly wider gap around the equals sign that you see in any physics textbook, and why f(x) has no gap before the parenthesis. In script style, inside a superscript or the numerator of an inline fraction, the medium and thick spaces are dropped, again exactly as TeX does, so x^{n+1} stays compact.

Baselines: the math axis, fractions and inline height

Every math font defines an axis height, the vertical position of the minus sign and the fraction bar, roughly a quarter of the x-height above the baseline. MDtoDOCX centres fraction bars, matrix brackets, stretched parentheses and binary operators on that axis, so a fraction next to an equals sign lines up with it instead of floating. Inline fractions use TeX's text-style shifts: the numerator moves up by a smaller amount than in display style and the digits are set at 70 % size, so $\frac{1}{2}$ inside a sentence adds at most 2 pt of extra height and the paragraph keeps an even leading. Display equations use the full shifts, full-size numerators and a 12 pt gap above and below. Subscripts drop to a fixed depth and superscripts rise to a fixed height that depends on whether the base is cramped, which is how x_i^2 and x^2_i both put the 2 and the i at the same positions and prevent them from colliding when the base is a tall bracket.

Matrices and delimiters that stretch correctly

A bmatrix is laid out as a table with a 1 em column gap and rows aligned on their baselines, then wrapped in square brackets built from the font's extensible glyph pieces rather than scaled from a single bracket. Scaling a normal bracket makes its strokes thicker; assembling one from the top, extender and bottom pieces keeps the stroke weight identical to the surrounding text. The same assembly applies to \left( … \right), braces in cases and the radical sign in \sqrt, whose overline is drawn at the font's rule thickness and extends over the whole radicand. Matrices are never split across a page; a display equation that does not fit at the bottom of a page moves whole to the next one.

Font embedding: OpenType MATH tables and subsetting

Correct math layout depends on metrics that only a true math font carries: the axis height, the sub- and superscript shifts, the fraction rule thickness, the sizes of extensible pieces. These live in the OpenType MATH table. MDtoDOCX ships Latin Modern Math by default and lets you pick STIX Two Math for a Times-like look or Cambria Math to match a Calibri body; all three are real math fonts with a MATH table. The chosen font is subset to the glyphs the document uses and embedded in the PDF, so a problem set with a hundred equations adds around 70 KB and renders identically on every viewer and printer. No system font substitution ever happens, which is the usual cause of integral signs turning into boxes on a colleague's machine.

Print clarity: hairlines, small sizes and high resolution

Math has more thin strokes than prose: fraction bars, the overline of a root, the arrows of vectors, second-level superscripts at 50 % size. All of these are emitted as vector paths, never as bitmaps, so a laser printer at 600 or 1200 dpi renders them at its full resolution. Rules are drawn at the font's specified thickness, 0.4 pt for Latin Modern, and MDtoDOCX enforces a floor of 0.3 pt so that a fraction bar in a second-level subscript does not disappear when printed. Glyphs remain selectable and searchable text, so a reader can copy ψ₀(x) out of the PDF as Unicode.

Free preview, Pro download

Typesetting runs in your browser and the preview is free, including every spacing and baseline rule described above. Downloading a PDF with typeset math is a Pro feature; on the free tier the math is exported as its LaTeX source in a monospace span, so nothing is lost. The same expressions become native Word equations on Markdown to Word with math. For plans see Pricing; the 7-Day Pass at $4.9 covers a single deadline.

Math in PDF: MDtoDOCX vs Pandoc + LaTeX vs browser print

Typesetting detailMDtoDOCXPandoc + pdflatexPrint a MathJax page
Inter-symbol spacingTeX atom-class tableTeX atom-class tableApproximate
Fraction bar on the math axisYesYesUsually
Inline fraction line heightText-style shifts, 70 % scriptsText-style shiftsOften enlarges the line
Stretched bracketsExtensible glyph piecesExtensible glyph piecesScaled, strokes thicken
Math font in the PDFWhichever math font the renderer has; not embedded or subsetEmbedded Type 1Depends on the browser
Minimum rule thickness0.3 pt floorFont defaultCan vanish at 1 px
SetupNone2–4 GB TeX installNone
Unicode in math (ℏ, Greek)Yesxelatex onlyYes
Equations selectable as textYesYesSometimes

Frequently asked questions

Does Markdown to PDF support math formulas?
Yes. Inline $…$ and display $$…$$ math is typeset with TeX spacing and baseline rules and embedded as vector glyphs. Matrices, fractions, roots, sums, integrals, sub- and superscripts and Greek letters are all supported.
Why does an inline fraction not push my lines apart?
Inline math uses TeX's text style: numerators and denominators are set at 70 % size with smaller vertical shifts, so a fraction adds at most about 2 pt of height and the paragraph leading stays even.
Which math font is used and is it embedded?
Latin Modern Math by default, with STIX Two Math and Cambria Math available from the options bar. The font is subset and embedded in the PDF, so it renders identically everywhere and never falls back to a system font.
Will thin fraction bars print clearly?
Yes. Rules are vector paths at the font's thickness, with a 0.3 pt floor even in second-level scripts, so they render at full printer resolution rather than disappearing at one screen pixel.
Can a matrix be split across two pages?
No. Display equations, including matrices and multi-line aligned blocks, are kept whole. If one does not fit at the bottom of a page it moves to the next page with its introducing sentence.
How is this page different from Markdown to PDF with LaTeX?
The LaTeX page covers the command set, macros and the conversion pipeline. This page covers how the output is typeset: spacing, baselines, delimiters, font embedding and print resolution.
Is math conversion free?
The typeset preview is free with no account. Downloading the PDF with typeset math requires Pro; the $4.9 7-Day Pass covers one-off use. Free downloads keep the LaTeX source as text.
Is my document uploaded to typeset the math?
No. Parsing, layout and PDF assembly run inside your browser. Only explicit Pro batch jobs send content to our servers, where it is deleted within 24 hours.