Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is it possible to export pdf documents that allow the user to copy and paste the exported code/text?

The following table demonstrates what is pasted after copying the example symbols from a pdf exported from Mathematica.

pasted actual 
@       [
8       {
®       →

If this isn't possible an explanation of why not(what about pdfs prevents this functionality) would be appreciated.

EDIT:

After reading Alexey's answer, it has become clear that the pdf editor that you use to copy the text makes a big difference.

When you copy text from the pdf reader Foxit or from Google Chrome's built in reader the clipboard stores the following.

If you copy the data from the pdf using Adobe Reader 11(W7 and M9) in addition you get a RTF format on the clipboard. The RTF format allows Mathematica to reconstruct the original data.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

The symbols { and [ are taken from the font "Mathematica2Mono" (decimal codes 56 and 64), symbol (\[Rule] and \[RightArrow]) - from "Mathematica1Mono" (decimal code 174). You can easily see which symbols correspond to these codes in the standard ASCII table:

FromCharacterCode[{174, 56, 64}]

"®8@"

You can display them using Mathematica font:

Style["8@", FontFamily -> "Mathematica2Mono"]

"{["

The symbol ® is automatically replaced with \[RegisteredTrademark] and I currently do not know how to prevent this.

In Microsoft Word you also can display these symbols using Mathematica fonts and they will appear as expected:

screenshot

Adobe Acrobat 11 has context menu option "Copy with formatting" which copies not only text but includes font information. Using this option and pasting in MS Word, I get "{[-+" for symbols {[→ saved directly from a Notebook using "Save Selection As" menu command (they were typed in an "Input" cell).

At the same time I get completely correct behavior of the standard "Copy" command in Acrobat 11 after Exporting the String "{[→" (the last symbol is \[RightArrow] or \[Rule]): copying this string from Acrobat and pasting in MS Word gives me correct "{[→" (the font of the first two letters is automatically set to "Mathematica2Mono", the font of the last letter is automatically set to "Mathematica1Mono"). So the problem appears only when what you are exporting is not a String.

share|improve this answer
    
Ignore my last comment I believe I understand correctly now. Adobe reader copies formatted text(rtf on Windows Clipboard) while Google Chromes Reader and Foxit reader don't. –  Liam William Dec 26 '13 at 19:35
add comment

Your Answer

 
discard

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.