Skip to content
Prev 168424 / 398502 Next

OT: Adding verbatim R code text into LaTeX documents: texttt; verb or url?

2009/1/28 Peter Dunn <PDunn2 at usc.edu.au>:
Try this:

\usepackage{listings}

\lstset{%
	basicstyle=\scriptsize,
	breaklines=true,
	frame=single,
	literate=
		{<-}{$\leftarrow$}{2}
}

\renewcommand\lstlistlistingname{List of listings}


Have a look at the listings package... You can see I'm making the font
size smaller, giving all code a frame, and converting <- into a proper
left arrow (just for R!)

listings is very capable.

http://www.ctan.org/tex-archive/macros/latex/contrib/listings/
http://www.ctan.org/get/macros/latex/contrib/listings/listings.pdf

bw

Mark