File Comment by Comment
25 Feb 2015 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Kerry Bosche

### Kerry Bosche (view profile)

This is working great, with the exception that dashed lines ('LineStyle','--') are not being preserved. What am I missing?

4
25 Feb 2015 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Kerry Bosche

### Kerry Bosche (view profile)

4
11 Dec 2014 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. benjamin

### benjamin (view profile)

Very nice function, however, with MATLAB 2014b it seem no longer to work. Any idea why?

5
09 Dec 2014 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Emil

### Emil (view profile)

Superb function. Perfect for adding symbols to EPS files in Latex. Matlab's defaul EPS generator can't do it properly. This fixes it. 5/5

5
29 Oct 2013 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Johannes Schmitz

### Johannes Schmitz (view profile)

On Ubuntu 13.04 I am getting this error:
/usr/bin/gs: /opt/MATLAB/R2013a/bin/glnxa64/libtiff.so.5: no version information
available (required by /usr/lib/libgs.so.9)

I copied the libtiff.so.5.1.0 from my system folder into the Matlab folder and changed the symolic link (libtiff.so.5) from libtiff.so.5.0.5 to libtiff.so.5.1.0 as a workaround.

Comment only
08 Oct 2011 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Thomas Clark

### Thomas Clark (view profile)

Potentially very useful, as this is an area in which the Mathworks' own solutions are woeful with no signs of improvement. However, with no updates since 2004 I'm not holding my breath for vital fixes to this utility.

For me, the main problems are:
- using texShop on a Mac, and the tags simply aren't being updated so are typeset in the finished document as x01, x02 etc (to be fair this might be a latex issue).
- axes scales (x10^p etc) are placed incorrectly
- legend sizes aren't handled

... and that's before trying anything challenging like having patch objects or 3D plots etc.

Some users may consider googling for psfragx and psfragx.m, which allow overlays of pictures and inclusion of graphics in a more flexible way within latex. Still reliant on Laprint though, so the bugs above won't go away.

1
24 Aug 2011 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Pavle Boskoski

### Pavle Boskoski (view profile)

There is a small Bug in the script when using it with 3D plots. The z-axis is not preserved. The solution is:
The lines 1189 to 1191 and 1782 to 1784 should be changed from:
-set(zlimmodeauto,'ylimmode','manual')
-set(ztickmodeauto,'ytickmode','manual') -set(zticklabelmodeauto,'yticklabelmode','manual')

to:
+set(zlimmodeauto,'zlimmode','manual') +set(ztickmodeauto,'ztickmode','manual')
+set(zticklabelmodeauto,'zticklabelmode','manual')

The only problem was a typo, when setting zticklabel modes the actual property was ylabel.

Great work BTW!

5
11 Aug 2011 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. sweta

### sweta (view profile)

4
11 Feb 2011 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Waseem Tahir

### Waseem Tahir (view profile)

These type of programs seem very nice at first glance, however you come to trouble when it come to real issues. i wasted about 3 hours on laprint, however at end i come to conslusion that title('$\hat{a}$','Interpreter','latex') is the best. you loose flexibility when using laprint.

1
03 Nov 2010 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. hassene

### hassene (view profile)

try this out, very easy and works well !
title('$\hat{a}$','Interpreter','latex')

Comment only
19 Mar 2010 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Erik

### Erik (view profile)

Would it be possible in a future version to set the width of the picture like this:

laprint(1,nameoffile,'width','.9\linewidth ')

In other words: describe the width not as a number but as a factor of the linewidth?

Comment only
30 Sep 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Emile Demarteau

### Emile Demarteau (view profile)

Great work! This script allowed me to perfectly markup all my figures, so they could be included nicely in my report. @Tor Aksel, I wrote a legend to latex converter to overcome the small box problem.

Comment only
30 Sep 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Emile Demarteau

### Emile Demarteau (view profile)

5
16 Sep 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Robert

### Robert (view profile)

5
15 Sep 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Tor

### Tor (view profile)

