File Exchange

image thumbnail


version (2.18 KB) by jean-christophe OLIVIER
eps file exportation with LaTeX text and symbols

1 Download

Updated 17 Mar 2008

No License

PLOTEPSTEX prints an EPS figure for inclusion in LaTeX documents, with LaTeX fonts. It creates a complet EPS-file with annotation of the figure (titles, labels and texts) and graphics (lines,arrows,markers,...). This function uses the LAPRINT function and makes simply a concatenation of the text part and the graphical part in a single EPS file. It requires:
laprint.m, latex, dvips, eps2eps and GhostScript.

With the EPS2EPS command, PS file is converted in an eps-file, with bitmap-fonts. Result is a small size file. It is possible to replace the eps2eps command by the ps2epsi

Cite As

jean-christophe OLIVIER (2021). PlotEpsTeX (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)


legend2latex fixes the legend problem without the need for @...@. See my comment on the legend2latex File Exchange page for info on how to incorporate it into plotepstex.


almog shalom

I have problems with this functions:
The labels and the title always get cut.
Why is it?

Mark Verveld

Thanks for this function, it is very helpful.
I have added a feature to adjust the legend width when using math code. The math code takes a lot of space which makes the legend too wide. With this feature you can add placeholder text delimited by @...@ in a legend line. This isn't printed in the eps, but it is used to size the legend. This gives correct legend box widths. The modified file is included with the latest update of plot2eps, which uses plotepstex and laprint and further streamlines the work flow.


I'm excited by the possibilities of this program. However, (on Windows), I'm having real problems to get it to work reliably. It's worked twice (out of many attempted times), but most other times I get a latex error. I am not sure what difference there was in the various times I used it - to me they seemed the same. It stops at the latex step, with latex being unable to find the aux file. Could this problem be related to having to create a symbolic link? If anyone has experience troubleshooting this function on Windows, I'd really appreciate any help.

Oskar Vivero

Very useful function. I'm running MacOs 10.5(Leopard) and I had to run the same fix that Matthias Hesse recommended on his post, except that the symbolic links were not only for latex, but also dvips, gs and eps2eps. Once I got it working the function has saved me quite some time

Mukhtar Ullah

You can avoid bitmap fonts by using the option -dNOCACHE with EPS2EPS.

Derek O'Connor

Creates a very large eps file.

x = linspace(-2*pi,2*pi); y = sin(x); plot(x);
In Matlab save as eps: size = 10K but B. Box is loose. Need to run it through GView PS to EPS to get tight BB. Same size with tight BB.

PLOTEPSTEX generates an eps file with tight BB but file size is 220K.

I looked at this file and its has a lot of raw numbers. I don't understand PS so maybe somebody can explain the huge files generated by this function.

QUESTION : Why do we need functions such as this? Why can't Matlab do it properly?

Matthias Hesse

PLOTEPSTEX is a very useful function!

But I had some problems to get it working on MacOs 10.4.
The main issue was that Matlab doesn't search in searchfolders, only in /usr/bin/. In my case latex, dvips and the other commands weren't located in /usr/bin/. A symbolic link solves that.
sudo ln -s ...dirToLatex/latex /usr/bin/latex to find dirToLatex: which latex
An other problem was that dvips writes to the standard out; in my case the printer. To ensure that the output is written to a file change line 159 to:
Str=sprintf('dvips %s2.dvi -o',TempName);
Otherwise you may have a big pile of graphs like me ;)

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: LaPrint

Inspired: PlotPdfTex, plot2eps, PlotPdfTex

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!