%
% This file is designed to contain the macros etc for my thesis
%       -- David Kennedy 1997
%
%	with updates by Martin Cartwright
%			Peter Gallagher
%			Fergal Crawford
%

%
% Note that some the macros in this file have been laid out over several lines
% simply to make the code more readable, especially when used with the LaTeX
% highlighting available in Nedit. It also makes it easier to follow the format
% for less experienced LaTeX users who want to make a change or three.
%
% This doesn't work so well with the macros intended to insert text into a body
% of text, i.e. macros like \km, \eg, \ion{}{} With this type of macro a line
% break can sometimes be important inside the command, be sure to test it 
% before laying it out just so that it looks nice!
% 

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mythesis}[1997/09/09]
\typeout{                                                         }
\typeout{---------------------------------------------------------}
\typeout{-------OOOOO----OO----OOOOOO---OOOO--OOOOO---OOOO--------}
\typeout{-------O-------O--O---O-------O------O------O------------}
\typeout{-------OOO----OOOOOO--OOOOO---O------OOOO----OOOO--------}
\typeout{-------O------O----O--O-------O------O-----------O-------}
\typeout{-------O------O----O--O-------O------O------O----O-------}
\typeout{-------O------O----O--OOOOOO---OOOO--OOOOO---OOOO--------}
\typeout{---------------------------------------------------------}
\typeout{                                                         }
\typeout{ A simple LaTeX style file by David Kennedy, Sept. 1997. }
\typeout{ For help on the new commands please see the help files: }
\typeout{     thesis-template.tex                                 }
\typeout{     thesis-help.tex                                     }
\typeout{                                                         }

% For the \documentclass[printdraft]{mythesis} option.
\DeclareOption{printdraft}{\AtEndOfClass{\RequirePackage[light,first,bottomafter]{draftcopy}}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions
\LoadClass[12pt,a4paper]{report}
\newcommand{\version}{v1.3 (with some changes...)}

%
% Adjust the paper size to make the printed area larger. QUB asks for left
% margin of 4cm, all other margins 2 cm. This should be close enough. Have to
% allow for roman numerals on content pages etc. Use absolute values in case
% the 'report' class defaults change.
%
% 
\setlength{\topmargin}{-1.5cm}
\setlength{\marginparwidth}{0cm}
\setlength{\marginparsep}{0cm}
\setlength{\oddsidemargin}{1.7cm}
\setlength{\evensidemargin}{1.7cm}
\setlength{\textheight}{24.5cm}
\setlength{\footskip}{0.8cm}
\setlength{\textwidth}{14.6cm}
\setlength{\headheight}{1cm}

\usepackage{mathptm}		%%%causes major tremblings under Linux. Not good.

%
% Include several useful packages.
%
\newif\ifAMStwofonts
\AMStwofontstrue		%  allows more sizes and types of fonts
%
\RequirePackage{plain}       	%  allows doublespacing control
\RequirePackage{setspace}       %  allows doublespacing control
\RequirePackage{graphicx}       %  .eps figure inclusion
\RequirePackage{lscape}         %  a landscape environment
\RequirePackage{amssymb}        %  extended mathematical character set
\RequirePackage{wasysym}        %  some astronomical symbols
\RequirePackage{longtable}	%  multipage table package
\RequirePackage{fancyhdr}	%  nice headed pages
\RequirePackage{xspace}		%  automatic macro spacing
\RequirePackage{multicol}	%  mix 1 and 2 column text
\RequirePackage{fancybox}	%  fancy boxes, oddly enough
\RequirePackage{calc}		%  Allow maths on LaTeX params
				%  eg., in a figure can do
				%     [width=\textwidth-1cm]
\RequirePackage{epsfig}		%  chapter .eps figure inclusion
\RequirePackage{graphics}	%  um, a graphics thing?
\RequirePackage{minitoc}	%
\usepackage{supertabular}	%  super tabular


%
% If you have problems getting the Table of Contents to display the correct
% pages (I had this problem with the List of Figures page), then run ./thesis
% and then edit your thesis.toc file to contain the correct page numbers.  Now
% uncomment the following line (\nofiles) and run ./thesis one last time.  Your
% Table of Contents will read the old thesis.toc (which you have edited and
% should therefore be correct).  All references throughout the thesis will be
% undefined, but you have an accurate Table of Contents which you can put in 
% your final Thesis draft.  Simple.  If anyone comes up with a nicer solution, 
% I'd like to hear about it.  Fergal, April 2000.
%
%\nofiles

%
% Show this many sectional units in the Table of Contents.
%
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

%
% Float handling improved.
% May have figures, tables and text on same page.
%
\renewcommand\floatpagefraction{.8}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.85}
\renewcommand\textfraction{.15}

