PDF to LaTeX for free, tested
1,047 of 1,237
formulas exact with Marker in balanced mode
On arXiv? Download the source
No tool beats the authors' own LaTeX. arXiv rejects most PDFs made from LaTeX, so LaTeX papers there usually have their source.
curl -L -o paper.tar.gz https://arxiv.org/src/2611.18250
mkdir paper && tar -xzf paper.tar.gz -C paper
Check the license on the abstract page before you reuse it. Most papers use arXiv's own non-exclusive license, which gives you no reuse rights.
Not on arXiv? Marker, then pandoc
Marker reads the PDF into Markdown with LaTeX math. Pandoc turns that into a .tex file.
pip install marker-pdf
brew install llama.cpp pandoc tectonic
marker_single paper.pdf --mode balanced --output_dir out
cd out/paper
pandoc -s paper.md -o paper.tex
tectonic paper.tex
Do not skip --mode balanced. On a Mac, Marker runs fast
mode by default, and fast mode got 39 of 156 display formulas exact.
Balanced mode sends the math to a vision model through llama.cpp. It took about 22 s a page on our Mac.
Marker's code is Apache 2.0. Its model weights are free for personal use, research, and companies under $5M in revenue or funding.
Formulas exact, by tool
| Tool | Display, of 156 | Inline, of 1,081 |
|---|---|---|
| Marker, balanced | 89 | 958 |
| Marker, fast (Mac default) | 39 | 273 |
| MinerU | 100 | 514 |
| Pix2Text | 98 | 678 |
Docling --to latex |
0 | 0 |
MinerU got the most display formulas right. But it wrote one-letter math, like x, as plain text. It kept 2 of 166 as math.
Pix2Text was close to MinerU, but it took about 106 s a page.
PP-StructureV3 took about 13 min a page, so it read only 2 papers by our deadline.
On those papers it got 31 of 67 display formulas. Marker in balanced mode got 46.
Will the .tex compile?
| Tool | Compiled, of 5 | TeX errors |
|---|---|---|
| Marker, balanced | 4 | 1 |
| Marker, fast | 0 | 65 |
| MinerU | 4 | 6 |
| Pix2Text | 3 | 4 |
Docling --to latex |
5 | 0 |
Docling compiled all 5 because it left out the math. All 156 display
formulas became a comment:
% formula-not-decoded.
With --enrich-formula it read the math, at about 28 min a
page. It got 6 of 25 on one paper, and its .tex lacked amsmath.
Marker left one \mathbb outside math, in a table cell.
MinerU used \coloneqq without mathtools and gave 5
formulas 2 tags each.
With the figures kept, Marker compiled 3 of 5. One figure was an empty image link.
PDF to Overleaf
Overleaf can not open a PDF as LaTeX. It imports a .zip project, a Word file or a Markdown file.
So import Marker's paper.md as a Markdown document. Overleaf runs Pandoc on it. For the figures too, zip paper.tex with its images.
Need only the text? Our Actor
Our Apify Actor returns Markdown, not LaTeX. It found 10,132 of 10,799 words in order, but no formulas.
Pages with a text layer are free, like all 34 test pages. A scanned page costs $0.006, and each run has a $0.00005 start fee.
curl -s -X POST "https://api.apify.com/v2/acts/brasspage~pdf-ocr-to-markdown/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documentUrls": ["https://example.com/paper.pdf"]}' \
| jq -r '.[].markdown' > paper.md
How I tested it
- Papers: 5 arXiv papers under CC BY 4.0, in math, quantum physics, information theory and statistics. 3 of the 5 are two-column.
- The truth: each paper's own LaTeX source, read with pandoc, which expands the authors' macros. Reference lists left out.
- Display: each true formula paired with the most alike formula in the output. Exact means the same TeX after cleanup (spaces, braces, labels, sizes), or MathJax draws both the same.
- Inline: the same TeX anywhere in the output math.
- Each tool's own command and defaults. MinerU ran locally, standard tier. Pix2Text used its free models.
- MinerU's own LaTeX export (its Python API, not the CLI) scored like its Markdown: 100 display formulas, the same failed paper.
- marker-pdf 2.2.0 with llama.cpp b12316, mineru 4.2.3, pix2text 1.1.7.
- docling 2.143.1, PaddleOCR 3.7.0 (2 threads), pandoc 3.13.
- tectonic 0.17.0, MathJax 3.2.1.
- One Apple M5 Max Mac. Other jobs ran at the same time, so the times are rough.
- Not tested: scanned papers, Nougat (its weights are non-commercial), Mathpix (10 free PDF pages a month, then paid), the Overleaf import.
Questions people ask
Can pandoc convert a PDF to LaTeX?
No. Pandoc can write a PDF, but it can not read one: pandoc 3.13 stops with Unknown input format 'pdf'. Turn the PDF into Markdown with Marker first, then run pandoc -s paper.md -o paper.tex.
What is the best free PDF to LaTeX converter?
In our test, Marker in balanced mode. It got 1,047 of 1,237 formulas exact on 5 arXiv papers. If the paper is on arXiv, download the authors' own source instead.
Can Overleaf convert a PDF to LaTeX?
No. Overleaf imports a .zip project, a Word file or a Markdown file, not a PDF. Turn the PDF into Markdown with Marker, then import the .md file.
Related guides
- PDF to BibTeX for free: GROBID and 4 more ways on 8 papers
- Image to LaTeX: 6 free tools tested on 40 formulas
- Docling vs Marker vs MinerU: tested on the same PDFs
- Marker OCR for scanned PDFs: setup and results, tested
- MinerU on a Mac: setup and a scanned PDF test
- Pix2Text OCR: the install fix, tested on scans and math
- PDF to Markdown in Python: 5 libraries tested (2026)