PDF to LaTeX Converter — Extract Equations, Tables & Text
Learn how to convert PDF to LaTeX format. Extract equations, tables, and formatted text from PDFs into editable LaTeX code.
Converting a PDF to LaTeX is one of those tasks that sounds niche until you actually need it. Researchers who want to republish a paper, students reconstructing lecture notes, or anyone trying to extract mathematical equations from a PDF — at some point, you need to go from a fixed PDF back to editable LaTeX source code. It's not a simple conversion (PDFs don't store structure), but with the right tools, it's absolutely doable.
Why Convert PDF to LaTeX?
LaTeX is the standard for academic and scientific publishing. If you have a PDF containing equations, formatted tables, or structured academic content and you need to edit or repurpose it, you need the LaTeX source — not just the rendered output. Common scenarios:
- Revising a published paper when you've lost the original .tex files
- Extracting equations from a paper to use in your own document
- Reconstructing lecture notes from PDF handouts into editable LaTeX
- Translating academic content — easier to work with LaTeX source than edit a PDF
- Archiving or migrating content between LaTeX document systems
The Challenge: PDFs Don't Store LaTeX
Here's the thing: a PDF doesn't contain LaTeX code. When you compile a LaTeX document, the output is a formatted PDF — the equations become rendered graphics, the structure becomes layout. Going backwards requires either:
- OCR (Optical Character Recognition) specialized for math and structured content
- Text extraction combined with pattern recognition for equations
- Manual reconstruction (slow but precise)
No tool gives you a perfect 1:1 conversion. Expect to clean up the output. But modern OCR tools have gotten shockingly good at extracting LaTeX, especially for mathematical content.
Method 1: Mathpix — The Gold Standard for Math OCR
Mathpix is purpose-built for converting mathematical content from PDFs (and images) into LaTeX. It's the best tool available for this job, period.
How it works:
- Download Mathpix Snip (available for Windows, Mac, Linux, iOS, Android)
- Open your PDF and select the equation, table, or text you want to convert
- Mathpix recognizes the content and outputs clean LaTeX code
- Copy the LaTeX and paste it into your editor
What Mathpix handles well:
- Mathematical equations (inline and display)
- Matrices and arrays
- Chemical equations
- Tables with structured data
- Multi-line derivations
Mathpix offers a free tier (limited snips per month) and paid plans. For occasional use, the free tier is usually enough. For heavy academic work, a subscription pays for itself quickly in time saved.
The accuracy is impressive — Mathpix correctly converts even complex multi-line equations, integrals, summations, and matrices that would take minutes to type by hand. It's not perfect (expect minor errors on unusual notation), but it's the closest thing to magic for this task.
Method 2: Online PDF to LaTeX Converters
Several web-based tools attempt full PDF-to-LaTeX conversion. These try to reconstruct the entire document structure, not just individual equations.
Popular options:
- LaTeX OCR Online (latexocr.com): Free, browser-based. Good for individual equations. Screenshot the equation, upload, get LaTeX.
- SimpleTex (simpletex.cn): Free OCR tool for math. Supports batch conversion of multiple equations from a single PDF page.
- TableConvert: Specialized for converting PDF tables to LaTeX tabular format.
For full-document conversion (entire PDF to a .tex file), the results are mixed. These tools can extract text and identify some structure, but complex formatting usually requires manual cleanup. Think of them as a starting point, not a finished product.
Method 3: Extract Text from PDF, Then Manually Add LaTeX
For documents that are mostly text with occasional equations, sometimes the most practical approach is:
- Extract the plain text from the PDF using a PDF-to-text converter
- Open the text in your LaTeX editor
- Manually add LaTeX formatting and equations where needed
This sounds tedious, but for text-heavy documents it's often faster than trying to fix a bad automatic conversion. You get clean text to start with, and you only need to LaTeX-ify the equations and special formatting.
Tools for text extraction:
- pdftotext (command-line tool, part of poppler-utils): pdftotext input.pdf output.txt
- Online PDF-to-text converters: Upload PDF, download plain text
- Python with PyPDF2 or pdfplumber: For batch processing multiple PDFs
Method 4: Use OCR for Scanned PDFs
If your PDF is a scanned document (image-based, not text-based), standard text extraction won't work. You need OCR first.
For equations: Use Mathpix — it handles scanned content well, including handwritten equations in many cases.
For general text:
- Run OCR on the PDF (Google Drive works: upload, open as Google Doc)
- Copy the extracted text into your LaTeX editor
- Add LaTeX formatting and equations manually
Scanned documents are the hardest case for PDF-to-LaTeX conversion. The OCR has to interpret both the text and the mathematical notation from an image. Mathpix is your best bet for the math parts; general OCR handles the surrounding text.
Method 5: Manual Conversion Tips (When Tools Fall Short)
Sometimes automatic conversion doesn't cut it, especially for heavily formatted academic papers with custom commands, complex environments, or unusual notation. Here are tips for efficient manual conversion:
- Set up a template first: Create a LaTeX document with the document class, packages, and preamble you need before you start pasting content
- Work section by section: Don't try to convert the whole document at once. Tackle one section, verify it compiles, then move on
- Use Mathpix for individual equations: Even if you're doing the text manually, Mathpix saves enormous time on equations
- Keep the PDF open side by side: Reference the original as you go to catch formatting details
- Use a LaTeX editor with live preview: Overleaf, TeXstudio, or VS Code with LaTeX Workshop — seeing the rendered output as you type catches errors immediately
- Copy the bibliography format: If the original paper has citations, recreate the .bib file rather than typing each reference
What About Tables?
Tables deserve special mention because they're a pain to convert manually. LaTeX tables require specific syntax (tabular environments, column specifications, alignment).
Options:
- Mathpix: Handles table recognition and outputs LaTeX tabular code
- TableConvert.com: Paste table data (or upload), choose LaTeX as output format
- Excel to LaTeX: If you can copy the table data into Excel first, there are plugins that convert Excel ranges to LaTeX tables
- Manual with a generator: Use an online LaTeX table generator (like tablesgenerator.com) — paste your data, customize formatting, copy the output
For simple tables, the online generators are faster than Mathpix. For complex tables with merged cells, spanning rows, or special formatting, expect to do some manual adjustment regardless of which tool you start with.
Quality Checklist After Conversion
Whatever method you use, always verify the output:
- Compile the .tex file and compare with the original PDF
- Check all equations — missing symbols, wrong operators, and flipped fractions are common
- Verify special characters — Greek letters, subscripts, superscripts
- Check table alignment — columns should match the original
- Proofread text — OCR errors, missing words, broken sentences
- Verify references and citations — numbering should match
Which Approach Should You Use?
Quick answer:
- Need to extract equations? Mathpix. End of discussion.
- Converting a full academic paper? Start with text extraction, use Mathpix for equations, manual cleanup for everything else
- Just need a few formulas? Any free OCR math tool works — LaTeX OCR Online or SimpleTex
- Scanned PDF? Mathpix for equations, general OCR for text
- Tables specifically? TableConvert or Mathpix, then manual formatting
Don't expect a one-click solution. PDF to LaTeX conversion is inherently messy because you're reverse-engineering compiled output. But with the right combination of tools and a bit of patience, you can reconstruct even complex documents.