使用以下語句可以定義自己的快捷命令拆吆,需要重復(fù)使用的命令時(shí),定義一些短小命令來代替會(huì)很方便蚌吸。
\newcommand{\yourcommand}[參數(shù)個(gè)數(shù)]{內(nèi)容}
如果你要定義的縮寫命令已經(jīng)存在時(shí),以上命令會(huì)報(bào)錯(cuò)砌庄,這是可以使用
\renewcommand{\yourcommand}[參數(shù)個(gè)數(shù)]{內(nèi)容}
來強(qiáng)行覆蓋可能已有的命令羹唠。
例子:
\newcommand{\beq}{\begin{equation*}}
\newcommand{\eeq}{\end{equation*}}
\newcommand{\bm}{\begin{bmatrix}}
\renewcommand{\em}{\end{bmatrix}}
\renewcommand{\b}{\boldsymbol}
The eigen values of $\b{\Sigma}$ are
\beq
\lambda_1 = 2, \lambda_2 = \lambda_3 = 4.
\eeq
and the corresponding eigen vectors are
\beq
v_1 = \bm 1 \\ 0 \\ 0 \em, v_2 \bm 0\\1\\0 \em, v_3 = \bm 0 \\ 0 \\1 \em.
\eeq