\documentclass{article}
\usepackage{color}
\usepackage{alltt}
\usepackage{hyperref}
\newcommand{\hlnumber}[1]{\textcolor[rgb]{0.0823529411764706,0.0784313725490196,0.709803921568627}{#1}}%
\newcommand{\hlfunctioncall}[1]{\textcolor[rgb]{1,0,0}{#1}}%
\newcommand{\hlstring}[1]{\textcolor[rgb]{0.6,0.6,1}{#1}}%
\newcommand{\hlkeyword}[1]{\textcolor[rgb]{0,0,0}{\textbf{#1}}}%
\newcommand{\hlargument}[1]{\textcolor[rgb]{0.694117647058824,0.247058823529412,0.0196078431372549}{#1}}%
\newcommand{\hlcomment}[1]{\textcolor[rgb]{0.8,0.8,0.8}{#1}}%
\newcommand{\hlroxygencomment}[1]{\textcolor[rgb]{0,0.592156862745098,1}{#1}}%
\newcommand{\hlformalargs}[1]{\textcolor[rgb]{0.0705882352941176,0.713725490196078,0.0705882352941176}{#1}}%
\newcommand{\hleqformalargs}[1]{\textcolor[rgb]{0.0705882352941176,0.713725490196078,0.0705882352941176}{#1}}%
\newcommand{\hlassignement}[1]{\textcolor[rgb]{0.215686274509804,0.215686274509804,0.384313725490196}{\textbf{#1}}}%
\newcommand{\hlpackage}[1]{\textcolor[rgb]{0.588235294117647,0.713725490196078,0.145098039215686}{#1}}%
\newcommand{\hlslot}[1]{\textit{#1}}%
\newcommand{\hlsymbol}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlprompt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\usepackage{color}%
\newsavebox{\hlboxclosebrace}%
\newsavebox{\hlboxopenbrace}%
\newsavebox{\hlboxbackslash}%
\newsavebox{\hlboxlessthan}%
\newsavebox{\hlboxgreaterthan}%
\newsavebox{\hlboxdollar}%
\newsavebox{\hlboxunderscore}%
\newsavebox{\hlboxand}%
\newsavebox{\hlboxhash}%
\newsavebox{\hlboxat}%
\newsavebox{\hlboxpercent}% 
\newsavebox{\hlboxhat}%
\newsavebox{\hlboxsinglequote}%
\newsavebox{\hlboxbacktick}%

\setbox\hlboxopenbrace=\hbox{\verb.{.}%
\setbox\hlboxclosebrace=\hbox{\verb.}.}%
\setbox\hlboxlessthan=\hbox{\verb.<.}%
\setbox\hlboxdollar=\hbox{\verb.$.}%
\setbox\hlboxunderscore=\hbox{\verb._.}%
\setbox\hlboxand=\hbox{\verb.&.}%
\setbox\hlboxhash=\hbox{\verb.#.}%
\setbox\hlboxat=\hbox{\verb.@.}%
\setbox\hlboxbackslash=\hbox{\verb.\.}%
\setbox\hlboxgreaterthan=\hbox{\verb.>.}%
\setbox\hlboxpercent=\hbox{\verb.%.}%
\setbox\hlboxhat=\hbox{\verb.^.}%
\setbox\hlboxsinglequote=\hbox{\verb.'.}%
\setbox\hlboxbacktick=\hbox{\verb.`.}%
\setbox\hlboxhat=\hbox{\verb.^.}%
\def\urltilda{\kern -.15em\lower .7ex\hbox{\~{}}\kern .04em}
\newcommand{\hlstd}[1]{\textcolor[rgb]{0,0,0}{#1}}
\begin{document}
\noindent
\ttfamily
\hlstd{}
\hlsymbol{f}{\ }\hlassignement{\usebox{\hlboxlessthan}-}{\ }\hlkeyword{function}\hlkeyword{(}{\ }\hlformalargs{x}\hlkeyword{)}\hlkeyword{\usebox{\hlboxopenbrace}}\hspace*{\fill}\\
\hlstd{}{\ }{\ }{\ }{\ }{\ }{\ }{\ }{\ }\hlsymbol{x}{\ }\hlkeyword{+}{\ }\hlfunctioncall{rnorm}\hlkeyword{(}\hlnumber{1}\hlkeyword{)}\hspace*{\fill}\\
\hlstd{}\hlkeyword{\usebox{\hlboxclosebrace}}\hspace*{\fill}\\
\hlstd{}\hspace*{\fill}\\
\hlstd{}\hlsymbol{g}{\ }\hlassignement{\usebox{\hlboxlessthan}-}{\ }\hlkeyword{function}\hlkeyword{(}\hlformalargs{x}\hlkeyword{)}\hlkeyword{\usebox{\hlboxopenbrace}}\hlkeyword{\usebox{\hlboxclosebrace}}\hspace*{\fill}\\
\hlstd{}\hlsymbol{h}{\ }\hlassignement{\usebox{\hlboxlessthan}-}{\ }\hlkeyword{function}\hlkeyword{(}\hlformalargs{x}\hlkeyword{)}\hlkeyword{\usebox{\hlboxopenbrace}}\hlkeyword{\usebox{\hlboxclosebrace}}\mbox{}
\normalfont
\end{document}
