[英]Passing italics through fig.scap (table of figures) or fig.cap (captions) in Rmarkdown
[英]Short caption fig.scap in knitr not working?
我知道使用 fig.scap 應該提供一個用於圖表的短標簽,但它沒有,它使用長標簽。 有任何想法嗎? Rstudio 版本 0.98.1091。
---
output:
pdf_document:
fig_caption: yes
---
\listoffigures
```{r, fig.cap="long caption",fig.scap="short"}
plot(1:4)
```
此選項最初僅用於 .Rnw 文檔。 它不適用於 .Rmd 文件。 但是,您可以通過指定任何塊選項out.width
、 out.height
和fig.align
來觸發 R Markdown 繪圖的 LaTeX 輸出。 例如,
---
graphics: yes
output:
pdf_document:
fig_caption: yes
---
\listoffigures
```{r, fig.cap="long caption", fig.scap="short", fig.align='center'}
plot(1:4)
```
請注意,您需要 knitr >= 1.8(目前在 CRAN 上)和 Pandoc >= 1.13.1(請參閱下面的評論)。 YAML 元數據graphics: yes
確保 Pandoc 知道文檔中的圖形輸出(在這里解釋太技術性了)。
更新:使用knitr >= v1.26.4,不需要特殊處理(例如fig.align = 'center'
); 使用fig.scap
將生成正確的 LaTeX 輸出。 由於其他人又問了同樣的問題, 我決定在 Github 上解決這個問題,你需要
remotes::install_github('yihui/knitr')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.