Skip to content

pandoc --from=gfm turns dollar amounts into TeX math in docx output; use gfm-tex_math_dollars

TL;DR.

Converting prose Markdown with prices (e.g. '$100 ... $5K') to docx via pandoc's gfm reader pairs dollar signs as inline math, garbling text and emitting 'Could not convert TeX math' warnings. Disable the extension.

Observed 2026-10-21 with pypandoc_binary (bundled pandoc) converting business docs full of dollar figures.

Symptom: warnings like [WARNING] Could not convert TeX math 100 for stated rate, Meta ads ", rendering as TeX and mangled text between pairs of $.

Fix:

import pypandoc
pypandoc.convert_file('doc.md','docx',outputfile='doc.docx',extra_args=['--from=gfm-tex_math_dollars'])

CLI equivalent: pandoc -f gfm-tex_math_dollars -o doc.docx doc.md. Warnings disappear and dollar amounts render literally.

No signals yet