Extraordinary work. However, I have two problems. The legend box sometimes gets too small, and must be enlarged manually. Also, when the x-axis has ticks as powers of 10, the "x10^n" does not appear in the eps. From inspecting the code, it seems this s only implemented for the y-axis.

5
13 Jul 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Ty

### Ty (view profile)

I was trying to specify a destination directory with the filename, for example,
laprint(1, './figure/a', 'options', 'factory', 'width', 7.5)

Two files will be generated in directory 'figure', namely, 'a.eps' and 'a.tex'

On the Windows machine, the '\includegraphics{}' (second line from bottom in 'a.tex') will points to the correct path of 'a.eps.'
However, on the Linux and Mac machine, the correct path won't be appended to the argument in '\includegraphics{}.'

Any suggestion?

Comment only
12 Jun 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. James Mynderse

### James Mynderse (view profile)

5
05 May 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Pavle Boskoski

### Pavle Boskoski (view profile)

Very valuable script. I can't understand why matworks did't include such script in their package.

GREAT WORK

5
16 Apr 2009 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Mark Verveld

### Mark Verveld (view profile)

I solved the ypower-text issue by adding the folowing lines after line 1563:
set(0,'CurrentFigure',figno)
set(figno,'CurrentAxes',hax(i))
It ensures that the power text is actually printed to the intended axes of the intended figure.

Very good work though, thanks!

5
14 Oct 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Cun Zhang

Great Work!

5
19 Sep 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Peter B

Sorry for the double post. Here is the last line that should've been in the previous post

??? Error while evaluating uicontrol Callback.

5
19 Sep 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Peter B

I get the following error when I execute laprint and I have no idea what it could be! Can anyone please help?

??? Error: Missing MATLAB operator.

Error in ==> laprint at 1795
eval(cmd);

Error in ==> laprint at 415
eval(lapcmd)

5
17 Sep 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Kevin Mitchell

Beautiful! This is exactly what I need. It works just as advertised. I have yet to find a case where I can't use this package to produce the figure I want.

My only caveat is that as a rule, I generally use 'figcopy','off' to avoid any problems with matlab's object copy function , but I could really care less since I generate any serious figures (i.e., ones that I would actually want to include in a latex document) from scripts anyway.

This package really should be included in the standard Matlab distribution.

5
04 Sep 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. knowline knowline

1
04 Sep 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Steve _

y-axis power appears in wrong place when a legend is present (due to the powers tag placed with text() when legend axes is current instead of main axes).

Fixed with the following changes between lines 1560 and 1575 (this may cause unwanted side effects - I've not noticed any yet):

% place text to be replaced by powers on y-axis
+ % Bug fix: when legend is present, powers-string appears on legend axes
+ % instead of main axes; make sure main axes are current when invoking text();
+ % at the end, make legend axes current to make legend visible again
+ ca = gca; % if legend present, this is probably legend axes
for i=1:na
allxyz = { 'x', 'y', 'z' };
ixyz=2; % x,y,z
xyz = allxyz{ixyz};
leftright=get(hax(i),'yaxislocation');
if powers(i,ixyz) & ~is3d(hax(i)) & isequal(leftright,'left')
+ axes(hax(i)); % make the axes current
powertext = ['ypower' int2str(i)];
xlimit = get(hax(i),'xlim');
ylimit = get(hax(i),'ylim');
@@ -1575,6 +1587,7 @@
set(htext,'VerticalAlignment','Baseline');
end
end % i
+ axes(ca); % needed to make legend visible again -- any side effect?

4
31 Jul 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. ich aus Hannover

In general this is a very useful tool. But the proramm do not place the powers on the y-axis (ypower) correctly. And that is quite laborious to change the files by hand.

2
30 Jul 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Ivo visitor

Actually, I cannot use this on Ubuntu/Matlab 7.5 because the placeholders are not replaced correctly by the generated .tex file. I use texlive and the psfrag package. There are no errors on compilation with LaTeX but the labels are just not located at the correct positions. Also the 'straight line' from the user manual is printed horizontally, whereas it is the y-axis label (just following the example in the manual).
Is this a known problem? I have seen this on more than 1 computer).

