Created
March 18, 2015 02:11
-
-
Save drewsberry/4d15227dd758dcf232a7 to your computer and use it in GitHub Desktop.
Preamble defining new maths commands for LaTeX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% New definition of square root: | |
% it renames \sqrt as \oldsqrt | |
\let\oldsqrt\sqrt | |
% it defines the new \sqrt in terms of the old one | |
\def\sqrt{\mathpalette\DHLhksqrt} | |
\def\DHLhksqrt#1#2{% | |
\setbox0=\hbox{$#1\oldsqrt{#2\,}$}\dimen0=\ht0 | |
\advance\dimen0-0.2\ht0 | |
\setbox2=\hbox{\vrule height\ht0 depth -\dimen0}% | |
{\box0\lower0.4pt\box2}} | |
\DeclarePairedDelimiter\abs{\lvert}{\rvert}% | |
\DeclarePairedDelimiter\norm{\lVert}{\rVert}% | |
% Swap the definition of \abs* and \norm*, so that \abs | |
% and \norm resizes the size of the brackets, and the | |
% starred version does not. | |
\makeatletter | |
\let\oldabs\abs | |
\def\abs{\@ifstar{\oldabs}{\oldabs*}} | |
% | |
\let\oldnorm\norm | |
\def\norm{\@ifstar{\oldnorm}{\oldnorm*}} | |
\makeatother | |
\newcommand{\defeq}{\stackrel{\mathclap{\normalfont\mbox{\tiny def}}}{=}} | |
\newcommand{\dbydt}[1]{\frac{\partial #1}{\partial t}} | |
\newcommand{\logg}[1]{\log \left\{ #1 \right\}} | |
\newcommand{\Ree}[1]{\Re \left\{ #1 \right\}} | |
\newcommand{\Imm}[1]{\Im \left\{ #1 \right\}} | |
\newcommand{\basis}[1]{\mathbf{\hat #1 }} | |
\newcommand{\basisgreek}[1]{\bm{\hat{ #1 }}} | |
\newcommand{\mymu}[0]{\frac{m \Omega}{\hbar}} | |
\newcommand{\colvec}[3]{\begin{pmatrix} #1 \\ #2 \\ #3 \end{pmatrix}} | |
\newcommand{\comm}[2]{\left[ #1 , #2 \right]} | |
\newcommand{\moyal}[2]{\left\{ \left\{ #1, #2 \right\} \right\}} | |
\newcommand{\poiss}[2]{\left\{ #1, #2 \right\}} | |
% Properly formatted integral 'd's | |
\newcommand*\dee{\mathop{}\!\mathrm{d}} | |
\newcommand*\Dee[1]{\mathop{}\!\mathrm{d^#1}} | |
\newcommand*\fdee{\mathscr{D}} | |
\newcommand*\fDee[1]{\mathscr{D^#1}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment