% thesis.sty
% Author: Marcus Kollar, 11/98.
% See LaTeX Manual or LaTeX Companion for explanations.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mythesis}[1998/11/01]
\message{Package `mythesis', Version 0.99 of 98/11/01.}
\RequirePackage{amstext,fancyheadings,harvard,ifthen}
%%\newif\ifdraft\draftfalse 
%%\DeclareOption{draft}{\drafttrue}
%%\ProcessOptions

%% page style: enlarge textwidth, set evensidemargin=oddsidemargin
\addtolength{\textwidth}{\evensidemargin}
\addtolength{\textwidth}{-\oddsidemargin}
\setlength{\evensidemargin}{\oddsidemargin}

% page style: fancy headers
\pagestyle{fancyplain}
\setlength{\headheight}{14pt}
%%\addtolength{\headwidth}{\marginparwidth}
%%\addtolength{\headwidth}{\marginparsep}
\setlength{\headrulewidth}{0.4pt}
\setlength{\plainheadrulewidth}{\headrulewidth}
\renewcommand{\chaptermark}[1]{\markboth{%\chaptername\ 
    \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\lhead[\fancyplain{}{\thepage}]{\fancyplain{}{\slshape\rightmark}}
\chead{\fancyplain{}{}}
\rhead[\fancyplain{}{\slshape\leftmark}]{\fancyplain{\thepage}{\thepage}}
\lfoot[\fancyplain{}{}]{\fancyplain{}{}}
\cfoot[\fancyplain{}{}]{\fancyplain{}{}}
\rfoot[\fancyplain{}{}]{\fancyplain{}{}}
\newcommand{\markchapter}[1]{%
  \addcontentsline{toc}{chapter}{#1}
  \renewcommand{\@mkboth}[2]{\markboth{#1}{#1}}}

% figure caption
\newsavebox{\@tmpcaptionbox}
\newcommand{\@makefigcaption}[2]{%
  \sbox{\@tmpcaptionbox}{\small\textbf{#1 :~}{#2}}%
  \ifthenelse{\lengthtest{\wd\@tmpcaptionbox > \linewidth}}%
  {\begin{center}\begin{minipage}[t]{\linewidth}\small%
        \textbf{#1:~}{#2}%
      \end{minipage}\end{center}}%
  {\begin{center}\small\textbf{#1:~}%
      {#2}\end{center}}}%
\renewcommand{\figure}{%
  \let\@makecaption\@makefigcaption\@float{figure}}

% table caption
\newcommand{\@maketabcaption}[2]{%
  \sbox{\@tmpcaptionbox}{\small\textbf{#1 :~}{\slshape #2}}%
  \ifthenelse{\lengthtest{\wd\@tmpcaptionbox > \linewidth}}%
  {\begin{center}\begin{minipage}[t]{\linewidth}\small%
        \textbf{#1:~}{\slshape #2}%
      \end{minipage}\end{center}}%
  {\begin{center}\small\textbf{#1:~}%
      {\slshape #2}\end{center}}}%
\renewcommand{\table}{%
  \let\@makecaption\@maketabcaption\@float{table}}

% separator for top-of-page float
\newcommand{\topfigrule}{\noindent{\black\rule{\hsize}{0.4mm}}}

% citation style 
\citationstyle{dcu}
%\iflanguage{german}%
%{\renewcommand{\harvardand}{und}\bibliographystyle{rmpd}}%
{\bibliographystyle{rmpe}}

% additional citation commands
\newcommand{\multicite}[2]{% use only if authors are identical!
  \harvardleft\citename{#1}, \citeyear*{#1,#2}\nocite{#1,#2}\harvardright}
\newcommand{\multiciteasnoun}[2]{% use only if authors are identical!
  \citename{#1} \citeyear{#1,#2}\nocite{#1,#2}}

% cleardoublepage with white page in between
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}

% boldmath
\newcommand{\bm}[1]{\text{\boldmath $#1$}}
