How to customize font size of Figure Caption in a quarto pdf document? I have checked about the mainfont
and fontfamily
options, but the documentation doesn't provide examples of how to use change the font size for individual elements in a pdf document.
Since for pdf output, ultimately latex is used, you just need to find the corresponding latex solution to do what you want to do and incorporate those latex codes using LaTex Includes
.
So to change the figure caption size, we can use the caption
package. From section 2.3 of the caption
package manual,
There are three font options which affect different parts of the caption: One affecting the whole caption (
font
), one which only affects the caption label and separator (labelfont
) and at least one which only affects the caption text (textfont
).
You set them up using the options
font={⟨font options⟩}
,labelfont={⟨font options⟩}
, andtextfont={⟨font options⟩}
, where ⟨font options⟩ is a list of comma separated font options.
And these are the available font options:
scriptsize
=> Very small sizefootnotesize
=> The size usually used for footnotessmall
=> Small sizenormalsize
=> Normal sizelarge
=> Large sizeLarge
=> Even larger sizeRead the manual (section 2.3) to know the details and more options.
---
title: "Figure Caption Size"
format:
pdf:
include-in-header:
text: |
\usepackage[font=Large,labelfont={bf,Large}]{caption}
---
## Quarto
```{r}
#| fig-cap: "Just a scatterplot"
plot(rnorm(1:10), rnorm(1:10))
```