[R] Sweave: Changing the background color, adding a border

cgenolin cgenolin at u-paris10.fr
Tue Aug 9 23:18:23 CEST 2011


I am not familiar with wiki (wich one?) but here is the code without
line-break

--- 8< --------------------------

%\usepackage{Sweave}
\RequirePackage[T1]{fontenc}
\RequirePackage{graphicx,ae,fancyvrb}
\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}
\setkeys{Gin}{width=0.8\textwidth}

%\DefineVerbatimEnvironment{Sinput}{}{}
%\DefineVerbatimEnvironment{Soutput}{}{}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}

\newenvironment{Schunk}{}{}

\usepackage{listings}

\definecolor{gris90}{gray}{0.90}

\lstloadlanguages{R}

\lstnewenvironment{Sinput}[1][]{
  \lstset{%
    language={R},
    %%% print whole listing small
    basicstyle=\small,
    %%% style for keyword
    keywordstyle=\color{black}\bfseries,      
    %%% define a list of word to emphasis
    emph={in},                                
    %%% define the way to emphase
    emphstyle=\color{black}\bfseries,         
    %%% define a second list of word to emphasis
    % emph={[2]out},                          
    %%% define the way to emphase the list 2
    % emphstyle=[2]\color{red}\bfseries,      
    %%% box arround the code
    frame=single,                             
    % background color
    backgroundcolor=\color{gris90},           
    %%% define the style of the comments
    % commentstyle=\color{gris10},            
    %%% show the space in code, or not
    showspaces=false,                         
    %%% style of the string (like "hello word")
    stringstyle=\ttfamily,                    
    %%% show the space in string, on not
    showstringspaces=false,                   
    #1
  }
}{}
\lstnewenvironment{Soutput}[1][]{
  \lstset{%
    language={R},
    %%% print whole listing small
    basicstyle=\small,                        
    %%% style for keyword
    keywordstyle=\color{black}\bfseries,      
    %%% define a list of word to emphasis
    emph={in},                                
    %%% define the way to emphase
    emphstyle=\color{black}\bfseries,         
    %%% define a second list of word to emphasis
    % emph={[2]out},                            
    %%% define the way to emphase the list 2
    % emphstyle=[2]\color{red}\bfseries,      
    %%% box arround the code
    frame=single,                             
    %%% background color
    backgroundcolor=\color{gris90},           
    %%% define the style of the comments
    % commentstyle=\color{gris10},            
    %%% show the space in code, or not
    showspaces=false,                         
    %%% style of the string (like "hello word")
    stringstyle=\ttfamily,                    
    %%% show the space in string, on not
    showstringspaces=false,                   
    #1
  }
}{}

--- 8< --------------------------

--
View this message in context: http://r.789695.n4.nabble.com/Sweave-Changing-the-background-color-adding-a-border-tp885716p3731285.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list