title: How to convert R Markdown to PDF?
body: <p>I've previously asked about the <a href="https://stackoverflow.com/q/10646665/180892">commands for converting R Markdown to HTML</a>. </p>
  
  <p><strong>What is a good way to convert R Markdown files to PDF documents?</strong></p>
  
  <p>A good solution would preserve as much as possible of the content (e.g., images, equations, html tables, etc.). The solution needs to be able to be run from the command-line. A good solution would also be cross-platform, and ideally minimise dependencies to make it easier to share makefiles and so forth.</p>
  
  <p>Specifically, there are a lot of options:</p>
  
  <ul>
  <li>Whether to convert RMD to MD to HTML to PDF; or RMD to MD to PDF; or RMD to PDF</li>
  <li>If using the <code>markdown</code> package in R, which options to specify</li>
  <li>Whether to use <code>pandoc</code>, a package built into R, or something else</li>
  </ul>
  
  <p>Here's an example <a href="https://gist.github.com/jeromyanglim/2716336" rel="noreferrer">rmd file</a> that presumably provides a reasonable test of any proposed solution. It was used as the basis for <a href="http://jeromyanglim.blogspot.com.au/2012/05/getting-started-with-r-markdown-knitr.html" rel="noreferrer">this blog post</a>.</p>