This question already has an answer here:

I have a really good book (.pdf) that i would like to take some code from there. I know that book was written with LaTeX, so my question is if there are any kind of way to take that .pdf and reconvert to .tex file?

Thanks in advance.

marked as duplicate by samcarter, Stefan Pinnow, Phelype Oleinik, TeXnician, Bobyandbob Aug 14 at 16:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    There is no way that you can obtain the .tex source code of the book from just the PDF. (Unless the author actually embedded it into the PDF, which is possible, but would be highly unusual.) See also tex.stackexchange.com/q/445998/35864 – moewe Aug 14 at 14:00

There is no perfect way to reverse-engineer the LaTeX source from a PDF.

However, there is some (non-free) software that will carry out OCR on a PDF file and output LaTeX for you. The one I know about (and have used, a little) is InftyReader.

InftyReader is non-free, and while (in my experience) it produces reasonable output, as with any OCR process it is far from perfect, so you would still need to undertake substantial post-processing.

Note: This is commercial software, but I have no financial or other interest in endorsing it.

  • 2
    The semantic markup would definitely be lost there and even the usual markup could be hard to come by. I guess most other formatting would also not be recognised. For text this seems only slightly better than copy-and-paste, while for maths it may have advantages. In any way this is very far from obtaining the original source of the document, but it can save an awful lot of typing if you just want to plagiarise (research) content... – moewe Aug 14 at 14:29
  • There are reasons other than plagiarism (of research or anything else) that one might want to recover TeX source from a PDF. – Robert Brignall Aug 14 at 19:03

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