title: Hide entire part of document using Sweave condition
body: <p>I would like to hide an entire part of my document including the LaTeX parts between code chunks.</p>
  
  <p>The code might look like</p>
  
  <pre><code>&lt;&lt;echo=FALSE, results=tex&gt;&gt;=
  if (showpart) {
  @
  
  Here we have quite a lot of latex, { that is not necessarily well-formed \end{itemize}
  
  &lt;&lt;echo=FALSE, results=tex&gt;&gt;=
  }
  @
  </code></pre>
  
  <p>I already tried to insert <code>\begin{comment}</code> and <code>\end{comment}</code> using the verbatim package, but this does not cope well with the bad formed latex.</p>
  
  <p>Any suggestions? 
  Thanks for your help.</p>