Can the equations in a PDF be converted to LaTeX, and how accurate is it?

By the Osmanth team at Osmanth Docs · Published 2026-10-13

Mostly yes, but you have to proofread the result. On 2026-10-13 we ran an 8-page excerpt of a real research paper through PDF Equations to LaTeX. It returned six equations. Four matched the paper. One had a missing bracket and was flagged. One read "head" as "l" and was not flagged.

What did we test?

The file is an 8-page excerpt of the paper "Attention Is All You Need", taken from arXiv (version 7 of the paper is dated 2 August 2023). We chose a real paper rather than a sample we made ourselves because real equations are set in the way people actually typeset them. We uploaded the file to PDF Equations to LaTeX on osmanthdocs.com. Processing took 34 seconds. The result was labelled "Review recommended", with the note "Formula(s) 2, 5 may not have been recognised correctly."

To check the results, we compared each one with the text layer of the PDF, which holds the characters the authors typeset. Then we gave all six to KaTeX (version 0.16.11 on our machine), a LaTeX maths renderer, to see whether each one parses.

Result Page What we found Flagged by the tool?
1: attention formula 4 Matches the paper No
2: multi-head formula 5 The last closing bracket of the second line is missing Yes
3: the same second line again 5 "head" with a subscript was read as "l" with a subscript No
4: feed-forward formula 5 Matches the paper No
5: positional encoding 6 Content matches. "sin" and "cos" are set as three separate italic letters rather than as function names Yes
6: learning-rate formula 7 Content matches. "lrate" and "step_num" are set as separate italic letters No

All six parsed in KaTeX. That does not mean they were correct. Result 2 parses with its missing bracket, because a bracket is not something a parser requires to be matched.

What does the output look like?

You get a .tex file and a JSON file. The .tex file opens with \documentclass{article} and loads amsmath, amssymb and amsfonts. Each equation sits in an equation* block with a comment giving its number and page, and a REVIEW comment when the tool had doubts. Spaces appear between letters, as in \operatorname { A t t e n t i o n }. We did not compile the file with a LaTeX installation, so we cannot say how it looks on paper. The commands it uses, \operatorname, \operatorname*, \begin{aligned}, \mathsf, \mathrm, \frac and \sqrt, are all in KaTeX's list of supported functions. The file loads amsmath, which CTAN lists at version 2.17z dated 2025-07-09. Compile it in your own LaTeX setup before relying on it.

Note also that the tool numbers its results 1 to 6 in the order it found them. These numbers are not the paper's own equation numbers, so a result labelled (3) is not the paper's equation (3).

What went wrong, and what does it mean for you?

  • A wrong result can come without a warning. Result 3 swapped "head" for "l". Nothing in the file marks it. A flagged result was right to be flagged, since result 2 really was missing a bracket, but the flag list did not catch everything.
  • A missing bracket is easy to overlook. The shape of the formula is right and it parses, so only reading it against the page shows the problem.
  • Function names may need fixing. If you use the file in a document, you may want \sin and \cos in place of the letters s i n and c o s.
  • One line can come back twice. Results 2 and 3 both contain the same line of the paper. The REVIEW comment on result 2 reads formula_suspect:repetition.

What should I check after converting?

  1. Open the page next to the .tex file and read each equation against it, symbol by symbol, starting with the ones marked REVIEW.
  2. Count the brackets in each long formula.
  3. Check each subscript and superscript, since a letter that looks like another one is the easiest misreading.
  4. Look for the same line appearing twice under two numbers.
  5. If an equation matters, retype it. The tool saves typing, and it does not replace proofreading.

What are the limits?

This is one paper and six equations, so it tells you how the tool behaved here, not how often it will be right on your file. We did not test scanned pages, handwriting or equations that are pictures.

The tool processes your file on our server with open-source software, and the result is available for 60 minutes. For the rest of the document, see why a PDF loses its headings and lists and how to give a PDF to ChatGPT or Claude.

Sources

  1. KaTeX documentation: Supported Functions (page shows version v0.19.0 and no date, checked 2026-10-13)
  2. CTAN: amsmath package page (version 2.17z, dated 2025-07-09, checked 2026-10-13)
  3. arXiv: abstract page of the paper used as our test file (version 7 dated 2 August 2023, checked 2026-10-13)

More guides