r - 如何在 R markdown 中将 LaTeX 符号添加到 fig.cap?
问题描述
有没有办法\infty
在 R markdown 中添加 LaTeX 符号,比如无穷大图标题?
我可以让 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)
```
推荐阅读
- android - 在edittext中显示可编辑的html
- python - Python - 使用 Numpy 的扫雷:如何计算每个图块周围的炸弹?
- r - 如何反转 log2 变换
- java - @WebMvcTest 失败,因为正在寻找 mongoTemplate bean
- java - 为表格列中的每一行设置不同的组合框作为单元格内容
- python - Python List Comprehensions - 对于 1-1000 的所有数字,使用列表理解来查找任何数字可被除以的最高单个数字
- c - C程序用字符串数组替换字符串
- ios - 如何等待具有不同有效负载的多个 PromiseKit 承诺?
- haskell - 证明自然数类型级加法的交换律
- r - 从 xts 对象查询 index() 时如何检索时间?