[R] pdf() and pdflatex

Frank E Harrell Jr fharrell at virginia.edu
Fri Nov 8 16:26:56 CET 2002


I am having good success in using pdf() to produce pdf graphics files for inclusion in documents processed by pdflatex [I'm using R 1.6.0 on Linux].  I am having one small problem consistently though, which I believe I also had with S-Plus's pdf.graph(): wasted space at the top of the graph which causes pdflatex to put the graph on a later page, when the current page has plenty of space.

Here is how I typically call pdf( ):

pdf(filename, width=5.333, height=4,     pointsize=10,family='Helvetica',onefile=FALSE)
par(lwd = lwd, mgp = c(2.5, .6, 0),
    mar = c(3.5, 3.5, 1, 1) + 1.e-10, bty='l')
par(smo=0)
plot( . . .)
dev.off()

Here is how I include the graphics file in LaTeX:

\usepackage{graphics}
...
\begin{figure}[hb]\leavevmode\centerline{\includegraphics{mygraph.pdf}}
\caption{A caption}
\label{fig:mygraph}
\end{figure}

I need onefile=FALSE because some of the high-level graphics commands I use produce more than one page of output.  I am using pdflatex rather than including postscript files with latex so that I can use the hyperref style for pdflatex.

Has anyone had this problem or have a suggested solution?  Thanks in advance.
-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list