% $Id: OBthesis.sty,v 1.8 2004/10/23 16:50:58 oliver Exp $
% Packages and enhancements for thesis writing, especially citations
% (combining parts of RevTeX and natbib---mecilessly ripped from these
% two packages and adapted)
%
% Standard natbib numbers/super mode (superscripted citations)
% \citep{jon90}            ^{2}
% \citet{jon90}            Jones et al (1990)
% Enhancements:
% \onlinecite{jon90}       2
% \citen{jon90}            2   % same as \onlinecite
% \textcite                Jones et al (1990)
% \citer{jon90}            (Ref.~2)
% \citealr{jon90}          Ref.~2
%
% use \refpunct{}{}{} in the preamble to customize \citer and \citealr:
%
% \refpunct{Ref.~}{(}{)}:       \citer{jon90} --> (Ref.~2)
% \refpunct{Reference~}{[}{]}:  \citer{jon90} --> [Reference~2]
%
%
%
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesPackage{OBthesis}[2004/07/30 Oli Beckstein's Thesis Package]
\typeout{Package: OBthesis. (Oliver Beckstein's thesis, University of Oxford)
$Id: OBthesis.sty,v 1.8 2004/10/23 16:50:58 oliver Exp $
}
%
\RequirePackage{babel}%
\RequirePackage{amsmath}%
\RequirePackage{amssymb}%
%
%
\RequirePackage[numbers,super,sort&compress]{natbib}[2003/06/06 7.1]%
\citestyle{nature}
\newcommand\refpunct[3]{%
 \gdef\OB@ref{#1}%
 \gdef\OB@open{#2}%
 \gdef\OB@close{#3}%
}
\@onlypreamble{\refpunct}
\newcommand\OB@ref{Ref.~}%
\newcommand\OB@open{(} \newcommand\OB@close{)}%
%
%
% \onlinecite from RevTeX 4, revtex4.cls
\let\NAT@citeyear\citeyear
\def\NAT@onlinecite#1{%
 \begingroup
  \let\@cite\NAT@citenum
  \let\NAT@mbox\mbox
  \let\citeyear\NAT@citeyear
  \def\NAT@space{ }%
  \cite{#1}%
 \endgroup
}%
\def\NAT@citealref#1{%
  \begingroup%
  \OB@ref\NAT@onlinecite{#1}%
  \endgroup%
}%
\def\NAT@citeref#1{%
  \begingroup%
  \OB@open\NAT@citealref{#1}\OB@close%
  \endgroup%
}%
\providecommand\@onlinecite{\citealp}%
\providecommand\@textcite{\citealt}%
\DeclareRobustCommand\onlinecite{\NAT@onlinecite}%
\DeclareRobustCommand\citen{\NAT@onlinecite}%
\DeclareRobustCommand\citer{\NAT@citeref}%
\DeclareRobustCommand\citealr{\NAT@citealref}%
\DeclareRobustCommand\textcite{\@textcite}%
%
%
%
\RequirePackage{prettyref}
\newrefformat{eq}{Eq.~\textup{(\ref{#1})}}
\newrefformat{fig}{Fig.~\ref{#1}}
\newrefformat{tab}{Tab.~\ref{#1}}
\newrefformat{cha}{Chapter~\ref{#1}}
\newrefformat{chap}{Chapter~\ref{#1}}
\newrefformat{app}{Appendix~\ref{#1}}
\newrefformat{sec}{Section~\ref{#1}}
\DeclareRobustCommand\pref{\prettyref}
%
% pretty ref with vario ref (basically just new name space for prettyref):
\RequirePackage{vprettyref}
\newvariorefformat{eq}{Eq.~\textup{(\ref{#1})}\vpageref[]{#1}}
\newvariorefformat{fig}{Fig.~\vref{#1}}
\newvariorefformat{tab}{Tab.~\vref{#1}}
\newvariorefformat{cha}{Chapter~\vref{#1}}
\newvariorefformat{chap}{Chapter~\vref{#1}}
\newvariorefformat{app}{Appendix~\vref{#1}}
\newvariorefformat{sec}{Section~\vref{#1}}
%
%
% footnote counter will be reset for each page but this requires at least
% two LaTeX runs (which we need anyway)
%\usepackage{footnpag}
%
% footnotes as symbols not numbers (which clashes with 'super,numbers'
% citation mode)
%\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%
%
% footmisc is more recent than footnpag but has occasinally problems with minipages
\RequirePackage[perpage,symbol]{footmisc}
%
%
% indexing
% see LaTeX Companion p367. 
% Use ^{foo} == \index{foo} for silent index entry
% Use _{foo} == \index*{foo} for index entry AND printed text 'foo' in doc
\RequirePackage{index}



