Reputation: 1007
So far this gives me the result I want.
<img align="right" src="images/cobre.png">
But I'd like to put a centered caption below the image. How can I do that?
Upvotes: 2
Views: 1142
Reputation: 22659
HTML output can be styled via CSS. The styles can either be included directly in the text, or put into a separate CSS stylesheet.
Here is how to use inline CSS:
```{=html}
<style type="text/css">
.figure {
float: right;
text-align: center;
}
</style>
```
``` {r fig.cap = "Insert caption here", echo=FALSE}
knitr::include_graphics("images/cobre.png")
```
The advantage of using knitr::include_graphics
over raw HTML is that include_graphics
will also work for other output formats like word and pdf (although the figure won't be right aligned for these formats).
Upvotes: 4