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