title: How to keep knitr style while putting line numbers in .Rnw output file?
body: <p>I have read a lot of question and relative answer but I didn't find a solution! My request is similar to this:
  <a href="https://stackoverflow.com/questions/27593677/putting-line-number-for-r-code-with-knitr">Putting line number for R code with knitr</a>, but I want to keep the standard style of Knitr. A user, Thomas, suggest to add <code>language=R</code> to the listings options but this doesn't change the output. </p>
  
  <p>A result like this: </p>
  
  <p><img src="https://i.stack.imgur.com/yBPOv.png" alt="see here"> </p>
  
  <p>would be great! (The theme isn't relevant just the LINE number). 
  I've tried to use the <code>render_listings()</code> function:</p>
  
  <pre><code>\documentclass{article}
  \usepackage{listings}
  
  \lstdefinestyle{Rstyle}{%
    fancyvrb=FALSE,escapechar=`,language=R,%
    basicstyle={\Rcolor\Sweavesize\ttfamily},%         Added \ttfamily
    backgroundcolor=\Rbackground,%
    showstringspaces=false,%
    keywordstyle=\Rcolor,%
    commentstyle={\Rcommentcolor\ttfamily\itshape},%
    %literate=                                         Removed
    alsoother={$},%
    numbers=left,                    
    numbersep=5pt, 
    alsoletter={.&lt;-},%
    otherkeywords={!,!=,~,$,*,\&amp;,\%/\%,\%*\%,\%\%,&lt;-,&lt;&lt;-,/},%
    escapeinside={(*}{*)}}%
  
  \begin{document}
  
  &lt;&lt;setup, include=FALSE&gt;&gt;=
  render_listings()
  @
  
  &lt;&lt;a, results='hold'&gt;&gt;=
  1:2
  3:4
  5:6
  @
  
  &lt;&lt;b&gt;&gt;=
  "test1"
  "test2"
  "test3"
  @
  
  \end{document}
  </code></pre>
  
  <p>Maybe I Have to modify sweavel.sty file too but I haven't idea how to do that.</p>