After trying many of the community's proposals and failing to place the title of the figure at the top.

I thought that I could redefine the default figure in latex, specifically the one corresponding to the document class article, if they are different depending on the class.

I saw something similar but now I can't find it.

  • Do you have tried caption package? Nov 7, 2021 at 23:08
  • 1
    what do you mean by the title of the figure? in article class figures have captions given by \caption and it is placed where you place it in the source above or below the image depending if \caption is before or after \includegraphics Nov 7, 2021 at 23:17
  • I use rmarkdown and knitr Nov 7, 2021 at 23:22
  • What would be the parameters to define the caption of figures at the top when including the package caption? usepackage[PARAMETERS]{caption} Nov 7, 2021 at 23:43
  • sure but this is a latex question, the default code in article class does not position the caption at all so it's like asking to write two one instead of one two latex does nothing here, it just outputs the caption and image in the order you write them, so it is very hard to answer your question. Nov 7, 2021 at 23:44

2 Answers 2


Written in markdown and compiled with knitr, you can have the caption at the top like this:

  - \usepackage{floatrow}
  - \floatsetup[figure]{capposition=top}
```{r message=FALSE, echo=FALSE}

```{r fig.cap="Diamonds", message=FALSE, echo=FALSE}
ggplot(data=diamonds,aes(x=price,y=carat,colour=cut)) + geom_point()

enter image description here


Hope that this is self-explanatory.

% Provides example-image afaik.

% for [H] placement option (force manually defined position)


\textbf{\figurename~\ref{fig:CaptionAbove}} has the caption \textbf{above} and \textbf{\figurename~\ref{fig:CaptionBelow}} has the caption \textbf{below}.

    \caption{Caption Above}
    %\caption{Caption Below}

    %\caption{Caption Above}
    \caption{Caption Below}


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .