The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How do I crop EPS output?
Replies: 4   Last Post: Apr 7, 2004 7:44 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jens Benecke

Posts: 10
Registered: 12/7/04
How do I crop EPS output?
Posted: Apr 6, 2004 11:26 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I use the following function after calling "plot" to print to PDF files to
include in PDFlatex documents, and for presentations using the 'beamer'

function topdf(basename, targetname, wfactor, hfactor)

if wfactor<2, wfactor=20; end
if hfactor<2, hfactor=20; end

u = 'centimeters'; set(gcf,'PaperUnits',u); set(gcf,'Units',u);
%pos = get(gcf,'pos'); width = pos(3); height = pos(4);
%set(gcf, 'PaperPosition', [1,1,width*wfactor,height*hfactor]);
set(gcf, 'PaperPosition', [1,1,wfactor,hfactor]);
print('-depsc2', '-tiff', [basename '.eps']);
system(['export P="$PWD" ; nohup sh -c "GS_OPTIONS=-dAutoRotatePages=/None
epstopdf ' basename '.eps ; cd ~/LATEX/pics ; ln -fs $P/' basename '.pdf '
targetname '.pdf ; cd - ; rm -v ' basename '.eps " &']);

However, when I use manual size (wfactor, hfactor above) Matlab adds a white
margin to the document at the left and right side. I would like to remove
those margins because I need the plots to align with the text in the

I tried editing the BoundingBox parameters in the EPS file before converting
them to PDF. This works. But it is manual trial-and-error work and not very
practical (especially because the plots are being updated all the time and
there's a LOT of them).

Any ideas would be most welcome!

Jens Benecke (jens at - Europaweite kostenlose Mitfahrzentrale - 100% saubere Postfächer - garantiert! - PHP ab 9? - SSH ab 19? - günstiger Traffic
Please DO NOT CC: me, I read the lists and newsgroups I post in!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.