f



eps to pdf: cropped pdf

Hi,

I create an EPS with gnuplot, run LaTeX, convert the PS with Ghostview
to EPS (with automatical boundingbox correction) and then run epstopdf
(or eps2pdf alternatively) in order to be able to use the graphic with
pdflatex.

The EPS seems to be OK, whereas the PDF is cropped. <http://
www.mrunix.de/forums/showthread.php?p=297298#post297298>

How can I fix this problem?

I tried to use eps2eps and ps2epsi, which didn't help. Only loading
the EPS in Corel Draw and saving again in EPS seems to work but
results in rather large files.

I use Gnuplot 4.2 patchlevel 5.

Gaius Verres
0
Gaius
7/23/2009 6:58:59 AM
comp.graphics.apps.gnuplot 5008 articles. 0 followers. Post Follow

9 Replies
1860 Views

Similar Articles

[PageSpeed] 57

Hi Gaius,

If it's just the pdf output that you want, I'd suggest trying
epslatex.  It's something that worked well for me but can be a bit
fiddly to implement.  If you're running unix/linux then the process is
pretty simple, as illustrated by Matthew Bohnsack's excellent article:
http://bohnsack.com/?p=841.  If you're using an alternative OS, then
I'm afraid that I've not the foggiest.

Regards,
Dai
0
dai_bach
7/23/2009 7:03:51 PM
You have to tell ps2pdf to build a pdf in the size of the eps.
Otherwise it just converts to your standar paper format (A4,legal,
whatever). The parameter ist something like

ps2pdf -EPSFitPage filename.eps

or -EPSCrop, don�t remember wich one and how it is spelt correctly.
Documentation for these Parameter is sort of hard to find.

Why this complicated setup? gnuplot makes eps, ghostscript make the
pdf-plot, (pdf)latex creates the document.

Karl


Gaius Verres wrote:
> Hi,
> 
> I create an EPS with gnuplot, run LaTeX, convert the PS with Ghostview
> to EPS (with automatical boundingbox correction) and then run epstopdf
> (or eps2pdf alternatively) in order to be able to use the graphic with
> pdflatex.
> 
> The EPS seems to be OK, whereas the PDF is cropped. <http://
> www.mrunix.de/forums/showthread.php?p=297298#post297298>
> 
> How can I fix this problem?
> 
> I tried to use eps2eps and ps2epsi, which didn't help. Only loading
> the EPS in Corel Draw and saving again in EPS seems to work but
> results in rather large files.
> 
> I use Gnuplot 4.2 patchlevel 5.
> 
> Gaius Verres
0
Karl
7/23/2009 8:44:13 PM
Dear Dai and Karl,

thank you very much for your answers.

On 23 Jul., 22:44, Karl Ratzsch <mail....@gmx.net> wrote:
> You have to tell ps2pdf to build a pdf in the size of the eps.
> Otherwise it just converts to your standar paper format (A4,legal,
> whatever). The parameter ist something like
>
> ps2pdf -EPSFitPage filename.eps
>
> or -EPSCrop, don=B4t remember wich one and how it is spelt correctly.
> Documentation for these Parameter is sort of hard to find.
> ...

I tried that, too: <http://gnuplot-tricks.blogspot.com/2009/05/gnuplot-
tricks-many-say-that-it-is.html>

But it didn't help.

btw: I do use epslatex to create my EPS.

Gaius
0
Gaius
7/24/2009 7:05:32 AM
How strange.  Have you tried epstopdf to do the initial conversion?
0
dai_bach
7/24/2009 2:02:45 PM
On 24 Jul., 16:02, dai_bach <d.e.jes...@googlemail.com> wrote:
> How strange. =A0Have you tried epstopdf to do the initial conversion?

Yes.

That's what I do:

- run Gnuplot with epslatex-Terminal
- run LaTeX on the file created by Gnuplot
- open the resulting PS with Ghostview and convert to EPS with
automatic bounding box correction
- run epstopdf on the resulting EPS

If you want, you can try it for yourself:
<http://www.mrunix.de/forums/attachment.php?
s=3D7c4f6e7ff636823da266ff7408540bce&attachmentid=3D3132&d=3D1248253908>

Gaius
0
Gaius
7/24/2009 3:30:02 PM
No other idea what I can do?
0
Gaius
7/27/2009 6:46:04 AM
I had a look at those files over the weekend.  I've not got any
definitive answers, but here are a few thoughts:
1) If you do "set size 1.2,0.6" then the plot will always be cropped
at x >~ 7 (for the range specified).  Is this the cropping that you're
talking about?  If so, try "set size 1,0.5" to preserve the aspect
ratio.
2) In all but x11 terminals, only the largest of the three plots is
visible.  I don't know why this is or how to rectify it.
3) If I understand correctly, the end result you're after is something
like: <https://www.bris.ac.uk/fluff/u/dj9248/dh4mihZpGo6_fN2loZR_kACH/
> (url valid until Tuesday 4th August 2009).  Obviously I've plotted a
different function...This was achieved by following the steps outlined
in Matthew Bohnsack's blog, for which an \emph{additional} tex file is
required.
0
dai_bach
7/27/2009 12:28:32 PM
Oh and I commented out the "standalone header ..." bit of the
gnuplot.plt file which just gave me a load of errors and garbled
output, but that might be more to do with my system configuration than
anything else
0
dai_bach
7/27/2009 12:36:02 PM
> > or -EPSCrop, don=B4t remember wich one and how it is spelt correctly.
> > Documentation for these Parameter is sort of hard to find.
> > ...
>
> I tried that, too: <http://gnuplot-tricks.blogspot.com/2009/05/gnuplot-
> tricks-many-say-that-it-is.html>
>
> But it didn't help.
>
> btw: I do use epslatex to create my EPS.
>
> Gaius

Hi,

Here is what I did, and it worked out all right:
The gnuplot part:

set terminal epslatex color
set out 'error.tex'
set xrange [-3:3]
set yrange [-1:1]
set label 1 at -1, 0.5 "$erf(x) =3D \\frac{2}{\\sqrt{\\pi}}\\int\
\limits_0^x\\,\dt e^{-t^2}$" centre
plot erf(x) w l

Then, use

ps2pdf -dEPSCrop error.eps error.pdf

to crop the eps file to the proper size. At this time, you should have
an "empty" pdf graph, i.e., the labels will not be there, only the
lines.
Having done this, you can call latex. The trick to cropping the output
to the proper size is to define a custom paper size. The following
latex file produces a cropped pdf with pdflatex:

\documentclass{article}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{nopageno}
\usepackage{txfonts}
\usepackage[usenames]{color}
\usepackage{color}

\setlength{\pdfpagewidth}{4.7in}
\setlength{\pdfpageheight}{3.4in}
\hoffset -2.1in
\voffset -3.8in

\begin{document}
\begin{figure}
\begin{center}
\scalebox{1.0}{\input{error.tex}}
\end{center}
\end{figure}
\end{document}

I hope this helps.
Cheers,
Zolt=E1n
0
Zoltan
7/27/2009 1:27:26 PM
Reply: