title: R code in LaTeX in YAML before_body include
body: <p>I have a LaTeX section that I put at the top of my knitr generated PDF document. I achieved this by using the YAML options</p>
  
  <pre><code>output:
      pdf_document: 
          includes: 
              before_body: file.tex
  </code></pre>
  
  <p>file.tex contains code like this</p>
  
  <pre><code>\textsf{Reporting: `r 2+2`}
  </code></pre>
  
  <p>but this doesn't work. Is there another way that I can get this value? Passing in a parameter is fine if that's possible.</p>
  
  <p>Thanks!</p>