\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,color}
\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}

\ifthenelse{\boolean{Sweave@gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}%
\ifthenelse{\boolean{Sweave@ae}}{%
  \RequirePackage[T1]{fontenc}  
  %\RequirePackage{ae}             %% AK commented 20160324
  \RequirePackage[lf]{venturis}    %% AK added 20160324
}{}%

\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
\definecolor{red2}{rgb}{0.9333333, 0, 0}
\definecolor{mediumblue}{rgb}{0, 0, 0.8039216}

\newcommand{\Rko}{\href{http://www.R-project.org}{\textsf{\textcolor{mediumblue}{R}}}}
\newcommand{\SAS}{\textsf{\color{mediumblue} SAS}}

\newcommand{\Rfun}[1]{\texttt{\color{red2}#1}}
\newcommand{\Rarg}[1]{\textsf{\color{red2}#1}}
\newcommand{\Rvar}[1]{\textsf{\color{mediumblue}#1}}
\newcommand{\Rvarm}[1]{\textcolor{mediumblue}{#1}}

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

\DefineVerbatimEnvironment{Rin}{Verbatim}{formatcom=\color{red}, fontsize=\normalsize, frame=single, framerule=1pt, framesep=3pt}

\DefineVerbatimEnvironment{Rout}{Verbatim}{formatcom=\color{blue}, fontsize=\normalsize, frame=single, framerule=1pt, framesep=3pt}
