# all·markdown

Markdown to LaTeX

This is one conversion that does not happen in a browser, here or anywhere else worth trusting. It needs Pandoc — one command, and it is the right tool. What follows is that command, what survives it, and the question worth asking first: whether you need LaTeX at all.

Edit this — the preview is Markdown, the table below says what each part becomes

Result

Open the full editor Runs in this tab — nothing is uploaded.

The command

pandoc input.md -o output.tex

That produces a LaTeX fragment. For a complete compilable document with a preamble, add --standalone:

pandoc input.md --standalone -o output.tex
pandoc input.md --standalone --template=journal.tex -o output.tex
pandoc input.md --citeproc --bibliography=refs.bib -o output.tex

The template flag is usually the whole point. Write in Markdown, render into whatever preamble a publisher or a university insists on, and never hand-edit a .tex file again.

Why no browser tool does this

Converting to Markdown is forgiving: worst case you get slightly wrong text, and you fix it. Converting to LaTeX is not — the output has to compile. That means handling the preamble, package requirements, character escaping for a dozen reserved characters, maths parsing, float placement and template variables.

A page that produced .tex which failed to compile would waste more time than it saved, so this one does not pretend. Pandoc has solved this properly for fifteen years and is a single install.

What each element becomes

MarkdownLaTeX
# Heading\section{}, \subsection{}
**bold**\textbf{}
*italic*\emph{}
- itemitemize
1. itemenumerate
> quotequote
fenced codeverbatim, or listings with a flag
pipe tablelongtable or tabular
$E = mc^2$Passed through untouched
[^1] footnote\footnote{}

Maths is the row that matters. Pandoc leaves dollar-delimited maths alone, so an equation written in Markdown arrives in LaTeX as the same equation — which is why writing a paper in Markdown is viable at all.

The question worth asking first

A large share of people converting Markdown to LaTeX want a typeset PDF, and LaTeX is the route they know rather than the shortest one.

What you needShortest route
A PDF of an ordinary documentExport from here — nothing to install
A PDF that looks typesetpandoc in.md -o out.pdf — Pandoc runs LaTeX for you
A journal or thesis template--template, and you do need the .tex
Heavy maths, cross-references, a bibliographyLaTeX properly
To edit the .tex by hand afterwardsConvert, and expect to tidy

Rows one and two cover most of it. Pandoc's direct-to-PDF path still uses LaTeX underneath — you simply never see the .tex, which is usually an improvement.

Writing for both

A Markdown document that converts cleanly is one that stays close to standard syntax. Raw HTML has no LaTeX equivalent and gets dropped, so anything using <details> or an align attribute loses it. Reference-style links convert fine. Images need a real file at the path, because LaTeX cannot fetch a URL at compile time.

YAML front matter is read as document metadata — title, author, date — and passed to the template, so the same block that drives a static site drives the title page.

Common questions

How do I convert Markdown to LaTeX?
Pandoc: `pandoc input.md -o output.tex`. There is no browser tool that does this properly, including this one — LaTeX conversion needs a real document model, template handling and a maths parser, and a page that pretended otherwise would produce .tex nobody could compile.
Do I actually need LaTeX?
Often not. If the goal is a PDF that looks typeset, Pandoc can go straight there — and for an ordinary document, a browser PDF is faster and needs nothing installed. LaTeX earns its place when you need real typesetting: journal templates, bibliographies, cross-references, or maths beyond an occasional formula.
What survives the conversion?
Headings become sectioning commands, emphasis becomes textbf and emph, lists become itemize and enumerate, code becomes verbatim, and tables become tabular. Maths in dollar signs passes through untouched, which is the part that matters most.
Can I use a journal or thesis template?
Yes, with `--template`. That is the usual reason to convert at all: write in Markdown, render into a template that a publisher or university requires. Pandoc also accepts a reference .tex file so the preamble stays yours.
What about citations?
Pandoc handles those in the same pass with `--citeproc` and a bibliography file, or passes them to BibTeX with `--natbib`. The second is what most LaTeX workflows expect.
Can I go from LaTeX back to Markdown?
Pandoc does that too — `pandoc paper.tex -o paper.md` — and it is lossier in that direction. Macros, custom environments and anything template-specific have no Markdown equivalent, so expect to tidy the result by hand.