Are there any thoughts on this? I would really like to use this tool.

Comment only
24 Jul 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Olivier Lemaire

perfect !!
This is exactly what I need. Thank you so much.

Love LateX...

5
19 May 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. The Rainman

This is actually cool and helpful!

5
15 Apr 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Jacob Huijssen

I love this function, very happy to discover it at the start of writing my PhD thesis!!

5
31 Jan 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Dai Jessop

Decent function, but one can achieve the same result using
> print -depsc <filename>

4
28 Jan 2008 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Eric Johnson

An impressive and useful piece of work, indeed. After some head scratching, I found that the size of legends gets screwed up in MATLAB 7.4 if the figure is copied before doing the text replacements. To avoid this, use the 'figcopy', 'off' option from the command line or uncheck the "Copy figure and modify that copy" option in the gui. With that option set, the text in your original figure gets changed into the psfrag tags, but the legend size comes out correct.

5
10 Nov 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Rob Stanson

Helpful tool, but I had to make a change in order to be able to use ist with legends in Matlab 7.1:

I replaced line 1563
for i=1:na
by
for i=na:-1:1
axes(hax(i));

because it placed the ypower-text into the legend's axes, not into the normal axes.

3
27 Oct 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Paul Miller

Excellent program. I would like to be able to specify a default font size for all labels, etc. For example, add \footnotesize to all tick labels.

4
10 Oct 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Javier Barragán

Is it possible to eliminate the warning of line 64 with this?

In the beginning of the function:
"interpreter=get(0,'defaulttextinterpreter');"

At the end or before any "return" or "error":
"set(0,'defaulttextinterpreter',interpreter)"

Thank you!

4
24 Sep 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Mark Morelande

Thank you for writing this excellent function. I have found it to be extremely useful.

5
17 Sep 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Jean-Christophe OLIVIER

Thank you very much for this powerfull function! All well work!

5
13 Jul 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. S. Hoffmann

SUPERB TOOL! Only thing I am missing is the turning of axis lables in 3d plots. I also like to modify the distance of tick lables to the axis, because by default laprint sets them a little too far away from the axis (in my opinion). Nevertheless, greatly helpful! Thanks!

5
01 Jul 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. sssssssss sas

sssssssssssssssssss

5
27 Jun 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Jason Venkiteswaran

What about axis labels? I can't find an 'as on screen' option. This is important for converting EPS files to PDF for use with pdftex.

Comment only
18 Jun 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Kyriakos Chourdakis

Excellent! Thanks a lot for that Arno

Comment only
12 Jun 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Gernot Hassenpflug

To add to my previous review. I discovered belatedly that the renderers -zbuffer and -opengl store binary data, only -painters stores vector data and therefore only the latter can be used with LaPrint. This is not a bug, and I apologize for not having noted this in my first review. If one requires -opengl rendering then one will need to overlay plots in LaTeX using I suppose the pstricks and graphicx packages.

5
08 Jun 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Gernot Hassenpflug

I found this utility useful for simple plots, but I discovered that unfortunately it does not appear to work for renderers -opengl and -zbuffers. If one is forced to use -painters, then shading and lighting is lost in 3-D graphics. I could not discover where the problem lies, but since the .tex output appears the same, I surmise it is the .eps file format. I wish I had the ability to fix this, but for the moment I need to look for alternative tools.

2
11 May 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. sara tamer

5
10 May 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. D T

4
04 May 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Dimas Mavares

Extremely useful

5
13 Apr 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Guillaume Jacquenot

Excellent work. You spare me a lot of time!!

5
07 Mar 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. Leopold Pede

I am student and like to learn Matlab

Comment only
04 Feb 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. murtaza kemal

a lot of things

4
04 Jan 2007 LaPrint LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents. popo sskkd

4