有没有办法添加 LaTeX 符号,比如无穷大 \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$
作品。您需要逃离 \
在 \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)
```
关于r - 如何在 R markdown 中向 fig.cap 添加 LaTeX 符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52211695/