gpt4 book ai didi

r - 如何在 R markdown 中向 fig.cap 添加 LaTeX 符号?

转载 作者:行者123 更新时间:2023-12-03 20:50:40 24 4
gpt4 key购买 nike

有没有办法添加 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com