LaTeX header for Physicists
用LaTex作物理笔记时,有一些符号打起来很麻烦却反复出现。我们可以定义更简短的命令以增加输入速度。比如这篇博文LaTeX for Physicists就是这么做的。
我根据自己需要又作了一些增改,把它贴上来跟大家分享。嗯,感觉还得要个天文版的。
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert} % for absolute value
\newcommand{\avg}[1]{\left\langle #1 \right\rangle} % for average
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert} % for norm
\let\f=\frac
\let\tf=\tfrac
\let\df=\dfrac
\let\rm=\mathrm
\let\bm=\boldsymbol
\let\overring=\r
\let\lslash=\l %l with a stroke
\renewcommand{\r}{\right}
\renewcommand{\l}{\left}
\let\vaccent=\v % rename builtin command \v{} to \vaccent{}
\renewcommand{\v}[1]{\boldsymbol{#1}} % for vectors
\newcommand{\uv}[1]{\hat{\boldsymbol{#1}}} % for unit vector
\let\underdot=\d % rename builtin command \d{} to \underdot{}
\renewcommand{\d}[2]{\dfrac{\mathrm{d} #1}{\mathrm{d} #2}} % for derivatives
\newcommand{\dd}[2]{\dfrac{\mathrm{d}^2 #1}{\mathrm{d} #2^2}} % for double derivatives
\newcommand{\pd}[2]{\dfrac{\partial #1}{\partial #2}} % for partial derivatives
\newcommand{\ppd}[2]{\dfrac{\partial^2 #1}{\partial #2^2}} % for double partial derivatives
\newcommand{\mpd}[3]{\dfrac{\partial^2 #1}{\partial #2 \partial #3}} % for mixed partial derivatives
\newcommand{\dif}{\mathrm{d}} %upright d for diffrential
\newcommand{\me}{\mathrm{e}} %constant e
\newcommand{\mi}{\mathrm{i}} %constant i
%\DeclareMathOperator{\me}{e} %which is better?
\let\divsymb=\div % rename builtin command \div to \divsymb
\renewcommand{\div}[1]{\nabla \cdot #1} % for divergence
\newcommand{\grad}[1]{\nabla #1} % for gradient
\newcommand{\rot}[1]{\nabla \times #1} % for curl
- 上一篇: Cython 与 Numpy 数组
- 下一篇: 天文中的速度参考系