0

Is there a way to copy my mathematica code (with preserved formatting) as text into microsoft word? Below is part of my code.

chemicalpotential1[x_] = A1/2*(1 - Tanh[B1 (x - C1)])*Kb*T1;
chemicalpotential2[x_] = A2/2*(1 - Tanh[B2 (x - C2)])*Kb*T2;
chemicalpotential3[x_] = A3/2*(1 - Tanh[B3 (x - C3)])*Kb*T3;

diffintermediate1[x_] = a[x]x^2chemicalpotential1'[x]; diffintermediate2[x_] = b[x]x^2chemicalpotential2'[x]; diffintermediate3[x_] = (phi[x] - 1)x^2chemicalpotential3'[x];

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Johnson
  • 357
  • 1
  • 6
  • Similar to 136497 and perhaps many others. – Syed May 16 '22 at 15:16
  • As a side note, just to prevent side effects, use := instead of = when you want to use inputs on the right-hand side. – Ben Izd May 16 '22 at 15:20
  • @Syed From the accepted answer of 136497, I couldn't find the option Copy as -> Metafile – Johnson May 16 '22 at 16:01
  • Which version are you running. On 12.2.0 it is here. It becomes available when you have selected the cells to be copied. – Syed May 16 '22 at 16:05
  • @Syed I am currently running on version 13.0. I only see "Bitmap" at the end of the drop down lists. – Johnson May 16 '22 at 16:07
  • This, https://mathematica.stackexchange.com/a/102747/4999, almost works. I didn't like the font substitution, and it didn't respect newlines. – Michael E2 May 16 '22 at 17:04
  • @Syed I am also unable to find the Copy As -> Metafile option, no matter how little or how much I select in my notebook. I am using version 12.3.1 on Win10-64. – MarcoB May 16 '22 at 17:08
  • 5
    Metafiles were deprecated in 12.3. – ihojnicki May 16 '22 at 17:54
  • 1
  • 2
    @user64494 No for me, since the Copy As -> Metafile option is not available for me. – Johnson May 16 '22 at 18:35
  • @MichaelE2 Is there a better solution than this? – Johnson May 16 '22 at 18:36
  • I don't know a better solution. I don't use Word much. I noticed the spacing around special characters (=, *, etc.) is lost. I doubt there's any way to deal with that in Word, but that's because I don't know anything about Word, except that its spacing is pretty bad. I was able to install Source Code Pro, the code font, in Word. – Michael E2 May 17 '22 at 00:18
  • Okay, I am able to select a rectangle of the PDF, copy it, and paste it as a PDF "picture" in Word. I cannot select or edit the text in the picture, but it's vector graphics and scales nicely. (I'm using Preview on a Mac. Don't know how to do it on Windows or Linux.) I can also "Save Selection As..." within Mathematica to create a PDF that I can then insert in the Word file. – Michael E2 May 17 '22 at 00:26

1 Answers1

4
  1. Use MathML format:

enter image description here


  1. Newer version of Office 365 support direct $\LaTeX$ input as described here.
Syed
  • 52,495
  • 4
  • 30
  • 85