5

I would like to use Mathematica to generate nice-looking equations for my presentation on Google Slides (which as far as I know can only be an image an image). What's the best way? To be more concrete, I want to convert the following two equations to something that I can directly copy from a Mathematica notebook and past to a Google Slide.The first example is an executable expression and the second one is the TraditionalForm of a string equation (typed using handy Mathematica shortcuts).

Example 1:

Integrate[Sqrt[x], {x, 0, 1}]

Example 2:

TraditionalForm["\!\(\*SqrtBox[\(1 + \*FractionBox[\(x\), \
\(2\)]\)]\)"]

I am hoping to avoid using third-party websites, taking screenshots, and exporting image files.

Miladiouss
  • 1,883
  • 11
  • 26

3 Answers3

10

If you want to copy an image directly using the mouse, you can try Rasterize which generates an image which you can copy/paste directly.

Example 1:

eq1 = HoldForm[Integrate[Sqrt[x], {x, 0, 1}]];

Rasterize[eq1 // TraditionalForm, ImageSize -> 300]

Output 1:

enter image description here

Example 2:

eq2 = TraditionalForm[
   "\!\(\*SqrtBox[\(1 + \*FractionBox[\(x\), \(2\)]\)]\)"];

Rasterize[eq2, ImageSize -> 300]

Output 2:

enter image description here

Update Oct 9,2021

Another option to copy Mathematica expression as graphics directly is to use MaTeX. It generates an image, which you can copy as graphics and paste it outside of Mathematica

Needs["MaTeX`"]
eq1 = MaTeX[HoldForm[Integrate[Sqrt[x], {x, 0, 1}]],Magnification -> 3]

enter image description here

No need to rasterize it, as MaTeX output is already an image.

(ps. this option was also mentioned in comments above. This require having MaTeX installed and also a latex compiler and the other requirements it needs. But everything it needs is available free software. ).

Nasser
  • 143,286
  • 11
  • 154
  • 359
2

I'm surprised nobody pointed out that (in the Windows Front End at least), you can simply select the expression (in Traditional Form), go to the Edit menu and do Copy As.../Bitmap and then paste it into your slides. For some reason (and this has been the case for many years), this option is not present in the right-click/Copy As... options. This also works with plots or any other kind of graphics.enter image description here

John Jowett
  • 599
  • 2
  • 9
  • You said, (in Traditional Form), This works for any selected expression. It does not have to be in tradition form. – Nasser Oct 10 '21 at 07:07
0

Another approach is to use

Style[HoldForm[eq1 = Integrate[Sqrt[x], {x, 0, 1}]], Large]

enter image description here

Then right-click on the right bracket of the output and Save Selection As one of several possible formats. Alternatively, follow the desired expression by, for instance,

Export["C:\\Temp\\test.png", %]

Likewise,

Style[HoldForm[eq2 = TraditionalForm[Sqrt[1 + x/2]]], Large]

enter image description here

Style is quite flexible and can give the desired expression quite a range of appearances.

bbgodfrey
  • 61,439
  • 17
  • 89
  • 156