-
Notifications
You must be signed in to change notification settings - Fork 0
/
edmaths.sty
218 lines (183 loc) · 7.14 KB
/
edmaths.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
%% Package `edmaths' (26.8.2008)
%%
%% A LaTeX 2e style file for typesetting a
%% PhD thesis / First-Year Report / Master thesis / Fourth-year project
%% in the School of Mathematics, University of Edinburgh
%%
%% By Thomas Koeppe, 2006-7
%%
%%
%% Usage:
%% ------
%% Use \documentclass{report}
%% and \usepackage[{phd|firstyear|y4project|...},...]{edmaths}.
%%
%% Do define \title, \author, \date before loading this package!
%%
%% See documentation at http://www.maths.ed.ac.uk/pg/edmaths.html
%%
%%
%% Example usage:
%% --------------
%%
%% \documentclass[12pt,oneside]{report}
%% \title{Report Title}
%% \date{Report Date}
%% \author{Author Name}
%% \usepackage[phd,fancyhdr,hyperref,colour]{edmaths}
%% \flushbottom
%%
%% \begin{document}
%% \pagenumbering{roman}
%% \maketitle
%%
%% \begin{abstract} ... Abstract text ... \end{abstract}
%% \declaration
%% \dedication{...dedication text...}
%%
%% \tableofcontents
%% \addcontentsline{toc}{chapter}{Contents}
%% \newpage
%% \pagenumbering{arabic}
%%
%% [Main document body here, e.g. \chaper{...} \section{...} ... ]
%%
%% \bibliographystyle{...} % Or use the `amsrefs' package (http://www.ams.org/tex/amsrefs.html)!
%% \bibliography{bibliography file}
%% \addcontentsline{toc}{chapter}{Bibliography}
%% \end{document}
%%
%% ---------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{edmaths}[2007/02/05 Edinburgh maths thesis/report style v0.95]
\RequirePackage{calc,ifthen,setspace,amsmath,amsthm,amscd,amssymb}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set up the page size and margins %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\paperheight}{297mm} % A4 Paper
\setlength{\paperwidth}{210mm} %
\setlength{\oddsidemargin}{14.6mm} % Left/Inside: 4.0cm (rel. -1in)
\setlength{\evensidemargin}{-.4mm} % Right/Outside: 2.5cm (rel. -1in)
\setlength{\topmargin}{-17.4mm} % \
\setlength{\headheight}{6mm} % | Top: 2.0cm (rel. -1in), out of which 6mm for the header
\setlength{\headsep}{6mm} % /
\setlength{\textwidth}{145mm} % Margins: 2.5cm + 4cm
% Textheight delayed until we know the line spacing.
% The following is removed in favour of the `report' class options "oneside/twoside".
%\@twosidefalse \@mparswitchfalse % Single-sided by default
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Provide some fancy option %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newboolean{with-fourier} % Use the `fourier' package for Adobe Utopia font
\newboolean{with-hyperref} % Use the `hyperref' package for clickable links and bookmarks, all black
\newboolean{with-colour} % Add sane colours to the hyperref links
\newboolean{with-fancyhdr} % Use the `fancyhdr' package to provide header and footer
\ifthenelse{\isundefined{\degreetext}}{\newcommand{\degreetext}{Specify a degree option!}}{}
\ifthenelse{\isundefined{\stretchfactor}}{\newcommand{\stretchfactor}{1}}{}
\DeclareOption{fourier}{\setboolean{with-fourier}{true}}
\DeclareOption{hyperref}{\setboolean{with-hyperref}{true}}
\DeclareOption{colour}{\setboolean{with-colour}{true}}
\DeclareOption{fancyhdr}{\setboolean{with-fancyhdr}{true}}
\DeclareOption{phd}{\renewcommand{\degreetext}{Doctor of Philosophy}}
\DeclareOption{firstyear}{\renewcommand{\degreetext}{First-Year Report\\Graduate School of Mathematics}}
\DeclareOption{secondyear}{\renewcommand{\degreetext}{Second-Year Report\\Graduate School of Mathematics}}
\DeclareOption{thirdyear}{\renewcommand{\degreetext}{Third-Year Report\\Graduate School of Mathematics}}
\DeclareOption{y4project}{\renewcommand{\degreetext}{Year 4 Project\\School of Mathematics}}
\DeclareOption{masterph}{\renewcommand{\degreetext}{Master of Philosophy}}
\DeclareOption{mastersc}{\renewcommand{\degreetext}{Master of Science by Research}}
\DeclareOption{MMath}{\renewcommand{\degreetext}{Master of Mathematics with Honours \\ School of Mathematics}}
{\renewcommand{\degreetext}{Master of Mathematics with Honours \\ School of Mathematics}}
\DeclareOption{single}{\renewcommand{\stretchfactor}{1}}
\DeclareOption{onehalf}{\renewcommand{\stretchfactor}{1.5}}
\DeclareOption{double}{\renewcommand{\stretchfactor}{2}}
%\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse} % Single-sided by default
%\DeclareOption{twosides}{\@twosidetrue \@mparswitchtrue}
\ProcessOptions
\ifthenelse{\boolean{with-fourier}}
{ \RequirePackage{cmap}
\RequirePackage{fourier}
\RequirePackage[T1]{fontenc}
\RequirePackage{microtype}
} {}
\ifthenelse{\boolean{with-hyperref}}
{
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage[pdftitle={\@title}, pdfauthor={\@author}, pdfcreator={PDFLaTeX with edmaths}, pdfpagelayout=OneColumn, colorlinks=true, linkcolor=black, urlcolor=black, citecolor=black]{hyperref}
\ifthenelse{\boolean{with-colour}}
{
\hypersetup{linkcolor=Sepia, urlcolor=NavyBlue, citecolor=Sepia}
} {}
} {}
\ifthenelse{\boolean{with-fancyhdr}}
{
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RO,LE]{\thepage}
\fancyfoot[RO,LE]{\thepage}
\fancyhead[LO]{\it\@title}
\fancyhead[RE]{\@author}
\fancyfoot[RE,LO]{}
} {}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set up the text body height %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For the text height, we calculate the largest number of lines that gives us no more than 4cm bottom margin.
% This depends on the line spacing, which we need first.
\setstretch{\stretchfactor}
% Debug only: In the next line, \XXXfactor contains the number of lines on a text-only page.
%\newlength{\XXXunit}\setlength{\XXXunit}{1pt}\newlength{\XXXfactor}\setlength{\XXXfactor}{1pt + ((672pt - \topskip) / \baselineskip) * \XXXunit}
\newlength{\scratchlength}\setlength{\scratchlength}{\topskip + ((672pt - \topskip) / \baselineskip) * \baselineskip + \baselineskip}
\setlength{\textheight}{\scratchlength}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make the title page etc %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\maketitle}{%
\begin{titlepage}
\singlespacing
\addtolength{\oddsidemargin}{-0.75cm}
\begin{center}
\null\vskip 4.1cm
\begin{minipage}[t][7.6cm]{10.5cm}
\begin{center}
{\LARGE\textbf{\@title}\par}\vfill
{\Large\textit{\@author}\par}
\end{center}
\end{minipage}
\vfill
{\Large\degreetext \par University of Edinburgh \par\@date \par}
\end{center}
\end{titlepage}
\if@twoside
\thispagestyle{empty}
\cleardoublepage
\else
\addtocounter{page}{1}
\fi
}
\newcommand{\declaration}{%
\chapter*{Declaration}
\begin{singlespace}
I declare that this thesis was composed by myself
and that the work contained therein is my own,
except where explicitly stated otherwise in the text.
\end{singlespace}
{\raggedleft\vspace{2cm}(\textit{\@author})
}
}
\renewenvironment{abstract}{\chapter*{\abstractname}}{\addcontentsline{toc}{chapter}{\abstractname}}
\newcommand{\dedication}[1]{%
\clearpage
\thispagestyle{plain}
\vspace*{7cm}
\begin{center}
\Large\it #1
\end{center}
}
%% A special declaration for Year 4 reports
\newcommand{\yfourdeclaration}[1]{%
\vfill
\noindent
This project report is submitted in partial fulfilment of the requirements for the degree of
\textit{#1}.
}