title: Incorrect conversion from R Markdown to LaTeX
body: <p>Why does the following R Markdown minimal (non)-working example not compile to PDF?</p>
  
  <pre><code>---
  header-includes:
  - \usepackage{fancyhdr}
  - \pagestyle{fancy}
  - \lhead{}
  - \chead{}
  - \rhead{The performance of new graduates}
  - \lfoot{From: K. Grant}
  - \cfoot{To: Dean A. Smith}
  output:
    pdf_document:
      keep_tex: yes
      latex_engine: xelatex
  ---
  
  # Test
  </code></pre>
  
  <p>In particular, the problematic conversion happens to <code>-\lfoot{From: K. Grant}</code> and <code>-\cfoot{To: Dean A. Smith}</code>, as seen in the output <code>.tex</code> file:</p>
  
  <pre class="lang-tex prettyprint-override"><code>\usepackage{fancyhdr}
  \pagestyle{fancy}
  \lhead{}
  \chead{}
  \rhead{The performance of new graduates}
  true
  true
  </code></pre>
  
  <p>For some reason, both of these lines are converted to <code>true</code> causing </p>
  
  <blockquote>
    <p>LaTeX error: Missing <code>\begin{document}</code></p>
  </blockquote>
  
  <p>thereby preventing the document from compiling to PDF.</p>
  
  <p>Changing <code>\lfoot</code> and <code>\cfoot</code> to just about anything else seems to lead to them being converted correctly. So what's going on here? I take it that there must be a problem with either <code>knitr</code> or <code>pandoc</code> in the conversion process.</p>
  
  <p><sup>NB: I'm not too familiar with R Markdown, and this is a follow-up question to <a href="https://tex.stackexchange.com/questions/226489/headers-and-footers-created-in-fancyhead-not-shown-in-pdf-using-knitr">Headers and footers created in Fancyhead not shown in PDF</a> on TeX.SX on Tom's behalf.</sup></p>