title: How to make a figure caption in Rmarkdown?
body: <p>I am thinking about writing my thesis with rmarkdown and latex. I'm getting the hang of how it all works, however, when I try to add a figure (not an R plot) to the text and render it to pdf, the caption and in-text reference dissappear. </p>
  
  <p>This is the code snippet I use to add a figure:</p>
  
  <pre><code>---
  title: "Untitled"
  output: pdf_document
  ---
  
  see figure \ref{fig1}.
  
  ![picture \label{fig1}](figure1.png)
  </code></pre>
  
  <p>This is what knitr creates: 
  <a href="https://i.stack.imgur.com/NoFL9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NoFL9.png" alt=""></a>
  </p>
  
  <p>This is what pandoc creates:
  <a href="https://i.stack.imgur.com/OhIPx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OhIPx.png" alt=""></a>
  </p>
  
  <p>Question:
  <em>How do I make figure captions and in-text references to those figures in Rmarkdown that will display when rendered to pdf?</em></p>
  
  <p>OR</p>
  
  <p><em>How do I tell pandoc what Rmarkdown is so it will render R code and plots?</em></p>