[R] Latex Question

Emmanuel Paradis paradis at isem.univ-montp2.fr
Fri Dec 7 12:54:49 CET 2001


At 19:57 06/12/01 -0800, Brian Scholl wrote:
>Sorry this is more of a Latex than an R question. I'd
>like to be able to insert figures created in R in a
>Latex document.  I'm a bit new to Latex so please
>speak slowly.   I'm using winedt/miktex (great
>programs incidentally).  
>
>Thanks, 
>
>Brian 

Hi Brian,

I found two ways to nicely produce figures for inclusion in LaTeX:

1) use the postscript device, eg:

postscript(file="myfig1.ps", width=..., height=..., horizontal=FALSE)
plot(...)
....
dev.off()

I think you need to specify horizontal=FALSE (the default is TRUE) to have
something ok when inseting in LaTeX.

2) use the function dev.copy2eps() from the R command line, eg you do your
figure on your windows device and when you are happy with it, type the
command:

dev.copy2eps(file="myfig1.eps")


I found that both ways produce files that can be inserted "as is" in LaTeX
documents (ie, no need to edit/modify them with Illustrator,
GhostScript...). If you use the menu File|Save as|Postscript from the
windows device, the resulting PS file does not include nicely in LaTeX.

I use Emacs with RefTeX and AucTeX to edit my .tex files, and this great as
well.

Hope this helps

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