5
$\begingroup$

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.

$\endgroup$
12
  • 2
    $\begingroup$ I'd use TeXForm followed by MaTeX $\endgroup$
    – yohbs
    Commented Jul 26, 2017 at 3:38
  • $\begingroup$ @yohbs, I will look into MaTex, but it is a third-party software. $\endgroup$
    – Miladiouss
    Commented Jul 26, 2017 at 3:49
  • 1
    $\begingroup$ Since you're planning to copy into a slide program, you'll want transparent background, right? So do you agree that this is a duplicate of Clipboard with transparency, since Rasterize in itself can be found in the docs? If not, pleas explain what makes this question different. $\endgroup$
    – Jens
    Commented Jul 26, 2017 at 21:12
  • 1
    $\begingroup$ Sorry, I linked only one of two related threads: Clipboard with transparency and How to export transparent raster plots?. There are probably other related links, too. $\endgroup$
    – Jens
    Commented Jul 26, 2017 at 21:37
  • 1
    $\begingroup$ When you copy the output of Rasterize[HoldForm[Integrate[Sqrt[x], {x, 0, 1}]]//TraditionalForm,ImageSize->300,Background->None] and paste it into a graphics program like Gimp on Linux, do you see transparent background? You should... $\endgroup$
    – Jens
    Commented Jul 27, 2017 at 1:43

3 Answers 3

10
$\begingroup$

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. ).

$\endgroup$
2
  • $\begingroup$ Is it possible to make the output images transparent? $\endgroup$
    – Miladiouss
    Commented Jul 27, 2017 at 0:21
  • $\begingroup$ The image qualities are not good. Is it possible to convert equations to graphics? $\endgroup$
    – Miladiouss
    Commented Jul 27, 2017 at 1:24
2
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ You said, (in Traditional Form), This works for any selected expression. It does not have to be in tradition form. $\endgroup$
    – Nasser
    Commented Oct 10, 2021 at 7:07
0
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ This cannot be directly copied, hence doesn't satisfy the question requirements. $\endgroup$
    – Miladiouss
    Commented Jul 26, 2017 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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