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?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.Sign up to join this community
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.
The solutions mentioned by @frabjous @eunice work great. To add to the answers above to make a complete list of tools available online for converting things to TeX, I have been using:
and it works really well. This tool does not directly convert PDFs to TeX code, however, it is super useful to convert equations to TeX code and it works very accurately. Working with it is as easy as taking a snapshot of your target equations and it spits out the TeX code. It's very useful particularly when you are dealing with long equations.
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.
I have found now that exist a tool on line for free, that helps you convert PDF file into
LaTeX in the easiest way.
This tool is named with
Aspose.PDF App: https://products.aspose.app/pdf/conversion/pdf-to-tex
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.