Markdown to LaTeX
Editable LaTeX source for XeLaTeX, with Arabic through polyglossia and the Amiri font.
How it works
- Write or paste Markdown in the studio, or send it from a terminal or your agent.
- The md2 engine reads the document once and detects each paragraph's direction.
- A LaTeX (TEX) file is built and downloads right away.
When to use it
- Finish a paper in Overleaf
- University templates that require LaTeX
- Full control over academic typesetting
Right-to-left Arabic
English paragraphs in an Arabic document get an english environment, Latin words \textenglish, and numbers never flip.
Try it now
curl
curl -X POST https://md2.dev/v1/convert \
-H "Content-Type: application/json" \
-d '{"markdown":"# Report\n\nHello from md2","format":"tex"}' \
-o document.tex MCP tool
{
"tool": "convert",
"arguments": {
"markdown": "# Report\n\nHello from md2",
"format": "tex"
}
} Common questions
- How do I compile it?
- Run xelatex document.tex, or upload it to Overleaf and pick XeLaTeX.
- Is my math kept as written?
- Yes, the TeX source passes through unchanged inside \[ \] and $ $.
- Is the output actually compiled?
- Yes, our tests compile every Arabic sample with XeLaTeX on every run.