I know there are a couple of questions with answers to this but none of them seems to work for me so I ask here. Some basic facts:

I have 1. Mac OSX 2. Very limited knowledge in Terminal (so things like --shell escape mean zero to me) 3. TeXShop 4. Mathematica 9

I would like to plot with Mathematica but use LaTeX on the plot with the same font as in the main TeX-file. I've heard some about PStools, PSfrag and so on but don't know how to install them or apply them. It would be nice with a simple line of code to do everything but with very little Terminal/command line.

EXAMPLE: As suggested in threads elsewhere I do this in Mathematica 9

plot = Plot[Sin[Exp[x]], {x, -Pi, Pi}, AxesLabel -> {"e", "s"}]
Export[NotebookDirectory[] <> "plot.eps", plot]

And then I make a new LaTeX document with the following code


The file plot.eps is the one I exported from Mathematica 9. The result is unfortunately not good because there's only "e" and "s" instead of $\epsilon$ and $\Sigma$ see figure! enter image description here


3 Answers 3


Why don't you plot it directly with pgfplots?

    \begin{axis}[axis lines=middle,
          every axis y label/.style=
                    {at={(axis cs:0,1.3)},anchor=south},
          every axis x label/.style={
                    at={(axis cs: 3.5,0)},anchor=west},
      \addplot[red,samples=1000,domain=-pi:pi] {sin(deg(exp(x)))};

enter image description here

  • Awesome. Is there a simple way to a similar thing with plotting data from Mathematica 9? Suppose I plot a numerical integration in Mathematica 9 to which there is no analytical function, just data. How can one plot that with pgfplots? Thanks for your solution bro. Oct 13, 2015 at 14:20
  • @ShutupandCalculate certainly there is. You have to provide a sample data though. There are lot of such examples in pgfplots manual. You can access the manual at www.texdoc.net or by running texdoc pgfplots in terminal of your computer.
    – user11232
    Oct 13, 2015 at 14:21
  • So I should save something like a data = Table[] in M9? Oct 13, 2015 at 14:23
  • @ShutupandCalculate Please consult the pgfplots manual for some examples of data formats.
    – user11232
    Oct 13, 2015 at 14:28

May I suggest that you use the same font in Mathematica and in your article? You would simply declare in the plot function of Mathematica that you want the labels to be in the same font and size of the article. Export the plot in pdf format and use LaTeX the command in your LaTeX file:

   \pdfximage width \columnwidth{plotname.pdf}
   \pdfrefximage \pdflastximage
  • With "font" I mean the exact way/font as in my LaTeX file. Oct 13, 2015 at 14:17
  • @shutupandcalculate: have you tried? What difference do you see? If it is a size question, maybe you might want to increase (decrease) the font size in Mathematica. Mathematica is able to use all the available fonts on your system.
    – Xavier_B
    Oct 13, 2015 at 14:27

I made a small package called MaTeX that makes it easy to generate figure labels for Mathematica graphics using LaTeX. A short introduction, including instructions on how to match up font styles, is available in this other StackExchange post:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .