title: Caption above figure using knitr (LaTeX/PDF)
body: <p>I would like to place the caption above the figure using knitr in texmaker.
  <a href="https://stackoverflow.com/questions/22335542/knitr-figure-captions-above">I know that this question has already been asked</a>, and I understand that the solution suggested so far is to use:</p>
  
  <pre><code>\begin{figure} 
  \caption{This is a caption above the figure} 
  &lt;&lt;a-plot, echo=FALSE&gt;&gt;= 
  plot(1) 
  @ 
  \end{figure} 
  </code></pre>
  
  <p>But in this way I cannot show the code (since <code>echo=FALSE</code>).
  And if I choose instead <code>echo=TRUE</code>, what I get is the caption, then the codes, and then the graph, which is also not what I want.
  What I would like to show is the code for <code>R</code>, (<em>and</em>) the graph plotted with that <code>R</code> code, with the caption <em>above</em> the graph.</p>