From Markdown to LaTeX: Convert & Publish Sci Docs
By Shihab Shahriar Antor · Updated June 2026 · 5 min read
Convert Markdown to LaTeX with Pandoc: run pandoc input.md -o output.tex to get LaTeX source, or pandoc input.md -o output.pdf to go straight to PDF. Pandoc handles headings, lists, math, and citations. Then refine the .tex in LetX. Adjust the document class, fix figures, and compile to a polished PDF with real-time collaboration.
Why convert Markdown to LaTeX
Markdown is fast for drafting; LaTeX gives publication-grade output. Pandoc bridges them, you draft in Markdown, convert to LaTeX, then refine the details (document class, figure placement, citation style) that Markdown can’t express.
Pandoc command reference
| Goal | Command |
|---|---|
| Markdown → LaTeX source | pandoc in.md -o out.tex |
| Markdown → PDF (via LaTeX) | pandoc in.md -o out.pdf |
| Standalone document | pandoc -s in.md -o out.tex |
| With citations | pandoc --citeproc --bibliography=refs.bib |
| Specific class | pandoc -V documentclass=report |
# Standalone LaTeX from Markdown, with citations
pandoc -s paper.md \
--citeproc \
--bibliography=references.bib \
-o paper.texWhat converts cleanly: and what needs work
| Element | Pandoc result |
|---|---|
| Headings → sections | Clean |
| Lists, bold, links | Clean |
| Math ($...$) | Preserved |
| Citations [@key] | Converted with --citeproc |
| Figure placement | Needs manual tuning |
| Custom layout | Add LaTeX by hand |
Markdown math written with $...$ and $$...$$ carries over to LaTeX directly, so equations survive the conversion.
Refine and compile in LetX
After conversion, the .tex usually needs polishing. Pick a proper document class and structure, place figures, and set the citation style. Paste it into LetX and compile online in seconds, refine with co-authors in real time, no install.
Refine your converted LaTeX and compile, free.
Open LetX FreeFrequently asked questions
How do I convert Markdown to LaTeX?
Use Pandoc: run pandoc input.md -o output.tex to produce LaTeX source, or pandoc input.md -o output.pdf to go straight to PDF. Add -s for a standalone document and --citeproc with --bibliography for citations.
Does Pandoc preserve math when converting to LaTeX?
Yes. Markdown math written with $...$ for inline and $$...$$ for display converts directly to LaTeX math, so equations survive the conversion intact.
How do I handle citations when converting Markdown to LaTeX?
Write citations as [@key] in Markdown and run Pandoc with --citeproc --bibliography=references.bib. Pandoc resolves them into a formatted bibliography in the LaTeX output.
Why does my converted LaTeX need editing?
Pandoc converts structure and text faithfully, but layout details (figure placement, document class, and citation style), usually need manual tuning. Refine the .tex in an editor like LetX and compile to a polished PDF.
Related
Written by Shihab Shahriar Antor , AI Engineer & Founder of Shahriar Labs. Builder of LetX (collaborative LaTeX) and QuantumSketch (AI STEM video).
