Proofreading a LaTeX table made from a screenshot

OCR can turn a table screenshot into compilable LaTeX, but compiling is not the same as being correct. Check the digits OCR confuses (1 and 7, 0 and 8, 5 and 6), every decimal point, every minus sign and every column count against the source, then run simple arithmetic checks such as row sums. Do this before you cite or bold any number.

Convert a table from a PDF or screenshot →

By TableToLatex · · Examples tested with pdfLaTeX, TeX Live 2023, siunitx 3.3, Python 3

Why a compiled table is not a checked table

A clean compile tells you the LaTeX is valid, not that the numbers are right. OCR reads shapes, and some shapes are close: a 1 and a 7, a 0 and an 8, a decimal point and a comma. The risk is highest in results tables, where one wrong digit changes which method looks best. Treat the converted table as a draft to proof against the source.

The cheapest checks use arithmetic. Row sums, totals, percentages that should reach 100, and averages all break when one digit is wrong. A few lines of code do it for a long table; the numbers below are illustrative.

A sum check for totals and percentages (Python)
def check(name, values, stated, tol=0.05):
    s = sum(values)
    print(f"{name}: sum {s:g}, table says {stated:g}",
          "OK" if abs(s - stated) <= tol else "MISMATCH")

check("Qty", [2, 3], 5)                       # OK
check("Share (%)", [48.2, 30.7, 21.7], 100)   # MISMATCH: 30.1 was read as 30.7

Rounded figures in the source may not add up exactly, so a mismatch of one in the last digit can be the original's rounding. A larger gap is worth a second look.

The LaTeX itself carries signals. A column you expect to be numeric but that comes out left-aligned (l in the column specification) holds at least one cell that was not read as a plain number. In tests of the table-to-LaTeX step, 7l.2, O.5 and a value with a unit produced a left-aligned column, while a decimal comma such as 0,85, a Unicode minus, a bold number and placeholders such as -- or n/a did not, so look for those by eye. An siunitx S column also exposes stray letters: in a test 7l.2 printed with a visible gap. Compile-breaking characters are listed in special characters in tables, and a spreadsheet source is better exported directly.

A seven-step proofreading pass

  1. 1

    Set the source and the PDF side by side

    Zoom both to the same scale and compare one row at a time.

  2. 2

    Count first

    Count the columns, the rows and the header cells against the source. If the output starts with a "% Check these rows" comment, go to the rows it names.

  3. 3

    Read the digits OCR confuses

    Scan for 1 and 7, 0 and 8, and 5 and 6, and for the letters l and O standing in for digits.

  4. 4

    Check decimals

    Match the decimal places in each column to the source. Look for a missing point (1.1 read as 11) and a comma where a point belongs.

  5. 5

    Check the signs

    Compare every negative value with the source. A minus can be read as a hyphen, a dash, or nothing.

  6. 6

    Run the arithmetic

    Add the rows and columns that should add up, recompute averages and percentages, and confirm that the best result really is best.

  7. 7

    Fix, recompile, re-read

    Correct the LaTeX, compile, and read the numbers you will cite or bold once more against the source.

Typical misreads and how to catch them

Looks likeOften read asHow to catch it
1 and 7Each other, or l and ICompare with the source; row sums and totals fail
0 and 8, or OEach other, or the letter OA numeric column that turns out left-aligned
5 and 6Each otherCompare with the source; check row sums
Decimal pointA comma, or lost (1.1 as 11)Same decimals in each row of a column
Minus signA hyphen, an en dash, U+2212, or nothingCompare signs; a U+2212 from the source arrives as a hyphen-minus
Column boundaryMerged or split columns, shifted valuesThe check-rows comment; count cells per row
Footnote markAn extra digit or letter after a valueA value with one digit too many

What goes wrong

  • Trusting a clean compile. Valid LaTeX with a wrong digit is the failure that matters.
  • A comma read as a point. A siunitx column accepts a comma as a decimal marker and prints a point, so the mistake disappears after conversion. Proofread before you format.
  • Shifted columns. A merged cell or a stray mark moves values under the wrong header while the row count still looks right.
  • Bolding a misread winner. Check the numbers before you mark the best result in bold.
  • Low-resolution captures. Small text and thumbnails increase misreads. Recapture at a larger zoom.
  • Flattened headers. Merged header cells come out as one row, so the grouping must be rebuilt by hand.

How TableToLatex helps

TableToLatex recognises the grid in a screenshot, reads the cells by OCR, and writes a booktabs tabular with special characters escaped. It compiles either way, and the correctness of the numbers is yours to confirm against the image. Two outputs help the proofreading: the column alignment letters, and the comment line at the top that names any row whose cell count was padded or truncated. Paste or upload with the image to LaTeX table converter. The table tool is free and runs in your browser. Paste a tab-separated range from a spreadsheet. See pricing.

Questions about checking OCR tables

Can I trust OCR output for a results table?+

The output can compile and still be wrong, because compiling checks syntax, not values. Check every number you will cite against the original table before the manuscript goes out.

Which digits do OCR tools confuse?+

Typically 1 and 7, 0 and 8, and 5 and 6, plus the letters l and O in place of digits. Decimal points and minus signs are the other weak spots.

How do I find one misread number in a long table?+

Use totals and averages first: a wrong digit usually breaks a row sum or a percentage that should reach 100. Then read the other columns against the source.

What screenshot quality gives the best result?+

Crop to the table with a few pixels of margin, and zoom the PDF viewer to 150 to 200 percent before capturing, so the text is at least about 20 pixels tall. A capture of a page thumbnail will not read reliably.

Why is a numeric column left-aligned in the output?+

At least one cell in that column was not read as a plain number, for example a letter in place of a digit, a plus-minus value, a unit after the number or a footnote mark. Placeholders such as --, n/a or an empty cell, bold or italic numbers and a Unicode minus are not counted against the column. Find that cell, then set the alignment yourself.

How do I treat a minus sign from OCR?+

Compare it with the source first. TableToLatex writes a Unicode minus U+2212 from the source as a plain hyphen-minus, which compiles but prints short, so write it as $-0.5$ in maths for a results table. A raw U+2212 left in a .tex file stops pdfLaTeX with "not set up for use with LaTeX".

What if the source is a spreadsheet?+

Export from the spreadsheet instead of reading a picture of it; the Excel guide covers the routes. OCR is for tables that exist only as images or PDFs.

Keep reading

  • Special characters

    Escaping %, &, _, $, # and friends, inline math, and pasted Unicode errors.

  • Decimal alignment

    S columns, table-format, signs and ± without misaligned decimals.

  • Excel to LaTeX

    Export paths from spreadsheets to LaTeX and the pitfalls on each.

Have a table in a spreadsheet? Paste it into the table tool, or see all LaTeX table guides.