如何在R markdown中添加LaTeX符号到fig.cap?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在R markdown中添加LaTeX符号到fig.cap?相关的知识,希望对你有一定的参考价值。

有没有办法添加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$的作品。你需要逃离和IIRC中的infty,这是一个数学模式符号,所以你也需要调用它。

```{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 markdown中添加LaTeX符号到fig.cap?的主要内容,如果未能解决你的问题,请参考以下文章