title: can I produce a figure caption in r markdown with eval=false?
body: <p>If I have the MWE:</p>
  
  <pre><code>---
  
  title: "Example"
  output:
    pdf_document:
      fig_caption: yes
  
  ---
  
  
  Text text text
  
  
  ```{r fig.cap="Figure 1. Some random numbers",eval=FALSE}
  summary(cars) 
  ```
  </code></pre>
  
  <p>then I do not get a caption. But if I do:</p>
  
  <pre><code>---
  title: "Example"
  output:
    pdf_document:
      fig_caption: yes
  ---
  
  
  Text text text
  
  
  ```{r fig.cap="Figure 1. Some random numbers"}
  summary(cars) 
  ```
  </code></pre>
  
  <p>i.e. remove <code>eval=FALSE</code> then the caption no longer loads.</p>
  
  <p>why I wish to do this?</p>
  
  <p>I want to put example bits of code into my document. the code won't actually work, hence why I want to supress it. Something like</p>
  
  <pre><code>---
  
  title: "Example"
  output:
    pdf_document:
      fig_caption: yes
  ---
  
  
  Text text text
  
  
  ```{r fig.cap="Figure 1. Some random numbers",eval=FALSE}
  for (i in 1:length(c){
  #do something
  }
  ```
  </code></pre>
  
  <p>where I am merely demonstrating a for loop, but not actually running the code.</p>