%======================================================================
%                    A N T . S T Y 
%                    doc: Wed Apr  8 10:12:10 1998
%                    dlm: Mon May 13 11:29:01 2002
%                    (c) 1998 A.M. Thurnherr
%                    uE-Info: 106 27 NIL 0 0 72 2 2 4 NIL ofnI
%======================================================================

% HISTORY:
%	Apr  8, 1998: - created
%	Mar  2, 2002: - begun HISTORY
%				  - added \newacronym, \newabbrev
%	May  3, 2002: - added \newdef
%	May  6, 2002: - capitalized figure/table references 

\ProvidesPackage{ant}
\NeedsTeXFormat{LaTeX2e}

\RequirePackage{fancyheadings}

\def\version#1{\gdef\@version{#1}}				% titlepage/header
\def\@version{\@latex@warning@no@line{No \noexpand\version given}}

\DeclareOption{stuffedpage}{%
	\addtolength\textwidth{1.5\oddsidemargin}%
	\addtolength\textheight{0.75\topmargin}%
	\addtolength\textheight{0.75\headsep}%
	\setlength\oddsidemargin{0.25\oddsidemargin}%
	\setlength\topmargin{0.25\topmargin}%
	\setlength\headsep{0.25\headsep}%
}

\DeclareOption{draft}{%
	\pagestyle{fancy}%
	\lhead{\textbf{DRAFT}}%
	\version{\textbf{DRAFT}}%
	\rhead{\today}%
	\cfoot{\thepage}%
}

\ProcessOptions

%----------------------------------------------------------------------

\newcommand{\REM}[1]{}									% remark (don't print)

\newcommand\newacronym[2]{%								% acronym
	\expandafter\newcommand\csname#1\endcsname{%		% define macro
		#2 (#1)\xspace%									% acronym definition
		\expandafter\renewcommand\csname#1\endcsname{%	% re-define macro
			#1\xspace%
		}%
	}%
}

\newcommand\newdef[3]{%									% definition
	\expandafter\newcommand\csname#1\endcsname{%		% define macro
		#2 (#3)\xspace%									% acronym definition
		\expandafter\renewcommand\csname#1\endcsname{%	% re-define macro
			#2\xspace%
		}%
	}%
}

\newcommand\newabbrev[2]{%								% abbreviation
	\expandafter\newcommand\csname#1\endcsname{%		% define macro
		#2\xspace%										% expand
	}%
}

%----------------------------------------------------------------------

\newcommand{\Chapter}[2]{
	\chapter{#2}
	\label{chap:#1}
}

\newcommand{\Section}[2]{
	\section{#2}
	\label{sec:#1}
}

\newcommand{\Subsection}[2]{
	\subsection{#2}
	\label{sec:#1}
}

\newcommand{\Subsubsection}[2]{
	\subsubsection{#2}
	\label{sec:#1}
}

\newcommand{\SUbsubsection}[2]{
	\subsubsection*{#2}
	\label{sec:#1}
}

%\newcommand{\RCS}[1]{}							% version control

% figure stuff

\newlength{\unitwidth}
\setlength{\unitwidth}{0.8\textwidth}
\newcommand\fullwidth{1.25}

\newcommand{\placeFig}[2][.8]{
	\begin{center}
		\epsfig{figure=#2.eps,width=#1\unitwidth}
	\end{center}
}

\newcommand{\placeTwoFigs}[3][0.45]{
	\epsfig{figure=#2.eps,width=#1\unitwidth}\hfill
	\epsfig{figure=#3.eps,width=#1\unitwidth}
}

\newcommand{\labelFig}[1]{\label{fig:#1}}
\newcommand{\labelTab}[1]{\label{tab:#1}}
\newcommand{\labelEqn}[1]{\label{eqn:#1}}

%% Reference commands a la chicago cite-commands

\providecommand\chaptername{Chapter}
\providecommand\chaptersname{Chapters}
\providecommand\sectionname{Section}
\providecommand\sectionsname{Sections}
\providecommand\appendixname{Appendix}
\providecommand\figuresname{Figures}
\providecommand\tablesname{Tables}

\newcommand{\rfigNP}[1]{\mbox{\figurename\ \ref{fig:#1}}}
\newcommand{\rfig}[1]{\mbox{(\rfigNP{#1})}}
\newcommand{\rFigNP}[1]{\mbox{\figurename\ \ref{fig:#1}}}
\newcommand{\rFig}[1]{\mbox{(\rFigNP{#1})}}
\newcommand{\rfigsNP}[2]{%
	\mbox{\figuresname\ \ref{fig:#1}} %
	\mbox{and \ref{fig:#2}}}
\newcommand{\rfigs}[2]{(\rfigsNP{#1}{#2})}
\newcommand{\rFigsNP}[2]{%
	\mbox{\figuresname\ \ref{fig:#1}} \mbox{and \ref{fig:#2}}}
\newcommand{\rFigs}[2]{(\rFigsNP{#1}{#2})}

\newcommand{\rtabNP}[1]{\mbox{\tablename\ \ref{tab:#1}}}
\newcommand{\rtab}[1]{(\rtabNP{#1})}
\newcommand{\rTabNP}[1]{\mbox{\tablename\ \ref{tab:#1}}}
\newcommand{\rTab}[1]{(\rTabNP{#1})}

\newcommand{\rchapNP}[1]{chapter~\ref{chap:#1}}		% Chapter
\newcommand{\rchap}[1]{(\rchapNP{#1})}
\newcommand{\rChapNP}[1]{Chapter~\ref{chap:#1}}
\newcommand{\rChap}[1]{(\rChapNP{#1})}
\newcommand{\rchapsNP}[2]{%
	\mbox{\MakeLowercase\chaptersname\ \ref{chap:#1}} %
	\mbox{and \ref{chap:#2}}}
\newcommand{\rchapseqNP}[2]{%
	\mbox{\MakeLowercase\chaptersname\ \ref{chap:#1}--\ref{chap:#2}}}
\newcommand{\rchaps}[2]{(\rchapsNP{#1}{#2})}

\newcommand{\rsecNP}[1]{\mbox{\MakeLowercase\sectionname\ \ref{sec:#1}}}
\newcommand{\rsec}[1]{(\rsecNP{#1})}
\newcommand{\rSecNP}[1]{\mbox{\sectionname\ \ref{sec:#1}}}
\newcommand{\rSec}[1]{(\rSecNP{#1})}
\newcommand{\rsecsNP}[2]{%
	\mbox{\MakeLowercase\sectionsname\ \ref{sec:#1}} %
	\mbox{and \ref{sec:#2}}}
\newcommand{\rsecs}[2]{(\rsecsNP{#1}{#2})}
	
\newcommand{\rappNP}[1]{\mbox{\MakeLowercase\appendixname\ \ref{sec:#1}}}
\newcommand{\rapp}[1]{(\rappNP{#1})}
\newcommand{\rAppNP}[1]{\mbox{\appendixname\ \ref{sec:#1}}}
\newcommand{\rApp}[1]{(\rappNP{#1})}

\newcommand{\reqnNP}[1]{\ref{eqn:#1}}				% Equation
\newcommand{\reqn}[1]{(\reqnNP{#1})}
\newcommand{\rexpr}[1]{expression~\reqn{#1}}
\newcommand{\rexprs}[2]{expressions~\reqn{#1} and~\reqn{#2}}
\newcommand{\rExpr}[1]{Expression~\reqn{#1}}

%----------------------------------------------------------------------

\newcommand{\total}[2]{\ensuremath\frac{\mathrm{d}#1}{\mathrm{d}#2}}
												
%----------------------------------------------------------------------

\def\address#1{\gdef\@address{#1}}					% from latex.ltx
\def\@address{\@latex@warning@no@line{No \noexpand\address given}}

\def\@maketitle{%								% modified article.cls
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks  
    {\LARGE \@title \par}% 
    \vskip 1.5em%
    {\large
      \lineskip .5em%   
      \begin{tabular}[t]{c}%
        \@author \\ %
		\textit{\small \@address} %
      \end{tabular}\par}%
    \vskip 1.5em%
    {\large \@version}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
