2

I have an issue with no all my R comments being colored in my latex file. I am using the listing package. My pre-amble code is

\lstset{ %
  language=R,                    
  basicstyle=\footnotesize,       
  numbers=left,                  
  numberstyle=\tiny\color{gray},  
  stepnumber=1,                   
  numbersep=5pt,                
  backgroundcolor=\color{white}, 
  showspaces=false,               
  showstringspaces=false,         
  showtabs=false,                 
  frame=false,                   
  rulecolor=\color{black},        
  tabsize=2,                     
  captionpos=b,                   
  breaklines=true,                
  breakatwhitespace=false,       
  keywordstyle=\color{black},      
  commentstyle=\ttfamily\color{green!60!black},  
  escapeinside={\%*}{*)},         
  morekeywords={*,...}            
} 

We include R code with comment (denoted by #) the green coloring appear to not include special characters (specifically, $)

Calling my code by

\lstinputlisting{R_script.R}
George
  • 205
  • 1
  • 6
  • 2
    You'd get more responses if you made this a real MWE. You also should add that you use the xcolor package, and the the $ do appear but in black only. That is at least what I could reproduce. You may also consider moving this to tex.stackexchange - it's, in my view, more of a LaTeX question than a R issue. – vaettchen Jun 25 '15 at 05:56
  • Thanks for the advice. I would also agree that this is more a LaTex question. Thanks for the thread, I shall take your advice –  Jun 28 '15 at 03:08
  • It looks like you are looking for something like Rstudio or Sweave, digging into that now here. – hhh Nov 22 '16 at 18:07
  • Thanks, I have been playing around with rmarkdown which can use latex script to make the document and can incorporate and run R code within the document too. – George Nov 23 '16 at 00:04

0 Answers0