title: How to move the caption of a figure from the bottom to the top?
body: <p>I'm sorry if I'm overlooking something obvious, but I've Googled everything that I could think of and didn't find an answer that worked for me.</p>
  
  <p>My problem is that I'm creating figures with the ggplot2 package (with captions created in the chunk options with "fig.cap = xy") and tables with the kable package. Now the thing is, that when knitted to PDF, the captions for the tables are automatically created on top of the table and the captions for the figures on the bottom. I would like a uniform look to my PDF, so I would like to have the captions of the tables and figures both on top.</p>
  
  <p>What has been suggested was using <code>- \usepackage{floatrow}</code> and <code>- \floatsetup[figure]{capposition=top}</code> in the yaml, but when I try this I this error when trying to knit to PDF:</p>
  
  <pre><code>"! Package floatrow Error: Do not use float package with floatrow.
  (floatrow)                The latter will be skipped.
  
  Error: Failed to compile test.tex. See test.log for more info.
  Execution stopped"
  </code></pre>
  
  <p>The log has the following at it's end:</p>
  
  <blockquote>
    <p>"!  ==> Fatal error occurred, no output PDF file produced!"</p>
  </blockquote>
  
  <p>Those are my "header-includes" in the yaml:</p>
  
  <pre><code>- \usepackage[below]{placeins}
  - \usepackage{setspace}
  - \usepackage{flafter}
  - \usepackage{chngcntr}
  - \counterwithout{figure}{section}
  - \counterwithout{table}{section}
  - \usepackage{microtype}
  - \floatplacement{figure}{H}
  - \floatplacement{table}{H}
  - \usepackage{floatrow}
  - \floatsetup[figure]{capposition=top}
  </code></pre>
  
  <p>And those my packages used:</p>
  
  <pre><code>library(plyr)
  library(readxl)
  library(xlsx)
  library(markdown)
  library(rmarkdown)
  library(knitr)
  library(kableExtra)
  library(ggplot2)
  library(reshape2)
  library(httpuv)
  formatlibrary(caTools)
  </code></pre>
  
  <p>Is there a workaround for this? Or is there another way to get the caption of the figure on top of the figure?</p>
  
  <p>Edit1: I narrowed it down to the package "kableExtra" causing this problem, even though the "float" package doesn't appear as loaded in the sessionInfo(). After removing it and all it's code I ran into another error:</p>
  
  <pre><code>! Undefined control sequence.
  &lt;recently read&gt; \floatplacement 
  </code></pre>
  
  <p>After removing </p>
  
  <pre><code>- \floatplacement{figure}{H}
  - \floatplacement{table}{H}
  </code></pre>
  
  <p>from the yaml it knitred successfully. The caption is now on top but everything else is a mess now. I can probably manage without the "kableExtra" package, but not without the "floatplacement" in the yaml.</p>
  
  <p>Every suggestion would be appreciated!</p>