[R] Latex Question

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Dec 7 12:45:57 CET 2001


On Fri, 7 Dec 2001, Jonathan Baron wrote:

> Here is how to print graphs for inclusion in Latex.
>
> First make sure you've got the graph you want.  Do this by
> repeating and editing the command to make the graph, in the usual
> way.  (Yes, I know Miktex is good, but it isn't as good as Emacs
> with ESS, although I admit that I could never configure Emacs
> properly on Windows - which was reason #23.5 for giving up
> Windows.)
>
> Second, say
> postscript("foo.eps")
> where foo.eps is the file name.  I discovered this by
> saying
> apropos(postscript)
> and then I looked at
> ?postscript

Please look it up again.  That's not all you need to get proper EPSF, and
you also need to worry about aspect ratios and pointsizes.  E.g.

     The postscript produced by R is EPS (Encapsulated PostScript)
     compatible, and can be included into other documents, e.g. into
     LaTeX, using `\includegraphics{<filename>}'.  For use in this way
     you will probably want to set `horizontal=FALSE, onefile=FALSE,
     paper="special"'.

It is usually *much* easier to use dev.copy2eps() or, on Windows, the
`Save as' on the File menu.

> Then run the command again, and say
> dev.off()
>
> To include the graph in Latex, make sure you have something like
> \usepackage[dvips]{graphicx}
> in your header.  Then, where you want the graph, say something
> like
> \includegraphics[width=4in]{foo.eps}

You'll need to set a bounding box if you do that, and quite possibly
rotate the figure.

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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