New Tool Radar

OCR & Text Layers

How to Check Superscripts and Subscripts in a Scanned PDF After OCR

Check whether superscripts and subscripts in a scanned PDF survive OCR, so a squared value does not become a plain number.

Schematic illustration of a scanned PDF with a formula: after OCR the raised 2 in the squared value and the lowered 2 in H2O are both present in the text layer.

A raised 2 turns an area into a length if OCR flattens it, and a lowered letter can vanish entirely. Tesseract’s manual notes that recognition depends on the character set selected, and Adobe’s guide warns that a number recognised correctly can still end up separated from what gave it meaning.

Use the practice file

A practice document, practice-formulas.pdf. The file is fictional.

Page Content
1 Formula with x squared, written as x with a raised 2
2 Chemical formula H with a lowered 2 and O, reading “H2O”
3 Plain paragraph, no raised or lowered characters

Page 1 is the check page: the formula reads “Area = 12 m squared”.

Check the raised and lowered characters

Expected result. We checked the Tesseract manual and the Adobe Acrobat. We did not run any tool. The checks below are what to expect if the work is done correctly; run them yourself on the practice file.

1. Select the squared value

Drag across “12 m” and the raised 2 on page 1.

Expected result: The value highlights; the raised 2 is present in the selection, not dropped.

2. Copy the formula

Copy the formula line and paste it into a text file.

Expected result: The pasted text contains the value 12 and a 2; check whether the 2 is still raised or has become a plain 2.

3. Select the chemical formula

Drag across “H2O” on page 2.

Expected result: “H2O” highlights as one token, with the 2 present.

4. Search for the plain number

Use Find for “12”.

Expected result: 1 hit, on page 1, at the formula — not a second stray 12 created from the raised 2.

Verdict table

Check Expected result Pass?
Select the squared value The value highlights; the raised 2 is present in the selection, not dropped. —
Copy the formula The pasted text contains the value 12 and a 2; check whether the 2 is still raised or has become a plain 2. —
Select the chemical formula “H2O” highlights as one token, with the 2 present. —
Search for the plain number 1 hit, on page 1, at the formula — not a second stray 12 created from the raised 2. —

Related guides: How to Use OCR Confidence Scores to Target Proofreading — How to Add a Searchable Text Layer to a Scanned PDF.

Limits

  • OCR commonly flattens raised and lowered characters onto the baseline, so a superscript 2 can look correct while meaning something different; compare against the scan, not just the spelling.
  • OCR does not repair a bad scan: blur, skew and low contrast still produce errors, so check the words that matter against the visible page.
  • UNTESTED — no OCR tool was run; all results above are expected results. The practice file is fictional.

Sources

See all