I have been trying to use the listings package in LaTeX to do this but have not been fully happy with the result. Here is what I'm trying:

\lstloadlanguages{R}
\lstset{language=R,basicstyle=\smaller[2],commentstyle=\rmfamily\smaller,
 showstringspaces=false,%
 xleftmargin=4ex,literate={<-}{{$\leftarrow$}}1 {~}{{$\sim$}}1}
\newcommand{\co}[1]{{\lstinline|#1|}} # for in-line S phrases
\newcommand{\Co}[1]{{\lstinline|#1|}}

\begin{lstlisting}
... S code ...
\end{lstlisting}

If anyone has a better setup please let me know. I'm trying to set comments in a smaller font and in roman style, and am changing <- to left arrows and ~ to $\sim$. This also requires the LaTeX relsize package.

Thanks
--
Frank E Harrell Jr   Professor and Chair           School of Medicine
                     Department of Biostatistics   Vanderbilt University

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to