hekeus@45: \NeedsTeXFormat{LaTeX2e}[1995/12/01] hekeus@45: \ProvidesPackage{tools}[2007/12/25 v1.1 Samer's general LaTeX tools] hekeus@45: \DeclareOption{detbar}{\def\detbar{y}} hekeus@45: \DeclareOption{innerparen}{\def\inneropt{paren}} hekeus@45: \DeclareOption{innerdot}{\def\inneropt{dot}} hekeus@45: \DeclareOption{innermat}{\def\inneropt{mat}} hekeus@45: \DeclareOption{nodesc}{\def\nodesc{y}} hekeus@45: \ExecuteOptions{innerparen} hekeus@45: \ProcessOptions hekeus@45: hekeus@45: \providecommand{\comment}[1] {} hekeus@45: \usepackage{xspace,units,array,amsmath,graphicx} hekeus@45: \ifx\ifpdf\undefined hekeus@45: \usepackage{ifpdf} hekeus@45: \fi hekeus@45: \ifpdf hekeus@45: \usepackage{epstopdf} hekeus@45: \else hekeus@45: \fi hekeus@45: hekeus@45: % PSTricks things hekeus@45: %\usepackage{pstcol,pstricks,pst-node,pst-plot} hekeus@45: %\psset{linewidth=0.4pt,labelsep=3pt,dotsize=1.2mm,% hekeus@45: % arrowsize=2pt 2.5,arrowlength=1,arrowinset=0.2,% hekeus@45: % gridwidth=0.4pt,griddots=10,subgriddiv=1,gridlabels=7pt,gridcolor=gray} hekeus@45: hekeus@45: \let\oldS=\S hekeus@45: \newcommand{\sect}[1] {$\oldS\,#1$} hekeus@45: \newcommand{\shim}[2] {\hspace{#1mm plus #2mm}} hekeus@45: \newcommand{\ie} {i.e.\@\xspace} hekeus@45: \newcommand{\vrs} {vs.\@\xspace} hekeus@45: \newcommand{\eg} {e.g.\@\xspace} hekeus@45: \newcommand{\etc} {etc.\@\xspace} hekeus@45: \newcommand{\latin}[1] {\emph{#1}\xspace} hekeus@45: \newcommand{\figrf}[1] {fig.~\ref{f:#1}} hekeus@45: \newcommand{\Figrf}[1] {Fig.~\ref{f:#1}} hekeus@45: %\newcommand{\eqrf}[1] {eq.~\ref{eq:#1}} hekeus@45: \newcommand{\eqrf}[1] {(\ref{eq:#1})} hekeus@45: \newcommand{\secrf}[1] {\sect{\ref{s:#1}}} hekeus@45: \newcommand{\chaprf}[1] {Chapter~\ref{ch:#1}} hekeus@45: \newcommand{\ed}[1] {\texttt{[#1]}} hekeus@45: \newcommand{\role} {role\xspace}%{r\^{o}le\xspace} hekeus@45: \newcommand{\naive} {naive\xspace} hekeus@45: \newcommand{\german}[1] {\emph{#1}} hekeus@45: \newcommand{\degr}[1] {$#1^\circ$} hekeus@45: %\newcommand{\nth}[1] {$#1$\hskip 0.1ex th\xspace} hekeus@45: \newcommand{\nth}[1] {$#1$\hspace*{0.2ex}\raisebox{0.35em}{\scriptsize th}\xspace} hekeus@45: \newcommand{\textnth}[1]{#1\hskip 0.2ex \raisebox{0.35em}{\scriptsize th}\xspace} hekeus@45: \newcommand{\const}{\text{const.}} hekeus@45: \newcommand{\D}[1] {$#1$-D\xspace} hekeus@45: \newcommand{\sh} {$\sharp$} hekeus@45: \newcommand{\fl} {$\flat$} hekeus@45: \newcommand{\Hmax}{H_\mathrm{max}} hekeus@45: \newcommand{\Imax}{I_\mathrm{max}} hekeus@45: hekeus@45: % centred dot with space either side for separating things hekeus@45: %\def\nicedot{\hspace{0.7em}\textperiodcentered\hspace{0.7em}} hekeus@45: \newlength\nicedotspace hekeus@45: \setlength\nicedotspace{0.6em plus 0.1em minus 0.2em} hekeus@45: \def\nicedot{\hspace{\nicedotspace}\textperiodcentered\hspace{\nicedotspace}} hekeus@45: hekeus@45: %\newcommand{\margnote}[1] {\marginpar{\raggedright\itshape\small#1}} hekeus@45: hekeus@45: % names hekeus@45: \newcommand{\Hyvarinen}{Hyv\"arinen\xspace} hekeus@45: \newcommand{\Kohler}{K\"ohler\xspace} hekeus@45: \newcommand{\Pragnanz}{Pr\"{a}gnanz\xspace} hekeus@45: hekeus@45: % environments hekeus@45: \ifx\nodesc\undefined hekeus@45: \renewenvironment{description} hekeus@45: {\begin{list}{}{% hekeus@45: \setlength{\labelwidth}{1.5em} hekeus@45: \setlength{\leftmargin}{1.5em} hekeus@45: \let\makelabel\descriptionlabel hekeus@45: }} hekeus@45: {\end{list}} hekeus@45: \fi hekeus@45: hekeus@45: \newenvironment{smallquote} hekeus@45: { \begin{quote} \small} hekeus@45: { \end{quote}} hekeus@45: hekeus@45: \providecommand{\figplacement}{tbp} hekeus@45: \newenvironment{fig}[2][\figplacement] hekeus@45: {% hekeus@45: \newcommand{\bbfig}[1]{\begin{figure}[##1]} hekeus@45: \expandafter\bbfig\expandafter{#1} hekeus@45: \def\fglbl{f:#2} hekeus@45: \let\ocap=\caption hekeus@45: \renewcommand{\caption}[2][]{\ocap[##1]{\small ##2}} hekeus@45: \centering\small hekeus@45: }{% hekeus@45: \label{\fglbl} hekeus@45: \end{figure} hekeus@45: } hekeus@45: hekeus@45: \newenvironment{fig*}[2][\figplacement] hekeus@45: {% hekeus@45: \newcommand{\bbfig}[1]{\begin{figure*}[##1]} hekeus@45: \expandafter\bbfig\expandafter{#1} hekeus@45: \def\figlabel{f:#2} hekeus@45: \let\ocap=\caption hekeus@45: \renewcommand{\caption}[2][]{\ocap[##1]{\small ##2}} hekeus@45: \centering\small hekeus@45: }{% hekeus@45: \label{\figlabel} hekeus@45: \end{figure*} hekeus@45: } hekeus@45: hekeus@45: \newenvironment{eq}[1] hekeus@45: {\begin{equation}\def\eqlabel{eq:#1}} hekeus@45: {\label{\eqlabel}\end{equation}}% hekeus@45: hekeus@45: hekeus@45: hekeus@45: hekeus@45: % ------------- standard mathematics ----------------- hekeus@45: hekeus@45: % --- calculus hekeus@45: \let\oldint\int \def\int#1\dd{\oldint#1\;\dd} hekeus@45: \let\oldiint\iint \def\iint#1\dd#2\dd{\oldiint#1\;\dd#2\;\dd} hekeus@45: \let\oldiiint\iiint \def\iiint#1\dd#2\dd#3\dd{\oldiiint#1\;\dd#2\;\dd#3\;\dd} hekeus@45: \newcommand{\infint}[2] {\int_{-\infty}^\infty#2\dd#1} hekeus@45: \newcommand{\partiald}[2] {\frac{\partial#1}{\partial#2}} hekeus@45: \newcommand{\pd}[2] {\dfrac{\partial#1}{\partial#2}} hekeus@45: \newcommand{\dd} {\mathrm{d}} hekeus@45: \newcommand{\hdbyd}[2][] {\dd{#1}/\dd{#2}} hekeus@45: \newcommand{\dbyd}[2][] {\frac{\dd#1}{\dd#2}} hekeus@45: \newcommand{\dbydt}[1] {\frac{\dd#1}{\dd t}} hekeus@45: \newcommand{\hpd}[2] {{\partial#1}/{\partial#2}} hekeus@45: \newcommand{\grad} {\boldsymbol{\nabla}} hekeus@45: \newcommand{\hfrac}[2] {#1/#2} hekeus@45: \newcommand{\hpfrac}[2] {(#1/#2)} hekeus@45: hekeus@45: % --- statistics hekeus@45: \newcommand{\savg}[2][] {% hekeus@45: \def\sub{#1} % optional subscript hekeus@45: \ifx\sub\empty {\langle #2 \rangle} hekeus@45: \else {\langle #2 \rangle}_{#1} hekeus@45: \fi} hekeus@45: hekeus@45: \newcommand{\avg}[2][] {% hekeus@45: \def\sub{#1} % optional subscript hekeus@45: \ifx\sub\empty {\left\langle #2 \right\rangle} hekeus@45: \else {\left\langle #2 \right\rangle}_{#1} hekeus@45: \fi} hekeus@45: hekeus@45: \newcommand{\expect}[2][] {% hekeus@45: \def\sub{#1} % optional subscript hekeus@45: \ifx\sub\empty \operatorname{E} \, #2 hekeus@45: \else \operatorname{E}_{#1} #2 hekeus@45: \fi hekeus@45: } hekeus@45: \newcommand{\sqbr}[1] {[\,#1]} hekeus@45: \newcommand{\var}[1] {\operatorname{var}\, #1} hekeus@45: \newcommand{\cov}[2] {\operatorname{cov}[#1,#2]} hekeus@45: \newcommand{\cc}[2] {\operatorname{corr}[#1,#2]} hekeus@45: %\newcommand{\KL}[2] {\mathrm{KL}[\, #1 \|\, #2]} hekeus@45: \newcommand{\KL}[2] {D(#1 \|\, #2)} hekeus@45: \newcommand{\define} {\overset{\text{\tiny def}}{=}} hekeus@45: \newcommand{\distr} {\sim} hekeus@45: hekeus@45: % --- sets hekeus@45: \newcommand{\union} {\cup} hekeus@45: \newcommand{\diff} {\backslash} hekeus@45: \newcommand{\intersect} {\cap} hekeus@45: \newcommand{\integers} {\mathbb{Z}} hekeus@45: \newcommand{\reals} {\mathbb{R}} hekeus@45: \newcommand{\complexes} {\mathbb{C}} hekeus@45: %\newcommand{\C} {\mathbb{C}} hekeus@45: \newcommand{\naturals} {\mathbb{N}} hekeus@45: %\renewcommand*{\emptyset} {\varnothing} hekeus@45: hekeus@45: % --- misc hekeus@45: \def\rowvec(#1,#2){\begin{pmatrix} #1 & #2 \end{pmatrix}} hekeus@45: \def\colvec(#1,#2){\begin{pmatrix} #1 \\ #2 \end{pmatrix}} hekeus@45: hekeus@45: \ifx\detbar\undefined\else\def\det#1{|#1|}\fi hekeus@45: hekeus@45: \newcommand{\sqtp}{\sqrt{2 \pi}} hekeus@45: \DeclareMathOperator{\sech}{sech} hekeus@45: \DeclareMathOperator{\sgn} {sgn} hekeus@45: \DeclareMathOperator{\trace} {tr} hekeus@45: \newcommand{\repart}{\Re\,} hekeus@45: \newcommand{\impart}{\Im\,} hekeus@45: \newcommand{\assign} {\leftarrow} hekeus@45: \newcommand*\half {\tfrac{1}{2}} hekeus@45: \newcommand{\fun}[1] {$#1(\cdot)$\xspace} hekeus@45: \newcommand{\ffun}[1] {$#1(\cdot,\cdot)$\xspace} hekeus@45: \newcommand{\tends} {\rightarrow} hekeus@45: \renewcommand*{\vec}[1] {\mathbf{#1}} hekeus@45: \providecommand{\abs}[1] {\lvert#1\rvert} hekeus@45: \providecommand{\norm}[1] {\lVert#1\rVert} hekeus@45: \if\inneropt{paren} hekeus@45: \newcommand{\inner}[2] {(#1,#2)} hekeus@45: \fi hekeus@45: \if\inneropt{dot} hekeus@45: \newcommand{\inner}[2] {#1\cdot#2} hekeus@45: \else hekeus@45: \newcommand{\inner}[2] {{#1}^T#2} hekeus@45: \fi hekeus@45: hekeus@45: % --- psfig bits hekeus@45: \newcommand{\psmath}[2] {\psfrag{#1}{\scriptsize $#2$}} hekeus@45: \newcommand{\psmathbig}[2] {\psfrag{#1}{\small $#2$}} hekeus@45: hekeus@45: hekeus@45: % \linespread{1.1} hekeus@45: hekeus@45: hekeus@45: % top-aligned boxes hekeus@45: \newbox\thehbox hekeus@45: \newcommand{\hangbox}[1]{% hekeus@45: \savebox{\thehbox}{#1}% hekeus@45: \raisebox{-\ht\thehbox}[0pt][\ht\thehbox]{\usebox{\thehbox}}% hekeus@45: % \raisebox{-\ht\thehbox}[0pt][-\ht\thehbox]{\usebox{\thehbox}}% hekeus@45: } hekeus@45: hekeus@45: \newenvironment{hanging}{% hekeus@45: \begingroup hekeus@45: \newbox\thebox hekeus@45: \begin{lrbox}{\thebox} hekeus@45: }{% hekeus@45: \end{lrbox}% hekeus@45: \raisebox{-\ht\thebox}[0pt][\ht\thebox]{\usebox{\thebox}}% hekeus@45: \endgroup hekeus@45: }% hekeus@45: hekeus@45: % Hacky indentation - FIXME! hekeus@45: \newenvironment{indented} hekeus@45: {\vspace{-0.6em}\begin{quote}} hekeus@45: {\end{quote}\vspace{-0.6em}} hekeus@45: