4.66667

4.7 | 3 ratings Rate this file 91 downloads (last 30 days) File Size: 6.9 KB File ID: #20847

PlotPdfTex

by Emmett L

 

24 Jul 2008 (Updated 25 Jul 2008)

No BSD License  

PDF file exportation with LaTeX text and symbols

Download Now | Watch this File

File Information
Description

PLOTPDFTEX renders all of the text in a Matlab figure with LaTeX (using LaPrint) and then saves it as a single pdf file for easy inclusion in a LaTeX document using pdflatex.

This function is an extension of PlotEpsTex, but also includes a bug fix so that line thickness and text size can be controlled.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
LaPrint, PlotEpsTeX

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
24 Sep 2008 Sagren Munsamy

This was exactly what I was looking for. I spent hours trying to combine the laprint generated files. I was compiling using pdflatex so I needed to have a combined rendering of the laprint generated files. Thank you for this submission. A true timesaver!

31 Mar 2009 Marco

The file works nicely and based on plotepstex. However, there is a bug in the function:
The function creates an eps file called and deletes this temporary file after the pdf has been created.
While this itself is no problem, the function uses the same base string for the eps as for the pdf. Now, if I created a eps with that name before, e.g., using 'plotepstex', it is deleted by 'plotpdftex'.
To fix this, simply change the function such that it uses a (second) temporary file name instead of the string given by the user. Here's the diff output (diff new old):

175c175
< Str = sprintf('eps2eps -dNOCACHE %s2.ps %s3.eps',TempName,TempName);
---
> Str = sprintf('eps2eps -dNOCACHE %s2.ps %s.eps',TempName,FileName);
191c191
< Str = sprintf('epstopdf --outfile=%s.pdf %s3.eps',FileName,TempName);
---
> Str = sprintf('epstopdf %s.eps',FileName);
197c197
< dos(sprintf('rm %s3.eps',TempName));
---
> dos(sprintf('rm %s.eps',FileName));
200c200
< dos(sprintf('del %s3.eps',TempName));
---
> dos(sprintf('del %s.eps',FileName));
212c212
< %dos(sprintf('rm %s.eps',FileName));
---
> dos(sprintf('rm %s.eps',FileName));
215c215
< %dos(sprintf('del %s.eps',FileName));
---
> dos(sprintf('del %s.eps',FileName));

Emmet, if you could consider this please for an update.

Thanks for the function, works nicely apart from the above mentioned.

21 May 2009 jan verveckken

Great tool, finally a solution for this problem!

Have had some trouble with a eps2eps, it would change the bounding box to cut off the axes... replaced it with the ps2epsi as suggested in your file, seems to handle that issue.
Thanks!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
annotation Emmett L 22 Oct 2008 10:11:43
customization Emmett L 22 Oct 2008 10:11:43
latex Emmett L 22 Oct 2008 10:11:43
pdf Emmett L 22 Oct 2008 10:11:43
figure Emmett L 22 Oct 2008 10:11:43
export Emmett L 22 Oct 2008 10:11:43
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com