I know that hardly any information is passed to the PDF when a .tex file is compiled.
But is there a tool that can convert a PDF document back to (La)TeX?
If you install AbiWord with the additional import and export plugins,* you can open a PDF file in the Word Processor, and then export to LaTeX. In fact, you can also convert from the command line:
abiword --to=tex filename.pdf
Be warned that both its PDF import routine and its LaTeX export routine have serious limitations, and you should not expect anything that will be usable without serious tweaking afterwards.
(* IIRC, the extra plugins are installed by selecting a custom install on Windows and checking all the import and export options it gives you. For Linux, you typically need to install a separate package called "abiword-plugins" or "abiword-plugin-mathview" depending on distro. No clue for Mac.)
Inkscape can open PDFs and export to either PSTricks or TikZ codes; this might be useful if the PDF in question is just a diagram or vector image you want to edit.
There's a project listed on sourceforge called pdf2latex, but it doesn't look like any real work has been done on it. I'm not sure it's a real project. (The page looks fishy; almost as if someone was just posting an idea.)
Check out InftyReader.
Quoting the start page:
InftyReader is an Optical Character Recognition (OCR) application that recognizes and translates scientific documents (including math symbols) into LaTeX, MathML and XHTML!
I found no tool that can deal with formatting, but for extracting the text on Linux, there is a two step procedure that produces good results:
$ pdf2ps paper.pdf $ ps2ascii paper.ps > paper.txt
Import the file using LibreOffice. It will create a Draw file. You have to copy and edit it by pieces into Writer. Then you can use the plugin
writer2latex to export the results to LaTeX. The final code is dirty, with plenty of stuff you don't need and some errors.
If your docs are large enough, this process might be easier than re-typing everything.
Another alternative, if you are dealing mostly with pure and simple text, is to save the file as a
*.txt from the PDF reader. Then copy/paste the thing into your LaTeX editor.
Here is an approach that combines InftyReader and AbiWord.
Suppose we have a file
First process it with the free version of InftyReader. This will not give the TeX directly (except for the first page) but it will produce a file
Then you can run AbiWord on this file:
abiword --to=tex example.pdf2txt
The result is not great, but not too bad either.
Convert PDF to Latex by acquiring the source
If you can acquire the
.docx file that generated the
latex and get decent results using:
Alternatively, If you're sure the PDF was generated by Microsoft Word, but don't have it, then:
.docx. This is a potentially data lossy operation since anything that touches microsoft is a rube goldberg machine of evolution.
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?