As you can see in the image the code, with a standard copy/paste you obtain squares instead of "Return=New Line".

enter image description here

What´s the best way to copy and paste Mathematica code into Word?

One choice is a special PASTE, that gives me the text without colors as you can see in

enter image description here

Another choice is special paste as JPG/PNG.

Is possible to copy "AS TEXT" with the original colors and font?

The most usefull and simple solution I found is the Shutao TANG reply at Saving a notebook as PDF, preserving syntax highlighting

Thank you for all the replies.


1 Answer 1


In your code notebook go to menu Format, Edit StyleSheet

paste in the following

Cell[StyleData[All, "Printout"],
  ShowAutoStyles->True, ShowSyntaxStyles->True]

select 'with interpretation' (upon prompt). Close the stylesheet.

In the code notebook paste and evaluate

Export["eg.pdf", EvaluationNotebook[]]

Copy the colour-formatted text from the PDF and paste into Word.

  • $\begingroup$ ok, I think you give the solution. One question "where I should select 'with interpretation'?". bit.ly/1RIKC7z $\endgroup$
    – Mika Ike
    Dec 24, 2015 at 15:06
  • 1
    $\begingroup$ I'm not seeing that display. When I paste in the cell text Mathematica asks straightaway if I want the text interpreted. $\endgroup$ Dec 24, 2015 at 15:27
  • $\begingroup$ If I do this and "copy with formatting" from acrobat pro to word there are still font issues. "take snapshot" rasterizes it and preserves the fonts, but the quality is not as sharp as saving as raster from mathermatica. ("save as" from mathematica can only do a cell at a time though ) $\endgroup$
    – george2079
    Dec 24, 2015 at 15:39
  • $\begingroup$ I can usually copy most of the output as text. $\endgroup$ Dec 24, 2015 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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