title: TikZ in R Markdown
body: <p>R Markdown is a good tool for document authoring. It can use LaTeX statement in R Markdown directory. But when I try to insert a Ti<em>k</em>Z picture, I am lost about how to add preamble <code>\usepackage{tikz}</code> in it, so compile will fail.</p>
  
  <p>Example code:</p>
  
  <pre><code>---
  title: "R Markdown with tikz picture"
  author: "Me"
  date: "January 10, 2015"
  output: beamer_presentation
  ---
  
  ## TikZ picture
  - Here is a TikZ picutre
  
  \begin{tikzpicture}
  \draw (0,0) circle (2cm);
  \end{tikzpicture}
  </code></pre>
  
  <p>Since actually it will generate a LaTeX document, so it's fine to just add it in LaTeX and then compile it to PDF but I wish I can just do it in R Markdown, then click the "Knit to PDF" button to generate PDF document directly.</p>