How to extract formulas from documents: step-by-step method
Select the extraction path according to the type of document where the formula is located (Word, text PDF, scanned document, LaTeX source code), turn the formula into an editable Word formula or LaTeX code, and provide an item-by-item verification method.
Key points of this article
- First determine the source of the formula: Word formula object, text PDF, scanned image or LaTeX source code. The extraction methods in the four cases are different.
- When there is a source file, priority is given to the source code or formula object. The structure is complete and there is no need to rely on identification.
- The scanned document must be OCRed first, and the recognition result must be compared with the original text one by one. Symbols, superscripts and subscripts are prone to errors.
- If you want LaTeX code, you can process the Word file in UniDoc web editor and then export the LaTeX source code and check it again.
- After the extraction is completed, check the completeness of the formula, superscripts and subscripts, symbols and numbers to confirm that it is an editable object and not a picture.
When writing papers, making courseware, or organizing technical reports, it is often necessary to move the formulas in the document to another place for continued use. Direct copying often results in garbled characters, a string of ordinary characters, or a picture that cannot be modified. This article is written for readers who need to extract formulas and modify them later, such as putting formulas in PDF papers into LaTeX manuscripts, or changing formulas in Word files sent by others to another format.
After reading this article, you can first determine which source the formula in your hand belongs to, then select the corresponding extraction path, and finally use a set of checking methods to confirm that the results are available. The key to how to extract formulas from documents is not to find which tool, but to first see clearly how the formulas are stored. The following content does not compare specific software, but only talks about general judgment and operation.
How to get the document extraction formula? One sentence conclusion
The extraction method depends on where the formula is originally stored. Different sources have different structures that can be retained. The table below gives recommended practices for common situations.
| your situation | Recommended practices | reason |
|---|---|---|
| Formulas in Word files can be selected with one click and displayed as formula boxes. | Directly copy the formula object and paste it into the target document | The formula itself is a structured object and can still be edited after copying. |
| PDF file, able to select text and symbols in formulas | First try to copy a small paragraph, confirm it is correct, and then batch process it. If necessary, export it to Word and check again. | The text layer exists, but the formula structure may be lost when copying |
| Scanned PDF or photo, text cannot be selected | Do OCR recognition first, and then check the formulas one by one. | There is no text layer and can only be restored by recognition, requiring manual proofreading. |
| Have LaTeX source code package (.tex file) in hand | Get the formula code directly from the source file | The formula code itself is LaTeX, with a complete structure and no need to identify |
The judgment criteria are very simple: whether it can be selected, whether the formula box can appear when clicked, and whether there is a source file. The answers to these three questions determine which line of work you go into.
Before you start: Confirm these points first
Taking two minutes to make a judgment before taking action can save you a lot of detours.
- Storage form of formula. If it is a Word formula object, a formula editing box will appear after clicking; if it is a picture, clicking will only select an entire area. This determines whether the structure can be copied directly.
- Whether the document is text or scanned. Try using the mouse to select a piece of text in the text. If it can be selected, it is a text-based PDF; if it cannot be selected, it is usually a scanned copy or picture. The scanned document needs to be OCRed first.
- Number and complexity of formulas. In a 30-page paper, there may be only a dozen formulas, or there may be hundreds. When the quantity is large, a unified output format should be determined first to avoid inconsistency.
- End use. If you use a LaTeX template for submission, you should output the LaTeX code; if you continue to write in a Word report, you should retain the Word formula objects. If you choose the wrong format, you will have to redo it later.
- Whether there is a source file. If the author or colleague can provide the original .tex or .docx, give priority to the original, which is more reliable than inferring from PDF.
Steps to extract formulas from scanned PDF and convert them to editable format
This is an error-prone situation. The following steps use scanned documents as an example. If your file is text, you can skip the OCR step.
- Confirm the file type. Open the PDF and select a piece of text. If it is not selected, it means there is no text layer and OCR is required.
- Open the desktop client. Download and install the OmniDoc desktop client (supports Windows, macOS, and Linux) at download.omnidoc.top and use it to open PDFs.
- Perform OCR on the scan. Use the OCR function in the PDF editor to generate a text layer for the page. After this step, the formula area will become recognizable text and symbols.
- Check the formulas page by page. Check the symbols, superscripts and brackets of each formula against the original page. If you find an error, modify the text of the corresponding paragraph directly in the PDF editor.
- Export to Word. Export the proofread file to Word format. After exporting, whether the formula remains as an editable object needs to be checked in the next step.
- Check formula objects in Word. Click on each formula to see if it appears as a formula box. If it is not a formula box, but just ordinary text or pictures, re-enter them manually in Word.
- Import into UniDoc web editor. Open app.unidoc.top, import the Word file, and check the rendering effect of the formulas one by one. UniDoc supports formula editing and can convert back and forth between Word and LaTeX.
- Export LaTeX source code. After confirming that the formula is correct, export the LaTeX source code and compile it again using the local LaTeX compilation environment or manuscript template to see whether the formula rendering is consistent with the original text.
Check each item after completion
The results extracted by the formula cannot be used just at a glance. The table below lists common inspection items.
| Check items | How to see | What to do if there is a problem |
|---|---|---|
| Is the formula complete? | Count the number of formulas page by page according to the original text page number, and compare it with the extraction results | Re-enter the missing formula using a screenshot of the original page |
| Superscript and subscript, fractions, upper and lower limits of integrals | After rendering, compare side by side with the original text, focusing on hierarchical relationships. | Adjust braces in LaTeX or correct structure in the Word formula box |
| Confusing characters | Check the letter l and the number 1, the letter O and the number 0, the minus sign and the hyphen, the Greek letters | Corrections are made one by one against the original text, and the OCR results cannot be directly regarded as correct. |
| Numbering and citation | Check whether the formula numbers are consecutive and whether the text reference points to the correct number | Check labels and citation commands in LaTeX and number fields in Word |
| Editability | Click or double-click the formula to make sure it is a formula object or LaTeX code and not a picture | Formulas in the form of pictures need to be re-entered and cannot be replaced by just taking screenshots. |
It should be noted that errors may occur in machine recognition and format conversion. All formulas used in papers, reports or formal materials should be checked manually one by one, and the recognition results cannot be relied upon alone.
❓ Frequently Asked Questions (FAQ)
1. Why does the copied and pasted formula become garbled?
Formulas in PDF are usually composed of multiple small fragments, and the character order and font information are easily confused when copied. Pasting directly into the text box will lose superscripts, subscripts and fractional structures. A safer approach is to confirm the file type first, and then export or re-import it as described above.
2. Can the scanned formulas be directly converted into LaTeX?
You can do OCR first and then organize it into LaTeX code, but you cannot skip manual proofreading. The scanned document does not have original structural information, and the recognition results need to be compared with the original page one by one, especially checking the superscripts and subscripts and symbols.
3. Can Word formulas and LaTeX formulas be converted to each other?
Yes, but you need to check after conversion. UniDoc web editor supports round-trip conversion between Word and LaTeX. After conversion, you still need to render and check one by one to confirm that the structure has not changed.
4. What should we pay attention to when using free formula extraction tools?
When choosing an online conversion website or other free tool, you can first look at a few things: file size limits, whether the exported results are watermarked, how the files are processed after uploading, and whether formulas and layout are retained. For sensitive or unpublished manuscripts, you must first confirm the privacy terms before deciding whether to upload them.
5. Do I need to change the format after extracting the formula?
Usually not required. The point of formula extraction is to keep the formula itself correct and editable. Layout adjustments should be made according to the template of the target document and checked separately after export.
📝 Summary
How to extract formulas from documents, the core is to first look at the source of the formula, and then select the corresponding path: if there is a source file, take the source code or formula object, do OCR on the scanned document and then check it one by one. No matter which method is used, check the completeness, superscripts and subscripts, easily confused characters and numbers after extraction, and confirm that the formula is an editable object.
Open OmniDoc and edit, convert or translate your LaTeX document


