我想使R Markdown文档中所有标题(图和表格)的字体变小。我正在使用书本。最终输出是pdf,我正在R Studio中工作。要加载图片,我使用了include_graphics
中的knitr
函数,因为有人告诉我这是最好的方法(请参阅here)。
我只找到了完全相同的问题,但是对于html输出here
示例.rmd
:
---
output: pdf_document
---
Normal text has the same size as the captions.
```{r, echo = FALSE, out.width = '50%', fig.cap = "The caption has the same size as normal text."}
knitr::include_graphics('logo.png')
```
如您所见,标题字体大小和常规文本字体大小完全相同,看起来并不好。我该如何解决这个问题?
答案 0 :(得分:3)
如果可以使用LaTeX软件包,则可以使用caption
---
output: pdf_document
header-includes:
- \usepackage{caption}
- \captionsetup[figure]{font=scriptsize}
---
Normal text has the same size as the captions.
```{r, echo = FALSE, out.width = '50%', fig.cap = "The caption has the same size as normal text."}
knitr::include_graphics('logo.png')
```
替换scriptsize
更改大小。您可以在此处找到默认LaTeX字体大小的列表:
https://en.wikibooks.org/wiki/LaTeX/Fonts#Built-in_sizes
CTAN上的caption
软件包: