1

I would love to have an OCR who could translate my PDF-file to a TeX-file. It doesn't have to be "good looking".

I only need it to a) copy some text from time to time and b) especially to copy the math (maybe the tables too).

Any suggestions? I have tried Abiword (it doesn't worked as good as I had hoped). Especially math is important for me. And it should work online or on Linux.

Thank you very much in advance!

closed as unclear what you're asking by Romain Picot, user13907, Paul Gaborit, Svend Tveskæg, Andrew Feb 8 '16 at 10:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    i think you'd need fully-commented pdf/ua for this to work. and even if that's possible to construct, i don't know too many authors who care enough to make it happen. a real pity. – barbara beeton Sep 11 '15 at 14:55
  • @barbarabeeton Not sure why this was put on hold. It is pretty clear from the question you are asking what is the best way to convert a pdf with math included to TeX. However, it might be a duplicate: tex.stackexchange.com/questions/8503/… – A Feldman Feb 8 '16 at 11:10
  • @AFeldman -- parsing math from "uncommented" pdf is not going to be easy. if the pdf was from a scan, even getting the text to be accurate is difficult, and the two-dimensional positioning of math is much harder. if the question specified how the pdf was created, that might be enough to reopen; i don't know. – barbara beeton Feb 8 '16 at 11:23
  • @barbarabeeton Thank you for the clarification. – A Feldman Feb 8 '16 at 18:38
2

I use the pdfocr program with tesseract when I want to ocr my pdf's on linux

I use the ppa:gezakovacs/pdfocr repository for pdfocr and

sudo apt-get update
sudo apt-get install pdfocr

   sudo apt-get install tesseract-ocr 
   sudo apt-get install tesseract-ocr-eng  

The command to convert is

pdfocr -i input.pdf -o output.pdf 

In addition, prior to converting I have to do

export TESSDATA_PREFIX="/usr/share/tesseract-ocr/"

in order to tell tesseract where the language files are.

After conversion you can grab your text by copying it from the output.pdf itself, and from there to your LaTeX file.

Tesseract does have a math recognition language file which is listed as one of the language packs: equ(Math/equation detection module)

The libreoffice method only works in a limited way because it transforms pdf's into libreoffice graphics files (.odg) and this prevent you from copying text in big blocks, as text is ocr'd as short graphical blocks, not as a whole. It therefore needs to be copied sentence by sentence if at all, which is very tedious for more than a few sentences.

I have been looking for a pdf to TeX converter, and so far have not found one.

0

You can use LibreOffice Draw, by importing the pdf file into it. Draw works pretty fine with pdf. But for stability, use this version.

For math, if you are not interested in re-writing that using LaTeX, you can also use LibreOffice, but the component "Math", and then include to your TeX document as a picture.

  • 1
    Does LibreOffice Draw import the pdf as text content or as pure flattened 'image'? If it's flat, this is no answer, in my point of view? – user31729 Sep 10 '15 at 22:39
  • No. If the PDF contains text layer, it will import everytnig: background and text, which will be able to cope and modify. – Stas Bookman Sep 10 '15 at 22:40
  • 1
    Alright, I've just tested it with LibreOffice 4.3 -- it's possible to open a .pdf in Draw and edit the text. But that's not .tex then. – user31729 Sep 10 '15 at 22:46
  • 1
    Equations as images within LateX: what a strange advice! – pluton Sep 10 '15 at 23:58
  • @ChristianHupfer There are ways to convert LibreOffice docs to .tex but I don't know they would work with Draw (as opposed to Write). – cfr Oct 10 '15 at 23:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.