更改 RMarkdown pdf 输出中图形标题的字体大小
Changing the font size of figure captions in RMarkdown pdf output
我想缩小我的 R Markdown 文档中所有标题(图形和表格)的字体大小。我正在使用书本。最终输出为 pdf,我在 R Studio 中工作。为了加载图片,我使用了 knitr
中的 include_graphics
函数,因为有人告诉我这是最好的方法(参见 here)。
我只找到了完全相同的问题,但是对于 html 输出
一个例子.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')
```
如您所见,字幕字体大小和常规文本字体大小完全相同,看起来不太好。我该如何解决这个问题?
如果可以接受使用 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
包:
我想缩小我的 R Markdown 文档中所有标题(图形和表格)的字体大小。我正在使用书本。最终输出为 pdf,我在 R Studio 中工作。为了加载图片,我使用了 knitr
中的 include_graphics
函数,因为有人告诉我这是最好的方法(参见 here)。
我只找到了完全相同的问题,但是对于 html 输出
一个例子.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')
```
如您所见,字幕字体大小和常规文本字体大小完全相同,看起来不太好。我该如何解决这个问题?
如果可以接受使用 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
包: