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) > dev.off()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 [[alternative HTML version deleted]]
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) > > dev.off() > 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? > > /MiakelAre 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) plot(1:10) dev.off() 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
Simple: PDF files do not have a BoundingBox so there is none to find (BoundingBox is associated with postscript files). (The equivalent in a PDF file is the MediaBox or CropBox.) You have not shown us the LaTeX, but the problem lies there. I would expect you to need to use pdflatex if you want to include PDF graphics. Please seem further help on a latex list. On Tue, 28 Feb 2006, Mikael Anderson wrote:> This is probably a faq but I have not been able to find a solution.Googling for 'Bounding Box PDF' led me lots of useful information.> 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) >> dev.off() > 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 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Mikael, I have encountered the same problem just recently and I was also stumbled upon it. I knew all that has been said by previous replies and therefore I was very confused. Now I have come up with the solution. You have to use option "pdftex" in either \usepackage[pdftex]{graphicx} or \documentclass[pdftex]{article} Now, pdflatex should deal with your figures from R. -- Lep pozdrav / With regards, Gregor Gorjanc ---------------------------------------------------------------------- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc <at> bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europe fax: +386 (0)1 72 17 888 ---------------------------------------------------------------------- "One must learn by doing the thing; for though you think you know it, you have no certainty until you try." Sophocles ~ 450 B.C.