Utility

Markdown ↔ LaTeX

Convert between Markdown and LaTeX for the common subset: headings, paragraphs, bold/italic, lists, code blocks, links, images, simple tables, inline and block math.

What this tool does — and what it doesn't

The conversion is AST-based and best-effort. Loss-free round-trip is only realistic for the constrained subset listed below — complex documents drift on each pass.

Handled

  • Headings (H1–H5)
  • Paragraphs, bold, italic, strikethrough
  • Inline code and fenced code blocks (with language hint)
  • Bullet and numbered lists, including nesting
  • Links and images
  • Simple GFM tables
  • Inline math ($…$) and block math ($$…$$, \[…\], equation, align)
  • Blockquotes and horizontal rules
  • Mermaid blocks (preserved as lstlisting + a comment explaining how to render externally)

Not handled / will drift

  • Custom LaTeX macros (\newcommand, \def) — args may render but the macro itself is dropped
  • Cross-references (\ref, \label, \cite) and BibTeX
  • TikZ, PGFPlots, and other diagram packages
  • Custom environments not in the supported set
  • Footnotes, sidenotes, marginalia
  • Floats with placement specifiers, exact figure/table numbering
  • Page-layout commands (\newpage, \thispagestyle, custom geometry)
  • Bibliographies, indexes, glossaries
  • Mermaid diagrams are not rendered — only the source is preserved
  • Repeated round-trip editing accumulates drift

For anything beyond the simple subset, treat one format as your source of truth and generate the other on demand — don't use Markdown ↔ LaTeX as a long-term editing workflow.