我想缩小 R Markdown 文档中所有标题(图形和表格)的字体大小。我用的是bookdown。最终输出是 pdf,我正在 R Studio 中工作。为了加载图片,我使用include_graphics
函数来自knitr
,因为有人告诉我这是最好的方法(请参阅here http://www.zevross.com/blog/2017/06/19/tips-and-tricks-for-working-with-images-and-figures-in-r-markdown-documents/#default-settings-for-including-images-and-figures-in-r-markdown).
我只找到了完全相同的问题,但是对于 html 输出here https://stackoverflow.com/questions/45018397/changing-the-font-size-of-figure-captions-in-rmarkdown-html-output/45022100#45022100
一个例子.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')
```
正如你所看到的,标题字体大小和常规文本字体大小是exactly一样的,看起来不太好。我怎么解决这个问题?
如果使用 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')
```
Replace scriptsize
改变尺寸。您可以在此处找到默认 LaTeX 字体大小的列表:
https://en.wikibooks.org/wiki/LaTeX/Fonts#Built-in_sizes https://en.wikibooks.org/wiki/LaTeX/Fonts#Built-in_sizes
The caption
CTAN 上的包:
https://ctan.org/pkg/caption https://ctan.org/pkg/caption
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)