![](/img/trans.png)
[英]Changing the font size of figure captions in RMarkdown HTML output
[英]Changing the font size of figure captions in RMarkdown pdf output
我想縮小我的R Markdown文檔中所有標題(圖和表格)的字體大小。 我正在使用書本。 最終輸出是pdf,我正在R Studio中工作。 要加載圖片,我使用了knitr
的include_graphics
函數,因為有人告訴我這是最好的方法(請參閱此處 )。
我只找到了完全相同的問題,但此處為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
包:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.