blob: 50112ae2949f180329ed32bfbe887ed9e03cf0b6 [file] [log] [blame]
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{Sweave}{}
\RequirePackage{ifthen}
\newboolean{Sweave@gin}
\setboolean{Sweave@gin}{true}
\newboolean{Sweave@ae}
\setboolean{Sweave@ae}{true}
\newboolean{Sweave@inconsolata}
\setboolean{Sweave@inconsolata}{false}
\DeclareOption{nogin}{\setboolean{Sweave@gin}{false}}
\DeclareOption{noae}{\setboolean{Sweave@ae}{false}}
\DeclareOption{inconsolata}{\setboolean{Sweave@ae}{false}\setboolean{Sweave@inconsolata}{true}}
\ProcessOptions
\RequirePackage{graphicx,fancyvrb,textcomp}
%% inspired by an earlier version of upquote.sty
\begingroup
\catcode`'=\active \catcode``=\active
\g@addto@macro\@noligs{\let`\textasciigrave \let'\textquotesingle}
\endgroup
\ifthenelse{\boolean{Sweave@gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}%
\ifthenelse{\boolean{Sweave@ae}}{%
\RequirePackage[T1]{fontenc}
\RequirePackage{ae}
}{}%
%% see comment in Rd.sty
\ifthenelse{\boolean{Sweave@inconsolata}}{%
\IfFileExists{zi4.sty}{\usepackage[noupquote]{zi4}}{\usepackage{inconsolata}}}{}
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}
\ifdefined\Schunk%
\message{\string Environment Schunk is already defined, stay with former definition}%
\else
\newenvironment{Schunk}{}{}%
\fi
\newcommand{\Sconcordance}[1]{%
\ifx\pdfoutput\undefined%
\csname newcount\endcsname\pdfoutput\fi%
\ifcase\pdfoutput\special{#1}%
\else%
\begingroup%
\pdfcompresslevel=0%
\immediate\pdfobj stream{#1}%
\pdfcatalog{/SweaveConcordance \the\pdflastobj\space 0 R}%
\endgroup%
\fi}