%
% A \thesishead command - declare lots of details away from the user.
%
\newcommand{\thesishead}[0]%
                        {%
                        \setcounter{page}{0}
                        \setcounter{chapter}{0}
                        \pagestyle{fancy}
                        \renewcommand{\chaptermark}[1]{\markboth{##1}{}}
                        \renewcommand{\sectionmark}[1]{\markright{\thesection\ ##1}}
                        \fancyhf{}
                        \fancyhead[LE,RO]{\bfseries\thepage}
                        \fancyhead[LO]{\bfseries\rightmark}
                        \fancyhead[RE]{\bfseries\leftmark}
                        \begin{document}
                        \pagenumbering{roman}
                        }

%
% A \thetitlepage command {title}{name}{date}
%
\newcommand{\thetitlepage}[3]%
                        {%
                        \begin{titlepage}
                        \begin{centering}
                        \vspace*{1cm}
                        \LARGE
                        \textup{\bf {#1}}\\
                        \large
                        \vspace*{2cm}
                        \textup{A thesis submitted for the degree of}\\
                        \textup{Doctor of Philosophy}\\
                        \vspace*{2cm}
                        \textup{by}\\
                        \vspace*{2cm}
                        \Large
                        \textup{#2}\\
                        \large
                        \vspace*{2cm}
                        \textup{Faculty of Science and Agriculture}\\
                        \vspace*{1cm}
                        \textup{Department of Pure and Applied Physics}\\
                        \textup{Queen's University Belfast}\\
                        \textup{Belfast, Northern Ireland}\\
                        \vspace*{2cm}
                        \textup{#3}\\
                        \end{centering}
                        \end{titlepage}
                        }

%
% A dedication environment
%
\newcommand{\dedication}[1]%
                        {%
                        \begin{titlepage}
                        \begin{centering}
                        \vspace*{7cm}
                        \textbf{#1\\}
                        \end{centering}
                        \end{titlepage}
                        }

%
% An abstract environment.
%
\newenvironment{theabstract}[0]%
                        {%
%                        \appendix
                        \chapter*{Abstract}
                        \markboth{Abstract}{Abstract}
                        \addcontentsline{toc}{chapter}{Abstract}
                        \doublespacing
			}%

%
% An acknowledgements environment
%
% The three (four?) lines of gibberish below produce the little 'Made with LaTeX'
% tag.  Yes, I know it's stupid!
%\makeatletter
%\def\ps@LaTeX{\def\@oddhead{}\def\@evenhead{}\def\@oddfoot{\hfill \tiny
%\ovalbox{\LaTeX\ style file \texttt{mythesis}
%\version}\hfill}\def\@evenfoot{\LaTeX}}
%
%  An acknowledgements environment.
%
\newenvironment{acknowledgements}[0]%
                        {%
                        \newpage
                        \chapter*{Acknowledgements}
                        \addcontentsline{toc}{chapter}{Acknowledgements}
%                        \thispagestyle{LaTeX}
                        }%
                        {%
                        % No command
                        }%

%
%  A \thesiscontents command - declare more details away from the user.
%
\newcommand{\thesiscontents}[0]%
                        {%
                        \onehalfspacing
                        \tableofcontents
                        \listoftables
                        \addcontentsline{toc}{chapter}{List of Tables}
                        \listoffigures
                        \addcontentsline{toc}{chapter}{List of Figures}
                        }

%
% A publications environment, single spaced.
%
\newenvironment{publications}[0]%
                        {%
                        %\appendix
                        \chapter*{Publications}
                        \markboth{Publications}{Publications}
                        \addcontentsline{toc}{chapter}{Publications}
                        \singlespacing
                        A list of publications resulting from work presented in
                        this thesis is given below.
                        }%
                        {%
                        }
\newenvironment{refereed}[0]%
                        {%
                        \section*{Refereed Publications}
                        \begin{enumerate}
                        }%
                        {%
                        \end{enumerate}
                        }
\newenvironment{nonrefereed}[0]%
                        {%
                        \section*{Non-refereed Publications}
                        \begin{enumerate}
                        }%
                        {%
                        \end{enumerate}
                        }

%
%  A \thesisbody command - declare even more details away from the user.
%
\newcommand{\thesisbody}[0]%
                       {%
                       \pagenumbering{arabic}
                       \setcounter{page}{1}
                       \setlength{\parskip}{\baselineskip/2}
                       \doublespacing
                       }

%
%  A \thesischapter command - simply includes a newpage
%
\newcommand{\thesischapter}[1]%
			{%
			\chapter{#1}
			\newpage
			}

%
% A references environment. The {description} environment is _not_ 
% perfect - I was looking for a macro that would give me a hanging
% indent.  So you need to stick in a \hspace of -2mm for every item,
% i.e. \item\hspace{-2mm}Keenan, F.P. \etal 19xx, blah blah
%
\newenvironment{references}[0]%
			{%
			\appendix
			\chapter*{References}
			\markboth{References}{References}
			\addcontentsline{toc}{chapter}{References}
%			\singlespacing
                        \onehalfspacing
			\begin{description}
			}%
			{%
			\end{description}
			}%
			{%
			\newpage
			}

%
% An \appendices command - set up new chapter numbering and adds a sectional
% title to the Table of Contents (With the \chapter and \addcontentsline bits 
% commented out, you can get rid of the page saying Appendices and the Table of
% Contents line saying the same...
%
\newcommand{\appendices}[0]%
                        {%
                        %\chapter*{Appendices}
                        %\addcontentsline{toc}{part}{Appendices}
                        \appendix
                        }

%
% A \thesisappendix command, sorts out automatic headers too.
%
\newcommand{\thesisappendix}[1]%
                        {%
                        \chapter{#1}
                        \newpage
                        \markboth{Appendix \thechapter}{Appendix \thechapter}
                        }

%
% Note - xspace puts a space in if the next character isn't a .,;: or similar.
% Dead clever.
% Using \@\xspace will mean that the preceding character is a lower case letter
% for spacing purposes, as in e.g.\@\xspace
%

%
% A kms macro.
%
\newcommand{\km}[0]{\unskip\ensuremath{\,\textup{km\,s}^{-1}}\xspace}

%
% A cm^{x} macro.
%
\newcommand{\cm}[1]{\unskip\ensuremath{\,{\rm cm}^{#1}}\xspace}

%
% A macro to keep et al. tidy,
%
\newcommand{\etal}[0]{{\em et~al}.\@\xspace}

%
% Macros for eg, cf and ie  Probably no need to use long syntax here!
%
\newcommand{\eg}[0]{{\em e.g}.\@\xspace}
\newcommand{\cf}[0]{{\em cf}.\@\xspace}
\newcommand{\ie}[0]{{\em i.e}.\@\xspace}
\newcommand{\etc}[0]{{\em etc}.\@\xspace}

%
% Keep the reduction section consistent
%
\newcommand{\prog}[1]{\textsc{#1}}
\newcommand{\rout}[1]{\texttt{#1}}

%
% Degree, arcmin and arcsec symbols
%
\newcommand{\degr}[0]{\unskip\ensuremath{^{\circ}}\xspace}
\newcommand{\arcmin}[0]{\unskip\ensuremath{^{\prime}}\xspace}
\newcommand{\arcsec}[0]{\unskip\ensuremath{^{\prime\prime}}\xspace}

%
% Hour, minute and second symbols
%
\newcommand{\hour}[0]{\unskip\ensuremath{^{h}}\xspace}
\newcommand{\minute}[0]{\unskip\ensuremath{^{m}}\xspace}
\newcommand{\second}[0]{\unskip\ensuremath{^{s}}\xspace}

%
% A solar subscript - a mass of $\sim\,15\,M\sol$
%
\newcommand{\sol}[0]{\ensuremath{_{\odot}}\xspace}

%
% A T_eff macro
%
\newcommand{\teff}[0]{\ensuremath{T_{\rm eff}}\xspace}

%
% A log g macro
%
\newcommand{\logg}[0]{\ensuremath{\log g}\xspace}

%
% A command to make HI etc easier, \ion{H}{i}
%
\DeclareRobustCommand{\ion}[2]{\relax\ifmmode
                              \ifx\testbx\f@series
                              {\mathbf{#1\,\mathsc{#2}}}\else
                              {\mathrm{#1\,\mathsc{#2}}}\fi
                              \else\textup{#1\,{\mdseries\textsc{#2}}}%
                              \fi}

%
%  Rh
%
\newcommand{\rh}[0]{\ensuremath{R_{\rm h}}\xspace}

%
% Afrho macro
%
\newcommand{\afrho}[0]{\ensuremath{Af\rho}\xspace}

%
%  reff
%
\newcommand{\reff}[0]{\ensuremath{r_{\rm eff}}\xspace}

%
%mol s-1
%
\newcommand{\molsec}[0]{\ensuremath{\rm mol\,s^{-1}}\xspace}

%
%erg cm-2 s-1
%
\newcommand{\ecms}[0]{\ensuremath{\rm erg\,\ cm^{-2}\,\ s^{-1}}\xspace}

%
%erg cm-2 s-1 A-1
%
\newcommand{\ecmsa}[0]{\ensuremath{\rm \ecms\,\ \AA^{-1}}\xspace}

%
%magnitudes
%
\newcommand{\m}[1]{\unskip\ensuremath{\,m_{#1}}\xspace}

%
% A quick way to note SIMBAD, QUB and STARLINK, IRAF, DIPSO
%
\newcommand{\simbad}{\mbox{\sc simbad}\xspace}
\newcommand{\qub}{\mbox{Q.U.B.}\xspace}
\newcommand{\starlink}{\mbox{\sc starlink}\xspace}
\newcommand{\iraf}{\mbox{\sc iraf}\xspace}
\newcommand{\dipso}{\mbox{\sc dipso}\xspace}

%
% Poncy new font commands
%
\newcommand{\pand}{\usefont{OT1}{panr}{b}{n}}

%
% Dave got bored one day and added some lines to the chapter title pages.
% Martin got boreder and added more, and the piccy... Just delete this whole
% section if you don't want these lines.
%
\def\@makechapterhead#1{%
  \thispagestyle{empty}
  \vspace*{50\p@}%
%the \sf causes a sans-serif font on the chapter pages -- remove to return to serif.
%  {\parindent \z@ \raggedright \normalfont \sf
  {\parindent \z@ \raggedright \normalfont \sl
    \begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}
    \ifnum \c@secnumdepth >\m@ne
%	comments out the bit that makes the 'CHAPTER #' bit bold
%        \vspace*{-20mm} \Huge\bfseries \@chapapp\space \thechapter & \\
        \vspace*{-20mm} \Huge \@chapapp\space \thechapter & \\
%	& \includegraphics{chapter_pic.eps} \\	DRW
%	& \vspace{10mm}\includegraphics{figures/chapterhead/chapter_pic.eps} \\
	%& \vspace{10mm}\shadowbox{\includegraphics[width=1.2in]{figures/chapterhead/magstar2.eps}} \\
	&
\vspace{10mm}\shadowbox{\includegraphics[width=1.2in]{figures/chapterhead/sun-crnr.ps}} \\
%	& \includegraphics[draft]{chapter_pic.eps} \\
    \fi
    \end{tabular*}
    \rule{\textwidth}{1mm}\vspace*{-7.5mm}
	\rule{\textwidth}{0.5mm}\par
    \vspace{3mm}
    \raggedleft
    \interlinepenalty\@M
%    \huge \bfseries #1\\[5pt]      %makes the chapter titles normal thickness
    \huge #1\\[5pt]
    \rule{\textwidth}{0.5mm}\vspace*{-16.0mm} 
    \rule{\textwidth}{1mm}\par 
    \vskip 40pt
  }
  \newpage
}

\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}

%
% This bit added by Peter to make subsections italic
%
\renewcommand{\subsection}{\@startsection
  {subsection}%
  {2}%
  {0mm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\bfseries\large\itshape}}

%
% And to make 'Figure' and 'Table' bold
%
\def\fnum@figure{{\bf Figure \thefigure}}
\def\fnum@table{{\bf Table \thetable}}

%
% Just another hyphen to stop overfull lines...  Add a - wherever you want a
% break.
%
\hyphenation{Oster-brock Mc-Kenna}


%
% END
%
