local_cmmds.tex: Add \iref, \fref, and \xref
[thesis.git] / src / local_cmmds.tex
1 % String comparison for \fref
2 \makeatletter
3 \long\def\isequal#1#2{\pdf@strcmp{#1}{#2}}
4 \makeatother
5
6 % An reference index from an unspecified source
7 % usage: \iref{value}
8 % for example: \iref{75}
9 \newcommand{\iref}[1]{(#1)}
10
11 % A formatted reference from an unspecified source
12 % usage: \fref{environment}{value}
13 % for example: \fref{figure}{75}
14 \newcommand{\fref}[2]{%
15   \switch
16   \case{\isequal{#1}{equation}}
17     Eqn.~\iref{#2}
18   \case{\isequal{#1}{figure}}
19     Fig.~\iref{#2}
20   \otherwise
21     \PackageError{fref}{
22       \MessageBreak
23       environment value >#2< unknown \MessageBreak
24     }{possible values are: equation. \MessageBreak}
25   \endswitch
26 }
27
28 % References to external figures, equations, etc.
29 % usage: \xref{key}{environment}{value}
30 % for example: \xref{roman12}{figure}{75}
31 \newcommand{\xref}[3]{\citet{#1}'s \fref{#2}{#3}}
32
33 % Fourier Transform to angular momentum space
34 \newcommand{\Four}[1]{\ensuremath{{\mathcal F}\left\{ {#1} \right\}}}
35 % Fourier Transform to frequency space
36 \newcommand{\Fourf}[1]{\ensuremath{{\mathcal F}_f\left\{ {#1} \right\}}}
37
38 % Symbol denoting the Langevin function
39 \newcommand{\Langevin}{\ensuremath{\mathcal{L}}}
40 % Symbol denoting big-O order of #1
41 \newcommand{\order}[1]{\ensuremath{\mathcal{O}\p({#1})}}
42
43 % Integral from #1 to #2 of #4 with respect to #3
44 \newcommand{\integral}[4]{\ensuremath{\int_{#1}^{#2} {#4} \dd{#3}}}
45 % Integral from -infty to +infty of #2 with respect to #1
46 \newcommand{\iInfInf}[2]{\integral{-\infty}{\infty}{#1}{#2}}
47 % Integral from 0 to +infty of #2 with respect to #1
48 % note that the second char in the name is a capital o, not a 0
49 % because ?Latex doesn't allow digits in command names
50 \newcommand{\iOInf}[2]{\integral{0}{\infty}{#1}{#2}}
51 % #3 evaluated at #2 and #1
52 \newcommand{\evaluated}[3]{\ensuremath{\left.{#3}\right|_{#1}^{#2}}}
53 % #2 evaluated at #1
54 \newcommand{\eval}[2]{\ensuremath{\left.{#2}\right|_{#1}}}
55 % evaluated at infty and -infty
56 \newcommand{\eInfInf}[1]{\evaluated{-\infty}{\infty}{#1}}
57 % evaluated at infty and 0
58 \newcommand{\eOInf}[1]{\evaluated{0}{\infty}{#1}}
59
60 % we do a lot of lim t_T -> infty, so macro that out
61 % lim as #1 -> infty
62 \newcommand{\limInf}[1]{\ensuremath{\lim_{{#1}\rightarrow \infty}}}
63 \newcommand{\limT}{\limInf{t_T}}
64 \newcommand{\normLimT}{\limT \frac{1}{t_T}\ } % '\ ' for a normal space
65 % lim as t_T -> infty of integral from -t_T/2 to t_T/2 of #1 with respect to t
66 \newcommand{\iLimT}[1]{\normLimT \integral{-t_T/2}{t_T/2}{t}{#1}}
67
68 \newcommand{\magSq}[1]{\ensuremath{\left|{#1}\right|^2}}
69 \newcommand{\PSD}{\ensuremath{\operatorname{PSD}}}
70
71 % complex conjugate
72 \newcommand{\conj}[1]{\ensuremath{\overline{#1}}}
73
74 % Symbol denoting the contour C
75 \newcommand{\C}{\ensuremath{\mathcal{C}}}
76 % Integral about contour C of #1 with respect to z
77 \newcommand{\iC}[1]{\integral{\C}{}{z}{#1}}
78 \newcommand{\Reals}{\ensuremath{\mathds{R}}}
79 \newcommand{\Imags}{\ensuremath{\mathds{I}}}
80 \newcommand{\Real}{\ensuremath{\operatorname{Re}}}
81 \newcommand{\Imag}{\ensuremath{\operatorname{Im}}}
82 \newcommand{\ResX}[3]{\operatorname{Res}\left({{#1}={#2}},{#3}\right)}
83 \newcommand{\Res}[2]{\ResX{z}{#1}{#2}}
84 \newcommand{\limX}[2]{\lim_{{#1} \rightarrow {#2}}}
85 \newcommand{\limZ}[1]{\limX{z}{#1}}
86 \newcommand{\limZp}{\limZ{z_p}}
87 \newcommand{\CPV}{\ensuremath{\mathds{P}}}
88
89 \newcommand{\supScript}[1]{\ensuremath{^{\text{#1}}}}
90 \newcommand{\st}{\supScript{st}}
91 \newcommand{\nd}{\supScript{nd}}
92 \newcommand{\rd}{\supScript{rd}}
93 \newcommand{\sth}{\supScript{th}} % th, TH already taken
94
95 \newcommand{\colA}[1]{\textcolor{red}{#1}}
96 \newcommand{\colB}[1]{\textcolor{blue}{#1}}
97 \definecolor{purple}{rgb}{0.8, 0, 0.8}
98 \newcommand{\colAB}[1]{\textcolor{purple}{#1}}
99 \newcommand{\colC}[1]{\textcolor{green}{#1}}
100
101 \newcommand{\cf}{\emph{cf.}} % "confer" or "bring together" / "compare"
102 \newcommand{\ie}{\emph{i.e.}} % "id est" or "in other words"
103 \newcommand{\insilico}{\emph{in silico}} % quasi latin for "on a computer"
104 \newcommand{\invitro}{\emph{in vitro}}   % latin for "in glass"
105 \newcommand{\invivo}{\emph{in vivo}}     % latin for "in living organisms"
106
107 \newcommand{\ensuretext}[1]{\ensuremath{\text{#1}}}
108 % Hyeon and Thirumalai equation number #1
109 \newcommand{\HTeq}[1]{\ensuretext{\emph{H\&T eq.\ {#1}}}}
110 \newcommand{\kT}{\ensuremath{k_B T}}
111 \newcommand{\bt}{\ensuremath{\beta}}
112 \newcommand{\fs}{\ensuremath{f^*}}
113 \newcommand{\dx}{\ensuremath{\Delta x(\fs)}}
114 \newcommand{\dxs}[1]{\ensuremath{\Delta x_{#1}(\fs)}} % for subscripting
115 \newcommand{\FO}{\ensuremath{\Delta F_0^\ddagger(\fs)}}
116 \newcommand{\vD}{\ensuremath{\nu_D(\fs)}}
117 \newcommand{\vDs}[1]{\ensuremath{\nu_{D{#1}}(\fs)}}
118 \newcommand{\kexp}{\ensuremath{\vD e^{-\bt \FO}}}
119 \newcommand{\kexps}[1]{\ensuremath{\vDs{#1} e^{-\bt_{#1} \FO_{#1}}}}
120 \newcommand{\kf}{\ensuremath{k(\fs)}}
121 \newcommand{\kfs}[1]{\ensuremath{k_{#1}(\fs)}}
122 %\newcommand{\avg}[1]{\ensuremath{\left\langle {#1} \right\rangle}}
123 \newcommand{\abs}[1]{\ensuremath{\lvert {#1} \rvert}}
124 \newcommand{\logp}[1]{\ensuremath{\log\!\!\left( {#1} \right)}}
125 % \! is a negative thin space to get the paren closer to the log
126 %\renewcommand{\r}{\ensuremath{r_f}}
127 %\newcommand{\rs}[1]{\ensuremath{r_{f{#1}}}}% to avoid double-subscripting
128 \newcommand{\ep}{\varepsilon}
129
130 \newcommand{\species}[1]{\emph{#1}} % \species{Homo sapiens}
131
132 % Chemicals
133 \newcommand{\diNaHPO}{Na\textsubscript{2}HPO\textsubscript{4}}
134 \newcommand{\NadiHPO}{NaH\textsubscript{2}PO\textsubscript{4}}
135
136 % Workaround for inline minted markup
137 %   http://code.google.com/p/minted/issues/detail?id=15
138 % usage: \imint{language}|value|
139 \NewDocumentCommand\imint{mv}{\texttt{#2}}
140
141 % Aliases for citations
142 \defcitealias{calibcant}{calibcant}
143 \defcitealias{comedi}{Comedi}
144 \defcitealias{cygwin}{Cygwin}
145 \defcitealias{cython}{Cython}
146 \defcitealias{epics}{EPICS}
147 \defcitealias{force-robot}{ForceRobot}
148 \defcitealias{gentoo}{Gentoo}
149 \defcitealias{h5config}{h5config}
150 \defcitealias{hdf5}{HDF5}
151 \defcitealias{interix}{Interix}
152 \defcitealias{king10}{sawsim}
153 \defcitealias{labview}{LabVIEW}
154 \defcitealias{picoforce}{PicoForce}
155 \defcitealias{prefix}{Gentoo Prefix}
156 \defcitealias{punias}{PUNIAS}
157 \defcitealias{pyafm}{pyafm}
158 \defcitealias{pycomedi}{pycomedi}
159 \defcitealias{pymodbus}{pymodbus}
160 \defcitealias{pymol}{PyMol}
161 \defcitealias{pypid}{pypid}
162 \defcitealias{pypiezo}{pypiezo}
163 \defcitealias{python}{Python}
164 \defcitealias{sandal09}{Hooke}
165 \defcitealias{stepper}{stepper}
166 \defcitealias{beazley96}{SWIG}
167 \defcitealias{unfold-protein}{unfold-protein}
168 \defcitealias{wavemetrics-igor}{IGOR Pro}
169 \defcitealias{xcode}{Xcode}
170 \defcitealias{yaml}{YAML}
171
172 \newcommand{\Comedi}{\citetalias{comedi}}
173 \newcommand{\Hooke}{\citetalias{sandal09}}
174 \newcommand{\calibcant}{\citetalias{calibcant}}
175 \newcommand{\hFconfig}{\citetalias{h5config}}
176 \newcommand{\pyafm}{\citetalias{pyafm}}
177 \newcommand{\pypid}{\citetalias{pypid}}
178 \newcommand{\pypiezo}{\citetalias{pypiezo}}
179 \newcommand{\pycomedi}{\citetalias{pycomedi}}
180 \newcommand{\pysawsim}{\texttt{pysawsim}}
181 \newcommand{\sawsim}{\citetalias{king10}}
182 \newcommand{\stepper}{\citetalias{stepper}}
183 \newcommand{\unfoldprotein}{\citetalias{unfold-protein}}