如何在 Rmd 中使用 Latex' \newcommand?

2024-01-25

我想做以下工作

---
title: "Untitled"
author: "SQC"
date: "21 September 2018"
output: html_document
---

\newcommand{\short}{AreallylongwordIhavetotypefrequently}

# My Test
I would like to write \short which does not work, $\short$ however is close... 
Snippets do not work in Rmd plain text (= Rstudio's "Shift", see link below).

但我找不到解决办法。如果周围有东西就好了! 以下链接很有帮助,但没有提出解决方案:潘多克文档 https://rmarkdown.rstudio.com/authoring_pandoc_markdown.html%23raw-tex#latex_macros, Rmd 公式中的 \newcommand https://stackoverflow.com/q/41655383/5784831 and RStudio 片段 https://stackoverflow.com/q/37748516/5784831.


使用 R 代替怎么样:

---
title: "Untitled"
author: "SQC"
date: "21 September 2018"
output: html_document
---

```{r, include = FALSE}
short <- "AreallylongwordIhavetotypefrequently"
```

# My Test
I would like to write `r short` instead ...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Rmd 中使用 Latex' \newcommand? 的相关文章

随机推荐