[R] rcode and latex

Robert.Denham@dnr.qld.gov.au Robert.Denham at dnr.qld.gov.au
Thu May 3 01:06:29 CEST 2001


I have discovered the listings package for including code in your latex
documents.  The default languages do not include R or Splus, but the
definition is pretty simple, this is what I did for R:

\lst at definelanguage{R}%
{morekeywords={TRUE,FALSE,T,F,NA,NULL,Inf,NaN,library,%
  attach,detach,source,while,for,in,%
  repeat,switch,break,next,return,stop,function,%
  if,else,warning,error},%
literate={<-}{{$\leftarrow$}}1{<<-}{{$\leftarrow \!\!\!\!\leftarrow$}}1 ,%
sensitive=true,%
morecomment=[l]\#,%
morestring=[d]",%
morestring=[d]'%
}[keywords,directives,comments,strings]


This is saved somewhere on your $TEXINPUTS path as lstlang0.sty.  Probably
someone has already done this, so I would be happy to see an improved
version.

I am sending this in the hope there are others find it useful.

Robert Denham


************************************************************************
The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.

Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  

If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
************************************************************************
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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