\usepackage{color}
\usepackage{listings}
\definecolor{Brown}{cmyk}{0,0.81,1,0.60}
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
\lstset{
language=R,
frame=ltrb,
framesep=5pt,
basicstyle=\normalsize,
keywordstyle=\ttfamily\color{OliveGreen},
identifierstyle=\ttfamily\color{CadetBlue}\bfseries,
commentstyle=\color{Brown},
stringstyle=\ttfamily,
showstringspaces=false,
breaklines=true
}
\beging{lstlisting}
[SOURCE CODES GOES HERE]
\end{lstlisting}
The environment has support for the following languages :: Fortran, C, C++, csh, HTML, Java, Matlab, Mathematica, Pascal, Perl, SQL, XML, Delphi, PHP, VBScript, SAS and even Latex itself - and many more.