1. 新建命令
使用如下的命令:\newcommand{name}[num]{definition}
;
该命令(newcommand)有两个参数,第一个 name
是你想要建立的命令的名称,第二个definition
是命令的定义,num
是可选的,用于指定新命令所需的参数数目(最多 9 个)。如果不给出这个参数,默认就是 0。新建命令的使用和内置命令没有明显的区别。
1),替代经常出现的文本内容
\newcommand{\tnss}{The not so Short Introduction to \LaTeX}
- 1
含参数,
\newcommand{\txist}[1]{This is the \emph{#1} Short Introduction to \LaTeX}\txist{not so}\\\txist{very}
- 1
- 2
- 3
- 4
- 5
2. def
为了书写的方便;
\def\E{\mathrm{E}}\def\Var{\mathrm{Var}}\def\Cov{\mathrm{Cov}}
- 1
- 2
- 3
3. 举例
逆时针 ⊨ ⊨ 反转 90°
\usepackage{amsmath, graphicx}\newcommand{\indep}{\rotatebox[origin=c]{90}{$\models$}}
- 1
- 2
定义完成之后,便可以使用了:
$X \indep Y$
- 1
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow