%% Allows to enter BIOGRAPHY leaving place for picture (adapts to font size)
%%
%\newenvironment{biography}[2]{%
%\footnotesize\unitlength 1mm\bigskip\bigskip\bigskip\parskip=0pt\par%
%\rule{0pt}{39mm}\vspace{-39mm}\par%   guarantees correct page breaking
%\noindent\setbox0\hbox{\framebox(25,32){#2}}%   box containing the frame
%\ht0=37mm\count10=\ht0\divide\count10 by\baselineskip%  calculates lines
%\global\hangindent29mm\global\hangafter-\count10%
%\hskip-28.5mm\setbox0\hbox to 28.5mm {\raise-30.5mm\box0\hss}%
%\dp0=0mm\ht0=0mm\box0\noindent\bf#1\rm}{
%\par\rm\normalsize}
%\newenvironment{biography}[2]{%
%\footnotesize\unitlength 1mm\bigskip\bigskip\bigskip\parskip=0pt\par%
%\rule{0pt}{39mm}\vspace{-39mm}\par%   guarantees correct page breaking
%%\noindent\setbox0\hbox{\framebox(25,32){#2}}%   box containing the frame
%\noindent\setbox0\hbox{\framebox(25,32){#2}}%   box containing the frame
%\ht0=37mm\count10=\ht0\divide\count10 by\baselineskip%  calculates lines
%\global\hangindent29mm\global\hangafter-\count10%
%\hskip-28.5mm\setbox0\hbox to 28.5mm {\raise-30.5mm\box0\hss}%
%\dp0=0mm\ht0=0mm\box0\noindent\bf#1\rm}{
%\par\rm\normalsize}

%\newenvironment{biography}[2]
%{\begin{wrapfigure}{l}{15mm}
%\includegraphics[width=1in]{images/#2.jpg}
%\end{wrapfigure}
%\paragraph*{#1}}
%{
%}

% Degrees
\def\res#1#2{#1$\times$#2}

% -- Math ---------------------------------------------------------------------

% Uncomment this to convert all \fracS statements to division '/' statements.
% This affects line height for inline math, but it is mostly a choice
% of aesthetics.

	\def\fracS#1#2{\frac{#1}{#2}}
	%\def\fracS#1#2{#1/#2}

% Alternatives for fractions using parenthetical statements. Using \fracP
% allows us to quickly switch between the two conventions for fractional
% statements.

	%\def\fracP#1#2{(#1)/(#2)}
	%\def\fracP#1#2{\frac{#1}{#2}}

% A unit vector.
% The widehat is used because it is more visible than a regular hat.

	\def\unit#1{\ensuremath{\widehat{#1}}}

% A matrix.
% Using this macro allows the notational convention (bold etc.) to be changed.

	\def\matrix#1{\ensuremath{\mathbf{#1}}}

% Any special mathematical construct that is not already defined, e.g.
% a sphere, a plane, etc.

	\def\entity#1{\ensuremath{\mathbf{#1}}}

% Format line segments using a bar drawn over all point names.

	\def\segment#1{\overline{#1}}

% These macros allow vector operations to be written in prefix notation.

	\def\dot#1#2{\unit{#1} \cdot \unit{#2}}
	\def\cross#1#2{\unit{#1} \times \unit{#2}}
	\def\normalize#1{\|\,#1\,\|}

% Shorthand versions of trigonometry functions.

	\def\asin{\ensuremath{\text{asin}}}
	\def\acos{\ensuremath{\text{acos}}}
	\def\atan{\ensuremath{\text{atan}}}

% Shorthand for different expressions of pi.
% Numbers would be better than T and F, but LaTeX won't have it.

	\def\pot{\fracS{\pi}{2}} % pi/2
	\def\pof{\fracS{\pi}{4}} % pi/4

% Other

	% Degrees (a raised circle)
	\def\deg{\ensuremath{^\circ}}

	% Resolution, e.g. 1024 x 768
	\def\res#1#2{#1$\times$#2}

% -- Figures --------------------------------------------------------

% A figure using a PNG image from 'images/'.
% Note that the label to use when referencing is 'fig:#1', although the
% \Figure macro includes 'fig:' automatically.
%
% #1: The name and filename
% #2: The anchoring attribs h, b, t, p, and !
% #3: The size (e.g. 4cm)
% #4: Caption
%
\def \pngFigure #1#2#3#4{ % Warning: LaTeX doesn't like it if you put this brace on its own line.
%{
	\begin{figure}[#2]
		\begin{center}
			\includegraphics[width=#3]{images/#1.png}
		\end{center}
		\caption{#4}
		\label{fig:#1}
	\end{figure}
}

\def \jpgFigure #1#2#3#4{
%{
	\begin{figure}[#2]
		\begin{center}
			\includegraphics[width=#3]{images/#1.jpg}
		\end{center}
		\caption{#4}
		\label{fig:#1}
	\end{figure}
}

% A figure written with LaTeX markup written as a tex file in 'images/'.
% This thesis uses TikZ for programmatically defining figures, which are
% written as tex files.
%
% #1: The name and filename
% #2: The anchoring attribs h, b, t, p, and !
% #3: Caption
%
\def \texFigure #1#2#3{
%{
	\begin{figure}[#2]
		\begin{center}
			\input{images/#1.tex}
		\end{center}
		\caption{#3}
		\label{fig:#1}
	\end{figure}
}

% A placeholder for a figure to be created later.
% #1: The name and caption
\def \placeholder #1{
%{
	\begin{figure}[p]
		\begin{center}
			\includegraphics[width=6cm]{images/placeholder.png}
		\end{center}
		\caption{#1}
		\label{fig:#1}
	\end{figure}
}

% -- Equations ----------------------------------------------------------------

% An equation without a label.
\def \equation #1{
%{
	\begin{align*}
		#1
	\end{align*}
}

% An equation with a label.
\def \equationL #1#2{
%{
	\begin{align}
		#2
		\label{eq:#1}
	\end{align}
}

% Two equations, two labels.
\def \equationLL #1#2#3#4{
%{
	\begin{align}
		#3 \label{eq:#1} \\
		#4 \label{eq:#2}
	\end{align}
}

% -- References ---------------------------------------------------------------

% Reference a chapter or section.
% The tilde is a space that can't be broken across two lines.
\def\Section#1{Section~\ref{sec:#1}}
\def\Subsection#1{Section~\ref{sub:#1}}

% Reference a figure using the word Figure and the figure's ID.
\def\Figure#1{Figure~\ref{fig:#1}}

% Reference an equation using the word Equation and the equation's ID.
\def\Equation#1{Equation~\ref{eq:#1}}

% Reference for tables
\def\Table#1{Table~\ref{tab:#1}}

% A shorthand for citing papers with multiple authors
\def\ea#1{~{\em et al.}~\cite{#1}}

\def\eg{{\em e.g.}}
\def\ie{{\em i.e.}}
