How can I use Latex' \newcommand in Rmd?

こ雲淡風輕ζ 提交于 2020-05-14 18:29:25

问题


I would like to make the following work

---
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).

But I could not find a solution. It would be great if there is something around! The following links are helpful, but didn't suggest a solution: pandoc doc, \newcommand in Rmd formula and RStudio snippets.


回答1:


How about using R instead:

---
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 ...


来源:https://stackoverflow.com/questions/52438607/how-can-i-use-latex-newcommand-in-rmd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!