Resize image caption font in HTML RMarkdown output

I would like to reduce the font size for all image captions in the R Markdown document. The end result is HTML, and I work in R Studio. To load an image, I use the include_graphicsfrom function knitrbecause I was told that this is the best way (see here ). My .Rmd file:

---
title: "ppp"
author: "ppp"
date: "July 4, 2017"
output: 
  html_document: 
    fig_caption: yes
---

```{r setup, include=FALSE}
library(knitr)
opts_chunk$set(echo = FALSE)
```


```{r foo, fig.cap="$f_{p}$ as a function of $g$ for various values of $r=\\frac{\\rho_{w}}{\\rho_{a}}$"}
# All defaults
include_graphics("download.jpg")
``` 

This is regular text.

Corresponding conclusion: enter image description here

As you can see, the font size of the header and the font size of the plain text are exactly the same, which doesn’t look so good. How can I solve this problem?

+4
source share
1 answer

CSS Rmd (- YAML):

<style>
p.caption {
  font-size: 0.6em;
}
</style>

:

(Chrome: β†’ Inspect), , HTML caption:

<p class="caption"> ... </p>

CSS- ( ) 60% .


enter image description here

+8

Source: https://habr.com/ru/post/1681136/


All Articles