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