annotate mume2012/tools.sty @ 58:a63c438b3f65 tip

Squeezed it into the 6 page limit
author Henrik Ekeus <hekeus@eecs.qmul.ac.uk>
date Tue, 11 Jun 2013 15:17:21 +0100
parents 3d4469f9e172
children
rev   line source
hekeus@51 1 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
hekeus@51 2 \ProvidesPackage{tools}[2007/12/25 v1.1 Samer's general LaTeX tools]
hekeus@51 3 \DeclareOption{detbar}{\def\detbar{y}}
hekeus@51 4 \DeclareOption{innerparen}{\def\inneropt{paren}}
hekeus@51 5 \DeclareOption{innerdot}{\def\inneropt{dot}}
hekeus@51 6 \DeclareOption{innermat}{\def\inneropt{mat}}
hekeus@51 7 \DeclareOption{nodesc}{\def\nodesc{y}}
hekeus@51 8 \ExecuteOptions{innerparen}
hekeus@51 9 \ProcessOptions
hekeus@51 10
hekeus@51 11 \providecommand{\comment}[1] {}
hekeus@51 12 \usepackage{xspace,units,array,amsmath,graphicx}
hekeus@51 13 \ifx\ifpdf\undefined
hekeus@51 14 \usepackage{ifpdf}
hekeus@51 15 \fi
hekeus@51 16 \ifpdf
hekeus@51 17 \usepackage{epstopdf}
hekeus@51 18 \else
hekeus@51 19 \fi
hekeus@51 20
hekeus@51 21 % PSTricks things
hekeus@51 22 %\usepackage{pstcol,pstricks,pst-node,pst-plot}
hekeus@51 23 %\psset{linewidth=0.4pt,labelsep=3pt,dotsize=1.2mm,%
hekeus@51 24 % arrowsize=2pt 2.5,arrowlength=1,arrowinset=0.2,%
hekeus@51 25 % gridwidth=0.4pt,griddots=10,subgriddiv=1,gridlabels=7pt,gridcolor=gray}
hekeus@51 26
hekeus@51 27 \let\oldS=\S
hekeus@51 28 \newcommand{\sect}[1] {$\oldS\,#1$}
hekeus@51 29 \newcommand{\shim}[2] {\hspace{#1mm plus #2mm}}
hekeus@51 30 \newcommand{\ie} {i.e.\@\xspace}
hekeus@51 31 \newcommand{\vrs} {vs.\@\xspace}
hekeus@51 32 \newcommand{\eg} {e.g.\@\xspace}
hekeus@51 33 \newcommand{\etc} {etc.\@\xspace}
hekeus@51 34 \newcommand{\latin}[1] {\emph{#1}\xspace}
hekeus@51 35 \newcommand{\figrf}[1] {fig.~\ref{f:#1}}
hekeus@51 36 \newcommand{\Figrf}[1] {Fig.~\ref{f:#1}}
hekeus@51 37 %\newcommand{\eqrf}[1] {eq.~\ref{eq:#1}}
hekeus@51 38 \newcommand{\eqrf}[1] {(\ref{eq:#1})}
hekeus@51 39 \newcommand{\secrf}[1] {\sect{\ref{s:#1}}}
hekeus@51 40 \newcommand{\chaprf}[1] {Chapter~\ref{ch:#1}}
hekeus@51 41 \newcommand{\ed}[1] {\texttt{[#1]}}
hekeus@51 42 \newcommand{\role} {role\xspace}%{r\^{o}le\xspace}
hekeus@51 43 \newcommand{\naive} {naive\xspace}
hekeus@51 44 \newcommand{\german}[1] {\emph{#1}}
hekeus@51 45 \newcommand{\degr}[1] {$#1^\circ$}
hekeus@51 46 %\newcommand{\nth}[1] {$#1$\hskip 0.1ex th\xspace}
hekeus@51 47 \newcommand{\nth}[1] {$#1$\hspace*{0.2ex}\raisebox{0.35em}{\scriptsize th}\xspace}
hekeus@51 48 \newcommand{\textnth}[1]{#1\hskip 0.2ex \raisebox{0.35em}{\scriptsize th}\xspace}
hekeus@51 49 \newcommand{\const}{\text{const.}}
hekeus@51 50 \newcommand{\D}[1] {$#1$-D\xspace}
hekeus@51 51 \newcommand{\sh} {$\sharp$}
hekeus@51 52 \newcommand{\fl} {$\flat$}
hekeus@51 53 \newcommand{\Hmax}{H_\mathrm{max}}
hekeus@51 54 \newcommand{\Imax}{I_\mathrm{max}}
hekeus@51 55
hekeus@51 56 % centred dot with space either side for separating things
hekeus@51 57 %\def\nicedot{\hspace{0.7em}\textperiodcentered\hspace{0.7em}}
hekeus@51 58 \newlength\nicedotspace
hekeus@51 59 \setlength\nicedotspace{0.6em plus 0.1em minus 0.2em}
hekeus@51 60 \def\nicedot{\hspace{\nicedotspace}\textperiodcentered\hspace{\nicedotspace}}
hekeus@51 61
hekeus@51 62 %\newcommand{\margnote}[1] {\marginpar{\raggedright\itshape\small#1}}
hekeus@51 63
hekeus@51 64 % names
hekeus@51 65 \newcommand{\Hyvarinen}{Hyv\"arinen\xspace}
hekeus@51 66 \newcommand{\Kohler}{K\"ohler\xspace}
hekeus@51 67 \newcommand{\Pragnanz}{Pr\"{a}gnanz\xspace}
hekeus@51 68
hekeus@51 69 % environments
hekeus@51 70 \ifx\nodesc\undefined
hekeus@51 71 \renewenvironment{description}
hekeus@51 72 {\begin{list}{}{%
hekeus@51 73 \setlength{\labelwidth}{1.5em}
hekeus@51 74 \setlength{\leftmargin}{1.5em}
hekeus@51 75 \let\makelabel\descriptionlabel
hekeus@51 76 }}
hekeus@51 77 {\end{list}}
hekeus@51 78 \fi
hekeus@51 79
hekeus@51 80 \newenvironment{smallquote}
hekeus@51 81 { \begin{quote} \small}
hekeus@51 82 { \end{quote}}
hekeus@51 83
hekeus@51 84 \providecommand{\figplacement}{tbp}
hekeus@51 85 \newenvironment{fig}[2][\figplacement]
hekeus@51 86 {%
hekeus@51 87 \newcommand{\bbfig}[1]{\begin{figure}[##1]}
hekeus@51 88 \expandafter\bbfig\expandafter{#1}
hekeus@51 89 \def\fglbl{f:#2}
hekeus@51 90 \let\ocap=\caption
hekeus@51 91 \renewcommand{\caption}[2][]{\ocap[##1]{\small ##2}}
hekeus@51 92 \centering\small
hekeus@51 93 }{%
hekeus@51 94 \label{\fglbl}
hekeus@51 95 \end{figure}
hekeus@51 96 }
hekeus@51 97
hekeus@51 98 \newenvironment{fig*}[2][\figplacement]
hekeus@51 99 {%
hekeus@51 100 \newcommand{\bbfig}[1]{\begin{figure*}[##1]}
hekeus@51 101 \expandafter\bbfig\expandafter{#1}
hekeus@51 102 \def\figlabel{f:#2}
hekeus@51 103 \let\ocap=\caption
hekeus@51 104 \renewcommand{\caption}[2][]{\ocap[##1]{\small ##2}}
hekeus@51 105 \centering\small
hekeus@51 106 }{%
hekeus@51 107 \label{\figlabel}
hekeus@51 108 \end{figure*}
hekeus@51 109 }
hekeus@51 110
hekeus@51 111 \newenvironment{eq}[1]
hekeus@51 112 {\begin{equation}\def\eqlabel{eq:#1}}
hekeus@51 113 {\label{\eqlabel}\end{equation}}%
hekeus@51 114
hekeus@51 115
hekeus@51 116
hekeus@51 117
hekeus@51 118 % ------------- standard mathematics -----------------
hekeus@51 119
hekeus@51 120 % --- calculus
hekeus@51 121 \let\oldint\int \def\int#1\dd{\oldint#1\;\dd}
hekeus@51 122 \let\oldiint\iint \def\iint#1\dd#2\dd{\oldiint#1\;\dd#2\;\dd}
hekeus@51 123 \let\oldiiint\iiint \def\iiint#1\dd#2\dd#3\dd{\oldiiint#1\;\dd#2\;\dd#3\;\dd}
hekeus@51 124 \newcommand{\infint}[2] {\int_{-\infty}^\infty#2\dd#1}
hekeus@51 125 \newcommand{\partiald}[2] {\frac{\partial#1}{\partial#2}}
hekeus@51 126 \newcommand{\pd}[2] {\dfrac{\partial#1}{\partial#2}}
hekeus@51 127 \newcommand{\dd} {\mathrm{d}}
hekeus@51 128 \newcommand{\hdbyd}[2][] {\dd{#1}/\dd{#2}}
hekeus@51 129 \newcommand{\dbyd}[2][] {\frac{\dd#1}{\dd#2}}
hekeus@51 130 \newcommand{\dbydt}[1] {\frac{\dd#1}{\dd t}}
hekeus@51 131 \newcommand{\hpd}[2] {{\partial#1}/{\partial#2}}
hekeus@51 132 \newcommand{\grad} {\boldsymbol{\nabla}}
hekeus@51 133 \newcommand{\hfrac}[2] {#1/#2}
hekeus@51 134 \newcommand{\hpfrac}[2] {(#1/#2)}
hekeus@51 135
hekeus@51 136 % --- statistics
hekeus@51 137 \newcommand{\savg}[2][] {%
hekeus@51 138 \def\sub{#1} % optional subscript
hekeus@51 139 \ifx\sub\empty {\langle #2 \rangle}
hekeus@51 140 \else {\langle #2 \rangle}_{#1}
hekeus@51 141 \fi}
hekeus@51 142
hekeus@51 143 \newcommand{\avg}[2][] {%
hekeus@51 144 \def\sub{#1} % optional subscript
hekeus@51 145 \ifx\sub\empty {\left\langle #2 \right\rangle}
hekeus@51 146 \else {\left\langle #2 \right\rangle}_{#1}
hekeus@51 147 \fi}
hekeus@51 148
hekeus@51 149 \newcommand{\expect}[2][] {%
hekeus@51 150 \def\sub{#1} % optional subscript
hekeus@51 151 \ifx\sub\empty \operatorname{E} \, #2
hekeus@51 152 \else \operatorname{E}_{#1} #2
hekeus@51 153 \fi
hekeus@51 154 }
hekeus@51 155 \newcommand{\sqbr}[1] {[\,#1]}
hekeus@51 156 \newcommand{\var}[1] {\operatorname{var}\, #1}
hekeus@51 157 \newcommand{\cov}[2] {\operatorname{cov}[#1,#2]}
hekeus@51 158 \newcommand{\cc}[2] {\operatorname{corr}[#1,#2]}
hekeus@51 159 %\newcommand{\KL}[2] {\mathrm{KL}[\, #1 \|\, #2]}
hekeus@51 160 \newcommand{\KL}[2] {D(#1 \|\, #2)}
hekeus@51 161 \newcommand{\define} {\overset{\text{\tiny def}}{=}}
hekeus@51 162 \newcommand{\distr} {\sim}
hekeus@51 163
hekeus@51 164 % --- sets
hekeus@51 165 \newcommand{\union} {\cup}
hekeus@51 166 \newcommand{\diff} {\backslash}
hekeus@51 167 \newcommand{\intersect} {\cap}
hekeus@51 168 \newcommand{\integers} {\mathbb{Z}}
hekeus@51 169 \newcommand{\reals} {\mathbb{R}}
hekeus@51 170 \newcommand{\complexes} {\mathbb{C}}
hekeus@51 171 %\newcommand{\C} {\mathbb{C}}
hekeus@51 172 \newcommand{\naturals} {\mathbb{N}}
hekeus@51 173 %\renewcommand*{\emptyset} {\varnothing}
hekeus@51 174
hekeus@51 175 % --- misc
hekeus@51 176 \def\rowvec(#1,#2){\begin{pmatrix} #1 & #2 \end{pmatrix}}
hekeus@51 177 \def\colvec(#1,#2){\begin{pmatrix} #1 \\ #2 \end{pmatrix}}
hekeus@51 178
hekeus@51 179 \ifx\detbar\undefined\else\def\det#1{|#1|}\fi
hekeus@51 180
hekeus@51 181 \newcommand{\sqtp}{\sqrt{2 \pi}}
hekeus@51 182 \DeclareMathOperator{\sech}{sech}
hekeus@51 183 \DeclareMathOperator{\sgn} {sgn}
hekeus@51 184 \DeclareMathOperator{\trace} {tr}
hekeus@51 185 \newcommand{\repart}{\Re\,}
hekeus@51 186 \newcommand{\impart}{\Im\,}
hekeus@51 187 \newcommand{\assign} {\leftarrow}
hekeus@51 188 \newcommand*\half {\tfrac{1}{2}}
hekeus@51 189 \newcommand{\fun}[1] {$#1(\cdot)$\xspace}
hekeus@51 190 \newcommand{\ffun}[1] {$#1(\cdot,\cdot)$\xspace}
hekeus@51 191 \newcommand{\tends} {\rightarrow}
hekeus@51 192 \renewcommand*{\vec}[1] {\mathbf{#1}}
hekeus@51 193 \providecommand{\abs}[1] {\lvert#1\rvert}
hekeus@51 194 \providecommand{\norm}[1] {\lVert#1\rVert}
hekeus@51 195 \if\inneropt{paren}
hekeus@51 196 \newcommand{\inner}[2] {(#1,#2)}
hekeus@51 197 \fi
hekeus@51 198 \if\inneropt{dot}
hekeus@51 199 \newcommand{\inner}[2] {#1\cdot#2}
hekeus@51 200 \else
hekeus@51 201 \newcommand{\inner}[2] {{#1}^T#2}
hekeus@51 202 \fi
hekeus@51 203
hekeus@51 204 % --- psfig bits
hekeus@51 205 \newcommand{\psmath}[2] {\psfrag{#1}{\scriptsize $#2$}}
hekeus@51 206 \newcommand{\psmathbig}[2] {\psfrag{#1}{\small $#2$}}
hekeus@51 207
hekeus@51 208
hekeus@51 209 % \linespread{1.1}
hekeus@51 210
hekeus@51 211
hekeus@51 212 % top-aligned boxes
hekeus@51 213 \newbox\thehbox
hekeus@51 214 \newcommand{\hangbox}[1]{%
hekeus@51 215 \savebox{\thehbox}{#1}%
hekeus@51 216 \raisebox{-\ht\thehbox}[0pt][\ht\thehbox]{\usebox{\thehbox}}%
hekeus@51 217 % \raisebox{-\ht\thehbox}[0pt][-\ht\thehbox]{\usebox{\thehbox}}%
hekeus@51 218 }
hekeus@51 219
hekeus@51 220 \newenvironment{hanging}{%
hekeus@51 221 \begingroup
hekeus@51 222 \newbox\thebox
hekeus@51 223 \begin{lrbox}{\thebox}
hekeus@51 224 }{%
hekeus@51 225 \end{lrbox}%
hekeus@51 226 \raisebox{-\ht\thebox}[0pt][\ht\thebox]{\usebox{\thebox}}%
hekeus@51 227 \endgroup
hekeus@51 228 }%
hekeus@51 229
hekeus@51 230 % Hacky indentation - FIXME!
hekeus@51 231 \newenvironment{indented}
hekeus@51 232 {\vspace{-0.6em}\begin{quote}}
hekeus@51 233 {\end{quote}\vspace{-0.6em}}
hekeus@51 234