knitr parses extra verbatim documentclass
<p>I'd like to include an example of complete LaTeX code inside an Rnw document that is parsed using knitr.</p>

<p>My .Rnw file is shown here (I really want to include a bunch of R code as well but this minimal example shows my problem)</p>

<pre><code>\documentclass{article}

\begin{document}    
Recursiveness, see     
\begin{verbatim}
\documentclass{article}
\begin{document}
Recursiveness
\end{document}
\end{verbatim}

\end{document}
</code></pre>

<p>When I run <code>knitr test.Rnw</code> I get a <code>.tex</code> file where the second <code>documentclass</code> is replaced (see below, where the top of the <code>.tex</code> file is shown). I'm pretty sure that this is <code>knitr</code> that replaces the litaral string <code>\documentclass</code> with its own macro that and it does not realize that it shouldn't be parsen when inside the verbatim environment. </p>

<pre><code>\documentclass{article}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}

Recursiveness, see 

\begin{verbatim}
\documentclass{article}\usepackage[]{graphicx}\usepackage[]{color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width&gt;\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother
</code></pre>

<p>Is it possible to circumvent this? I tried to insert a zero-width space character in the middle of <code>documentclass</code> but that gave me a bunch of headaches with the parsing.</p>