title: R Markdown Error compiling
body: <p>I am trying to write a Latex document with the help of the package R Markdown.
  I have always been using software such as TaxMaker, but considering that I will be using R to produce several plots I would like to try the R Markdown package.</p>
  
  <p>So far I have a very simple code just to try and understand it it works. Here there is the document</p>
  
  <pre><code>---
  title: "Untitled"
  output: pdf_document
  ---
  \documentclass{article}
  \usepackage{amsmath}
  \usepackage{graphicx}
  \usepackage{hyperref}
  \usepackage[latin1]{inputenc}
  
  \title{My Title}
  \author{Me}
  \date{}
  
  \begin{document}
  \maketitle
  
  \end{document}
  </code></pre>
  
  <p>However this does not compile:</p>
  
  <pre><code>! LaTeX Error: Can be used only in preamble.
  
  Error: Failed to compile 1.tex. See 1.log for more info.
  Execution halted
  </code></pre>
  
  <p>The same code works perfectly in a standard Latex environment.</p>
  
  <p>What am I missing?
  Thanks</p>