[英]How to add a LaTeX symbol to fig.cap in R markdown?
有沒有辦法添加LaTeX符號,如infinity \\infty
到R markdown中的字幕?
我可以讓LaTeX文本格式化工作,但我無法找到使用符號的方法。
以下是使用LaTeX文本格式的工作示例:
---
output:
pdf_document:
fig_caption: yes
---
```{r setup, include=FALSE}
library(knitr)
opts_chunk$set(
echo=FALSE,
message=FALSE,
warning=FALSE,
fig.align = 'center'
)
```
## Testing LaTeX syntax within captions
```{r pressure, fig.cap="\\label{testPlot}This caption has LaTeX with
{\\small small text} and some {\\footnotesize footnote text and
\\textbf{bold footnote}} and \\textit{italic}"}
plot(pressure)
```
我已經嘗試了我能想到的每一個組合都沒有效果。 例如,雙重轉義\\\\infty
,括號{\\infty}
,括號{\\\\infty}
內的雙重轉義,使用內聯LaTeX $\\infty$
,內聯轉義等。
任何建議將不勝感激。
$\\\\infty$
有效。 你需要轉義\\
in \\infty
和IIRC這是一個數學模式符號,所以你也需要調用它。
```{r pressure, fig.cap="\\label{testPlot}This caption has LaTeX with {\\small small text} and some {\\footnotesize footnote text and \\textbf{bold footnote}} and \\textit{italic} and $\\infty$"}
plot(1:10)
```
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.