\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Sweave}{}

\RequirePackage{ifthen}
\newboolean{Sweave@gin}
\setboolean{Sweave@gin}{true}
\newboolean{Sweave@ae}
\setboolean{Sweave@ae}{true}

\DeclareOption{nogin}{\setboolean{Sweave@gin}{false}}
\DeclareOption{noae}{\setboolean{Sweave@ae}{false}}
\ProcessOptions

\RequirePackage{graphicx,fancyvrb}
\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}

\ifthenelse{\boolean{Sweave@gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}%
\ifthenelse{\boolean{Sweave@ae}}{%
  \RequirePackage[T1]{fontenc}  
  \RequirePackage{ae}
}{}%

\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl,formatcom=\color{red}}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom=\color{blue}}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl,formatcom=\color{red}}

\newenvironment{Schunk}{}{}

%%%% Completely new commands, added by AK
\newcommand{\Rko}{\textsf{\color{blue} R}}

\newcommand{\Rfun}[1]{\texttt{\color{red}#1}}
\newcommand{\Rarg}[1]{\textsf{\color{red}#1}}
\newcommand{\Rvar}[1]{\textsf{\color{blue}#1}}

\newcommand{\Rfile}[1]{\textsf{#1}}