% Usage: \usepackage{Sweavel} % To change size of R code and output, use e.g.: \def\Sweavesize{\normalsize} % To change just the size of output, use e.g.: \def\Routsize{\smaller[2]} % To change colors of R code, output, and commands, use e.g.: % \def\Rcolor{\color{black}} % \def\Routcolor{\color{green}} % \def\Rcommentcolor{\color{red}} % To change background color or R code and/or output, use e.g.: % \def\Rbackground{\color{white}} % \def\Routbackground{\color{white}} % To use rgb specifications use \color[rgb]{ , , } % To use gray scale use e.g. \color[gray]{0.5} % If you change any of these after the first chunk is produced, the % changes will have effect only for the next chunk. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{Sweavel}{} % substitute for Sweave.sty using % listings package with relsize \RequirePackage{listings,fancyvrb,color,relsize,ae} \RequirePackage[T1]{fontenc} \IfFileExists{upquote.sty}{\RequirePackage{upquote}}{} \providecommand{\Sweavesize}{\smaller} \providecommand{\Routsize}{\Sweavesize} %\providecommand{\Rcolor}{\color[rgb]{0, 0.5, 0.5}} %\providecommand{\Routcolor}{\color[rgb]{0.461, 0.039, 0.102}} %\providecommand{\Rcommentcolor}{\color[rgb]{0.101, 0.043, 0.432}} \providecommand{\Rcommentcolor}{\color{black}} %\providecommand{\Rbackground}{\color[gray]{0.91}} %\providecommand{\Routbackground}{\color[gray]{0.935}} % Can specify \color[gray]{1} for white background or just \color{white} \providecommand{\Rcolor}{\color{black}} \providecommand{\Routcolor}{\color{black}} \providecommand{\Rbackground}{\color{white}} \providecommand{\Routbackground}{\color{white}} \lstdefinestyle{Rstyle}{fancyvrb=false,escapechar=`,language=R,% basicstyle={\Rcolor\Sweavesize\ttfamily}, backgroundcolor=\Rbackground,% showstringspaces=false,% keywordstyle=\Rcolor,% commentstyle={\Rcommentcolor\smaller\itshape}, literate={<-}{{$\leftarrow$}}2{<<-}{{$\twoheadleftarrow$}}2{~}{{$\sim$}}1{<=}{{$\leq$}}2{>=}{{$\geq$}}2{^}{{$^{\scriptstyle\wedge}$}}1,% alsoother={$},% frame=shadowbox,framerule=0.9pt,framesep=0.8pt,% rulecolor=\color[gray]{0.7},rulesepcolor=\color[gray]{0.7}, alsoletter={.<-},% otherkeywords={!,!=,~,$,*,\&,\%/\%,\%*\%,\%\%,<-,<<-,/},% escapeinside={(*}{*)}}% % Other options of interest: % frame=single,framerule=0.1pt,framesep=1pt,rulecolor=\color{blue}, % numbers=left,numberstyle=\tiny,stepnumber=1,numbersep=7pt, % keywordstyle={\bf\Rcolor} % Another good choice for rulesepcolor (for the shadowbox) is light % blue: \color[rgb]{0.8,0.85,1} \lstdefinestyle{Routstyle}{fancyvrb=false,literate={~}{{$\sim$}}1{R^2}{{$R^{2}$}}2{^}{{$^{\scriptstyle\wedge}$}}1{R-squared}{{$R^{2}$}}2,% frame=ltb,framerule=0.2pt,framesep=1pt,rulesep=0.5pt,rulecolor=\color[gray]{0.7},basicstyle=\Routcolor\Routsize\ttfamily,% backgroundcolor=\Routbackground} \newenvironment{Schunk}{}{} \lstnewenvironment{Sinput}{\lstset{style=Rstyle}}{} \lstnewenvironment{Scode}{\lstset{style=Rstyle}}{} \lstnewenvironment{Soutput}{\lstset{style=Routstyle}}{} \lstnewenvironment{Sinputsmall}{% \lstset{style=Rstyle,basicstyle={\small}}}{} \lstnewenvironment{Sinputsmaller}{% \lstset{style=Rstyle,basicstyle={\smaller}}}{} \endinput sudo cp ~/doc/latex/texinput/Sweavel.sty /usr/share/R/share/texmf/. sudo mktexlsr To update on wiki: cp -p Sweavel.sty /tmp browser http://biostat.mc.vanderbilt.edu/wiki/bin/attach/Main/SweaveTemplate?filename=Sweavel.sty;revInfo=1