R Markdown具有类似于"newcommand"的功能.在LaTex? [英] R Markdown similar feature to "newcommand" in LaTex?

查看:345
本文介绍了R Markdown具有类似于"newcommand"的功能.在LaTex?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R Markdown是否具有与LaTex的"newcommand"类似的结构?我希望能够将\var之类的内容定义为\mathrm{Var},以避免在数学模式下进行额外键入.如果不是,人们将如何减少Markdown排版排版中的重复?

Does R Markdown have a similar construct to LaTex's "newcommand"? I would like to be able to define things like \var to be \mathrm{Var} to avoid the extra typing in math mode. If not, what do people do to reduce repetition in typesetting equations in markdown?

推荐答案

就像在LaTeX中一样使用\newcommand{\var}{\mathrm{Var}}:

Use \newcommand{\var}{\mathrm{Var}} exactly like you would in LaTeX:

---
title: "Untitled"
author: "An Author"
date: "January 15, 2017"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

\newcommand{\var}{\mathrm{Var}}

## R Markdown

This is an R Markdown document. $\var+2$ Markdown is a simple formatting syntax for 
authoring HTML, PDF, and MS Word documents. For more details on using R Markdown 
see <http://rmarkdown.rstudio.com>.

请注意,为了在输出中正确处理它,您必须使用$ ... $.

Note that in order for it to be processed correctly in the output, you'll have to use $...$.

这篇关于R Markdown具有类似于"newcommand"的功能.在LaTex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