Re: [R] Bounding Box in pdf files

From: Marc Schwartz <>
Date: Tue 28 Feb 2006 - 16:08:01 EST

On Tue, 2006-02-28 at 14:51 +1100, Mikael Anderson wrote:
> This is probably a faq but I have not been able to find a solution.
> I create a pdf file in R but latex complains that it can't find the bounding
> box. Here is an example:
> > pdf(file="test.pdf", onefile=FALSE, width=8,height=8)
> > plot(1:10)
> >
> X11
> 2
> > sessionInfo()
> R version 2.2.1, 2005-12-20, sparc-sun-solaris2.9
> attached base packages:
> [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
> [7] "base"
> other attached packages:
> mapdata mapproj maps
> "2.0-17" "1.1-7.1" "2.0-30"
> This is the error from latex:
> ! LaTeX Error: Cannot determine size of graphic in test.pdf (no Bound
> ingBox).
> Any thoughts about what the problem might be?
> /Miakel

Are you using 'latex' or 'pdflatex' from the command line?

I am guessing the former given the error.

The former requires EPS (Encapsulated Postscript) files, whereas the latter uses PDF files.

If you want (or need to) to stay with 'latex', you can generate EPS files in R using a modification of your example above:

 postscript(file="test.pdf", onefile = FALSE, horizontal = FALSE,

            paper = "special", width = 8, height = 8)


See the Details section in ?postscript for more information.

The simplified advantage seen with using pdflatex and pdf graphics is that it is a single step to go from TeX to PDF. In the case of using EPS files with latex, it takes three steps, going from TeX to DVI to PS to PDF. Of course shell scripts help with that process.

The advantage of using EPS files with latex is that there are certain packages for TeX that do not work with pdflatex. So it depends upon what you need to do.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide! Received on Tue Feb 28 16:19:40 2006

This archive was generated by hypermail 2.1.8 : Tue 28 Feb 2006 - 18:08:51 EST