https://txtfetch.com/docs/equations/
What happens to math?
txtfetch reads the words around an equation well. It does not keep the equation. Here is what comes back for each input, and what to do instead.
The short answer
The standard tier returns plain text. It has no math output. Your equations come back in one of three states: flattened, repeated, or missing.
The worst case is a Word file. Its equations vanish, and the response still says success.
The engine is tika-server-standard 3.3.1 with Tesseract 5.5.2. The OCR languages shipped are eng, osd.
Source: terraform/lambda-layers/build/versions.env (versions.env: TIKA_VERSION, TESSERACT_VERSION, TESSDATA_LANGS), accessed 2026-09-30.
What comes back, case by case
We ran each input through Tika with the same call the API makes. Every row shows its source.
| Input | What comes back | Source |
|---|---|---|
| A Word (.docx) or OpenDocument (.odt) file with an equation | The equation is gone. The text around it stays, and the gap is a double space. The response still says success. | Tika probe: PUT /tika, Accept: text/plainmarketing/test/fixtures/equations/README.md(accessed 2026-09-30) |
| A PDF made by LaTeX | The symbols stay. The layout does not. An exponent joins the line as extra digits. A fraction splits over several short lines. | arXiv 1706.03762v7, the PDF, run through Tika (accessed 2026-09-30) |
| A web page with MathML | Each formula comes back three times. First come the MathML tokens, one per line. Then comes the TeX annotation. Then the image alt text repeats the TeX inline, as [image: …]. The URL route and a saved file gave the same text. | Wikipedia: Softmax function, run through Tika (accessed 2026-09-30) |
| A .tex source file | The file comes back unchanged, as plain text. This is the cleanest input for a paper you can get as source. | Tika probe: PUT /tika, Accept: text/plainmarketing/test/fixtures/equations/README.md(accessed 2026-09-30) |
| A scanned page, or a photo of an equation | We have not measured it. The standard tier ships English and orientation data only. Tesseract lists a separate equ module for math, and we do not ship it. Test your own scans before you rely on them. | Tesseract docs: data files, the optional equ module (accessed 2026-09-30) |
Before and after
Each sample is the real text that came back. On the web page, we removed blank lines and indentation.
A Word (.docx) or OpenDocument (.odt) file with an equation
In
Inline $e^{i\pi}+1=0$ after.Out
Inline after.
A PDF made by LaTeX
In
PE(pos,2i) = sin(pos/10000^{2i/d_model})Out
PE(pos,2i) = sin(pos/100002i/dmodel)
A web page with MathML
In
the interval (0,1)
Out
(
0
,
1
)
{\displaystyle (0,1)}
[image: {\displaystyle (0,1)}], and the components willA .tex source file
In
\[ x = \frac{-b \pm \sqrt{b^2-4ac}}{2a} \]Out
\[ x = \frac{-b \pm \sqrt{b^2-4ac}}{2a} \]How to spot the loss
A response has no flag for lost math. You must look at the text. Three signals catch most cases.
- A Word file returns a double space. Search the text for two spaces in a row. That gap is where an equation was.
- A formula spreads over short lines. A line with one or two characters, next to a lone square-root sign, is a fraction that came apart. See every quality signal the response carries →
- Every formula appears three times. A web page with MathML gives each formula as tokens, then as TeX, then as an inline [image: …] alt text. Keep the {\displaystyle …} lines. Remove the token lines and the [image: {\displaystyle …}] markers.
Here is the PDF case in full. This formula is from a LaTeX paper.
In
Attention(Q,K,V) = softmax(QK^T/√d_k)V
Out
softmax( QKT √ dk )V (1)
What to do instead
Fix the input before you send it. Then txtfetch handles the rest of the document as usual.
- pandoc, for Word files. Run `pandoc file.docx -t markdown` on your own machine. It writes each equation as TeX between dollar signs. We ran pandoc 3.8 on the fixture and it kept both equations. Then send the Markdown to your pipeline. Read the source →
- The LaTeX source, for arXiv papers. An arXiv abstract page can link the paper's source, not only the PDF. A .tex file comes back from txtfetch unchanged. We did not test the .tar.gz bundle, so unpack it first and send the .tex file. Read the source →
- The PDF export, for Word files. Export the Word file to PDF and send that. The equation then becomes page text, with the layout loss described above. Read more →
- Marker. An open-source converter. Our comparison page lists strong equation fidelity with its optional --use_llm pass. It runs on your hardware. Read more →
- MinerU. An open-source converter. Our comparison page says it writes formulas as LaTeX. It runs on your hardware. Read more →
The premium tier
?quality=premium is sold as a tier, but it does not run today. VLM_ENABLED defaults to false, and no operator has switched the tier on in production. A premium request downgrades to the standard Tika path instead.
We make no claim of LaTeX output, accuracy or price for math on the premium tier. Its prompt asks for clean Markdown and does not mention equations.
Frequently asked questions
- Does txtfetch return LaTeX for equations?
- No. The standard tier returns plain text. A PDF equation comes back as flat symbols. A Word equation does not come back at all. Only a .tex file, or a web page that carries TeX, gives you LaTeX.
- Will an equation in my Word file raise an error?
- No. That is the risk. The response says success, and the equation is missing from the text. Look for a double space where the equation stood.
- Are the symbols in a PDF safe?
- Mostly. Symbols such as the square root, pi and the dot survive. The structure does not. Exponents and subscripts join the line as ordinary digits and letters.
- Can I use the arXiv LaTeX source instead of the PDF?
- Yes, for a single .tex file. It comes back unchanged. We did not test the .tar.gz source bundle, so unpack it and send the .tex file.
- Does the premium tier read equations?
- We do not claim LaTeX output or any accuracy figure for premium. The premium prompt asks for clean Markdown and says nothing about math. The premium tier does not run today, so a premium request downgrades to the standard Tika path.
- Will txtfetch add equation support?
- No date is promised. If your corpus is full of math, convert Word files with pandoc, use LaTeX source when you have it, and keep the rest on txtfetch.
Watch it run, then take a key.
The playground replays a real recorded response for every sample document.
Open the playground →