TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to copy from a PDF to a LaTeX document? Whenever I do it, it copies in with weird symbols in the place of LaTeX commands for example:

$$f:\mathbb{R}\rightarrow \mathbb{R}$$

copies in as

f : R ! R;

I did a quick search and I couldn't really find anything (some sort of PDF to LaTeX converter that worked well)

Am I missing something obvious or can this not be done (for some reason)?

share|improve this question
You are probably out of luck: see tex.stackexchange.com/questions/8503/…. Your question will probably be closed as a duplicate. – Ethan Bolker Dec 11 '12 at 18:32
Are you interested in getting useful symbols or do you really want the complete LaTeX code back? – Stephan Lehmke Dec 11 '12 at 18:40
For instance, if I add \input{glyphtounicode} \pdfgentounicode=1 to the preamble of the document, I get f : R → R. – Stephan Lehmke Dec 11 '12 at 18:46
@EthanBolker I just found out how to make it paste back as TeX code ;-) – Stephan Lehmke Dec 11 '12 at 19:40
@hmmmm could you disambiguate whether you want to copy LaTeX from any PDF document or want to be able to make a PDF from which LaTeX can be copied? – Stephan Lehmke Dec 11 '12 at 21:41
up vote 15 down vote accepted

Try this:





\pasteablelatex{$$f:\mathbb{R}\rightarrow \mathbb{R}$$}


share|improve this answer
To be clear, can you confirm that this only works if the person who compiled the PDF used this method? I guess that without that there's no way to do this, isn't there? – Loop Space Dec 11 '12 at 19:57
@AndrewStacey Not sure what you mean. It's a method to make PDF paste back LaTeX code. – Stephan Lehmke Dec 11 '12 at 19:59
I mean that if you give me a PDF without the source code then I can't use your method to recover that source code. But if I as an author want to be kind to readers (assuming that there are some) then I can use this to make my PDF so that copying gives the LaTeX code. – Loop Space Dec 11 '12 at 20:05
Exactly. It has to be used when compiling the LaTeX to PDF. – Stephan Lehmke Dec 11 '12 at 20:05
Is there a way to make all the document pasteable? – Manuel Dec 11 '12 at 20:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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