[R] Latex Question

Ko-Kang Kevin Wang Ko-Kang at xtra.co.nz
Fri Dec 7 11:17:24 CET 2001


There are many ways.  Depending on the type of the graph (*.ps, *.pdf,
*.png...).  MiKTeX/WinEdt combination suggests to me that you are using
Windows.  To save your R graph in R for Windows is extremely easy, provided
you are using the GUI version.  Under the File menu there is a Save as
option, simply choose the format you want.

Normally, if you are not using pdflatex command to compile your tex file
(say if you use latex to compile it, both appears as buttons in WinEdt),
then (personally I'd prefer to) use *.ps format when you save your R graph.

The latex command you will need is \includegraphics{filename.ps}.  Normally
I'd use a block of statements as follows:

\begin{figure}[h!]  % Begin to insert a figure, h! means here.  You can
append a t (top) or a b (bottom) in front of h
\begin{center}      % center align your figure/graph
\resizebox{\textwidth}{!}{\includegraphics{Test.ps}}  % Resize it to fit
with the width of your texts, include the graph name
\end{center}  % End the center environment
\caption{Simulation of M/M/1 Queue with $\lambda = 2, \mu = 3$}  % put a
caption under the graph
\label{fig:Q1i} % Give the graph a label, which can be used as a reference
later
\end{figure} % end the figure

I think doing it this way you need to put \usepackage{graphics}in your
premble.  Note that anything after the % is a comment and will be ignored by
the latex compiler.

The above block of codes is complicated enough.  You can of course simply it
down (say only use \includegraphics{Test.ps}, without resizing it).

It is not possible to explain the whole detail of how to do this, please
refer to the LaTeX Companion or the Not so Short Introduction to LaTeX
(Which can be viewed under MikTeX, search for lshort).

Hope this helps,

Ko-Kang Wang
-------------------------------------------------
Ko-Kang Kevin Wang
Head of Statistical Analysis Division
Software Developers' Klub (SDK)
University of Auckland
New Zealand
----- Original Message -----
From: "Brian Scholl" <brianscholl1973 at yahoo.com>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, December 07, 2001 4:57 PM
Subject: [R] Latex Question


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


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