What is the quickest and best way to export a plot image from Mathematica to a $\LaTeX$ Editor? Is there something quicker than exporting it to an image and then including it in the $\LaTeX$ document?
For ease of use when dealing with many different graphics I prepare a notebook for each of these and also generate the LaTeX code for insertion in my document. The graphics get their name from the notebook so you can easily spawn different versions by renaming the notebook.
EDIT: more concise and portable:
The resulting output can be copied as plaintext or you might even splice it directly into your document (although this is a bit much for casual use).
The absolutely fastest way I know to get high-quality
Edit 2: copying complex graphics: 3D plots, contour plots, etc.
As has been noted in this post on $\LaTeX$ and Mathematica, you can no longer rely on
Unfortunately, this means that answers based on
On the other hand, copying as
Fortunately, that can be avoided by making sure that Mathematica automatically rasterizes 3D graphics upon export to
Now all exported and copied
The list of 3D plot functions in the command above can be extended to include some notoriously unwieldy 2D plot functions as well, e.g.,
If you create a notebook with some plots and then save it as LaTeX, not only will the images all be generated but so will LaTeX code that you can use to include those images.
One way to speed up the workflow is to batch process all your images and even formulas if you have many. Basically do all your work in the Mathematica notebook placing distinct graphics, formulas and text in separate cells. Then choose File > Save As... and pick LaTeX Document (*.tex) from the drop down menu of popped up window. This will produce a set of .EPS files for each of your graphics stored in separate cells and a coherent .TEX file with text, formulas and calls to the .EPS images.
The way I do this is by creating a directory structure like the following:
The LaTeX file is in
The notebooks start with
and ends with
The figures are then
The key point is that I export all figures to the correct final size, ensuring that the font sizes will be consistent (e.g. in all figures the fonts will be precisely 8 pt big). (Re-)evaluating the notebook will produce all figures and save them directly into the figure directory.
For the LaTeX part, I use the
If some figures need to be post-processed manually using some illustration software, I export them to a separate directory, then copy the final result manually. I keep all figures under version control (in addition to the figure notebook), in case re-evaluating the figure code will overwrite and break something.