Using LaTeX with Markdown
LaTeX sets a page beautifully and is tiring to write in. Markdown is pleasant to write in and can’t set a page. So a lot of academics now draft in Markdown and bring LaTeX in at the end, for the journal’s template. Here’s how the two fit together, and how Grasmere does it on a Mac.
Markdown or LaTeX?
You don’t have to choose one for everything. They’re good at different halves of the job.
| Markdown | LaTeX | |
|---|---|---|
| Writing prose | Reads like the text itself. A few marks for headings, emphasis and lists. | Commands and braces among the words. |
| Maths | None of its own. Most tools borrow LaTeX’s, between dollar signs. | The standard. |
| Typesetting | Left to whatever you export with. | Precise control of the page. |
| Journal templates | Rare. | Most journals in the sciences publish one. |
| Review by people who use Word | Converts to Word well. | Awkward. |
| When something breaks | There’s nothing to compile. | A missing brace stops the build. |
If your work is mostly equations, write in LaTeX. If it’s mostly prose with citations, footnotes and the odd table, draft in Markdown and let LaTeX do the page at the end.
The usual way: Pandoc
Pandoc converts Markdown to LaTeX and pours it into a template. Citations written as [@key] become \cite commands.
pandoc paper.md --template journal.tex --natbib --bibliography refs.bib -o paper.tex
It’s dependable and endlessly adjustable. It’s also a command line, a template language and a set of flags to keep straight for each paper.
Publish LaTeX from Grasmere
New in 1.6. Grasmere’s Publish stage has LaTeX beside Word. Choose a folder and a template, and Grasmere writes three things into it.
Title.tex, your paper or your chapters in the template you chose.Title.bib, the sources you cited and no others, each under its citation key.figures/, with the pictures and diagrams.
Open the folder in TeXShop, or upload it to Overleaf, and compile it there. Grasmere writes the LaTeX and leaves the compiling to them.
What your Markdown becomes
Headings, emphasis, lists, tables, block quotes and footnotes become LaTeX’s own. A picture becomes a figure, with its alt text as the caption. A Mermaid diagram becomes a figure too. Code is set verbatim. A citation becomes \cite[p.~35]{key}, page and all.
Maths written between dollar signs passes through exactly as you typed it, for LaTeX to set. Everything else that LaTeX would take for a command is escaped.
Templates, yours or the journal’s
Grasmere has three templates built in, called Article, Report and Thesis. Project ▸ Add LaTeX Template copies one into your project as an ordinary .tex file, which is then yours to edit.
A journal’s own template works as well. Put its .tex in the project, with its class files, and mark where the text goes with $body$.
\documentclass{article}
\title{$title$}
\author{$author$}
\begin{document}
\maketitle
\begin{abstract}
$abstract$
\end{abstract}
$body$
\bibliographystyle{plain}
\bibliography{$bibliography$}
\end{document}
These are Pandoc’s slots, so a Pandoc LaTeX template works as it is. The title, author, abstract and keywords come from the front matter at the top of your document. Everything else in the file is left as the journal wrote it.
Your .bib file works already
If you’ve been writing LaTeX, you have a .bib file. Project ▸ Import Sources reads it, and each entry becomes a source in your project that you can cite by typing [@. The keys are kept, so the .bib Grasmere writes at the end uses the keys you know.
A draft that already cites with Pandoc’s [@key] can be converted in one step, with Project ▸ Convert Pandoc Citations.
When you don’t need LaTeX at all
Plenty of writing only needs a clean PDF or a Word file. Grasmere typesets both itself, with a contents page, footnotes at the foot of the page, and citations and references in APA, Harvard, Chicago or MLA. Nothing has to be installed. See Markdown to PDF on a Mac.
And when a co-author wants to mark up a draft, send Word. Their tracked changes come back into your Markdown. See Markdown to Word, and back again.
What Grasmere doesn’t do
- Compile or preview LaTeX. That’s Overleaf’s or TeXShop’s job.
- Bring changes made in the
.texback into your Markdown. Edit the Markdown and publish again. - Copy a template’s class files into the folder for you.
Questions
Do I need TeX installed on my Mac?
Only to compile there. Overleaf compiles in the browser, so you can upload the folder and install nothing.
Can I edit a template in Grasmere?
Yes. A .tex file in the project is listed in the contents and opens as plain text, with its commands coloured.
Which citation commands are written?
Plain \cite, with the page as its optional argument. The template’s bibliography style decides how they look, so numbered styles are the template’s to give.
Draft in Markdown. Typeset in LaTeX.
Import your .bib, write the paper, and publish a .tex in your journal’s template. The trial is free for 14 days.
Download for macOS Free for 14 days, then $14.99 once · macOS 26+