summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/jasthesis/jasthesis.cls
blob: 227166c49675a39ff2cc338ee822b86817571d12 (plain)
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
% Version 0.5
% 23rd May 2002 (jAs)
%
\typeout{ }
\typeout{You can probably use this in much earlier versions of LaTeX2e}
\NeedsTeXFormat{LaTeX2e}[2000/06/01]
\ProvidesClass{jasthesis}[2002/05/22 v0.5 (www.jamesAshepherd.com)]
\RequirePackage{ifthen}

\typeout{ }
\typeout{jasthesis.cls 2002/05/22 v0.5 (www.jaemsAshepherd.com)}
\typeout{ }
\typeout{This LaTeX class conforms to the requirements of}
\typeout{a thesis to be submitted to the University of Bristol}
\typeout{that is, roughtly BS4821:1990}
\typeout{ }

\typeout{ }
\typeout{Checking for option 'jasheads' to have section numbering in the margin}
\newboolean{jas@heads} \setboolean{jas@heads}{false}
\DeclareOption{jasheads}{\renewcommand{\@seccntformat}[1]{{\protect\makebox[0pt][r]{\@nameuse{the#1}.~}}}
                         \setboolean{jas@heads}{true}}
\ProcessOptions*

\typeout{ }
\typeout{12pt text, A4 paper, twosided}
\LoadClass[12pt,a4paper,twoside]{book}

\typeout{ }
\typeout{linespacing set at 1.5}
\renewcommand{\baselinestretch}{1.5}

\typeout{ }
\typeout{Centre page number at bottom, left heading section, right heading chapter}
\typeout{Margins: Binding 40mm, others 20mm}
\let\jas@headings=\ps@headings
\newcommand{\ps@jasthesis}{\jas@headings
 \ifthenelse{\boolean{jas@heads}}{
  \renewcommand{\@evenhead}{\ifthenelse{\value{chapter}=0}{}{
                            \begin{minipage}{\textwidth}
                             \normalfont\bfseries\sffamily\chaptername~\thechapter~~\jas@eventext\hfill
                             \\[-1em]\rule{\textwidth}{0.6pt}
                            \end{minipage}}}
  \renewcommand{\@oddhead}{\ifthenelse{\value{chapter}=0}{}{
                           \begin{minipage}{\textwidth}
                            \normalfont\bfseries\sffamily\hfill\thesection~~\jas@oddtext
                            \\[-1em]\rule{\textwidth}{0.6pt}
                           \end{minipage}}}
 }
 {
  \renewcommand{\@evenhead}{\leftmark\hfill}
  \renewcommand{\@oddhead}{\hfill\rightmark}
 }{}
 \renewcommand{\@evenfoot}{\hfill\thepage\hfill}
 \renewcommand{\@oddfoot}{\@evenfoot}

 \setlength{\voffset}{-1in}
 \setlength{\hoffset}{-1in}
 \setlength{\oddsidemargin}{45mm}
 \setlength{\evensidemargin}{20mm}
  \ifthenelse{\boolean{jas@heads}}{
   \addtolength{\evensidemargin}{5mm}
   \setlength{\headheight}{1em}
   \setlength{\headsep}{2em}
  }{}
 \setlength{\topmargin}{\evensidemargin}
 \setlength{\textwidth}{\paperwidth} \addtolength{\textwidth}{-\oddsidemargin}
                                     \addtolength{\textwidth}{-\evensidemargin}
 \setlength{\textheight}{\paperheight} \addtolength{\textheight}{-2\topmargin}
                                       \addtolength{\textheight}{-\headheight}
                                       \addtolength{\textheight}{-\headsep}
}

\newcommand{\ps@jastitlepage}{\jas@headings
 \renewcommand{\@evenhead}{}
 \renewcommand{\@oddhead}{}
 \renewcommand{\@evenfoot}{}
 \renewcommand{\@oddfoot}{}

 \setlength{\headheight}{0mm}
 \setlength{\headsep}{\footskip}
 \setlength{\voffset}{-1in}
 \setlength{\hoffset}{-1in}
 \setlength{\oddsidemargin}{45mm}
 \setlength{\evensidemargin}{20mm}
 \setlength{\topmargin}{\evensidemargin}
 \setlength{\textwidth}{\paperwidth} \addtolength{\textwidth}{-\oddsidemargin}
                                     \addtolength{\textwidth}{-\evensidemargin}
 \setlength{\textheight}{\paperheight} \addtolength{\textheight}{-2\topmargin}
                                       \addtolength{\textheight}{-\headheight}
                                       \addtolength{\textheight}{-\headsep}
 \renewcommand{\baselinestretch}{1}
}

\ifthenelse{\boolean{jas@heads}}{
 \newcommand{\ps@jaschapter}{\jas@headings
  \renewcommand{\@evenhead}{}
  \renewcommand{\@oddhead}{}
  \renewcommand{\@evenfoot}{\hfill\thepage\hfill}
  \renewcommand{\@oddfoot}{\@evenfoot} 
 
  \setlength{\voffset}{-1in}
  \setlength{\hoffset}{-1in}
  \setlength{\oddsidemargin}{45mm}
  \setlength{\evensidemargin}{20mm}

  \addtolength{\evensidemargin}{5mm}
  \setlength{\headheight}{2\baselineskip}
  \setlength{\headsep}{2em}

  \setlength{\topmargin}{\evensidemargin}
  \setlength{\textwidth}{\paperwidth} \addtolength{\textwidth}{-\oddsidemargin}
                                      \addtolength{\textwidth}{-\evensidemargin}
  \setlength{\textheight}{\paperheight} \addtolength{\textheight}{-2\topmargin}
                                        \addtolength{\textheight}{-\headheight}
                                        \addtolength{\textheight}{-\headsep}
  \renewcommand{\baselinestretch}{1.5}
}
}{}
\pagestyle{jasthesis}

\newcommand{\jas@title}{}
\newcommand{\thesistitle}[1]{\renewcommand{\jas@title}{#1}}

\newcommand{\jas@subtitle}{}
\newcommand{\thesissubtitle}[1]{\renewcommand{\jas@subtitle}{#1}}

\newcommand{\jas@volume}{}
\newcommand{\thesisvolume}[1]{\renewcommand{\jas@volume}{#1}}

\newcommand{\jas@author}{}
\newcommand{\thesisauthor}[1]{\renewcommand{\jas@author}{#1}}

\newcommand{\jas@degree}{}
\newcommand{\thesisdegree}[1]{\renewcommand{\jas@degree}{#1}}

\newcommand{\jas@wordcount}{}
\newcommand{\thesiswordcount}[1]{\renewcommand{\jas@wordcount}{#1}}

\newcommand{\thesismaketitle}{
  \thispagestyle{jastitlepage}\addtocounter{page}{-2}
  \mbox{}\begin{minipage}[t][0mm]{\textwidth}
          \begin{center}\Huge\sffamily\bfseries\jas@title\end{center}
          \mbox{}
          \begin{center}\sffamily\bfseries\jas@subtitle\end{center}
          \mbox{}
          \begin{center}\sffamily\jas@volume\end{center}
         \end{minipage}
  \vfill
  \mbox{}\begin{minipage}{\textwidth}
           \begin{center}\Large\sffamily\jas@author\end{center}
         \end{minipage}
  \vfill
  \mbox{}\begin{minipage}[b][0pt]{\textwidth}
          \begin{center}
           \jas@degree
          \end{center}
          \hfill\jas@wordcount
         \end{minipage}
 \newpage\thispagestyle{jastitlepage}\mbox{}\pagebreak
}

\ifthenelse{\boolean{jas@heads}}{
 \newcommand{\jas@eventext}{}
 \newcommand{\jas@oddtext}{}

  \renewcommand{\section}[2][]{
  \ifthenelse{\equal{#1}{}}%
   {\renewcommand{\jas@oddtext}{#2}
    \@startsection{section}{0}{0pt}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus .2ex}%
     {\normalfont\bfseries\Large}{#2}
   }
   {\renewcommand{\jas@oddtext}{#1}
    \@startsection{section}{0}{0pt}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus .2ex}%
     {\normalfont\bfseries\Large}[#1]{#2}
   }
 }
}{}

\newcommand{\thesisabstract}[1]{
 \cleardoublepage
 \renewcommand{\baselinestretch}{1}\normalfont
 \mbox{}\vspace{6em}\\
 {\Huge\bfseries Abstract}
 \begin{quotation}#1\end{quotation}
 \par\renewcommand{\baselinestretch}{1.5}\normalfont
}

\newcommand{\thesisdedication}[1]{
 \cleardoublepage
 \renewcommand{\baselinestretch}{1}\normalfont
 \mbox{}\vspace{6em}\\
 {\Huge\bfseries Dedication and\\ Acknowledgements}
 \begin{quotation}\slshape#1\end{quotation}
 \par\renewcommand{\baselinestretch}{1.5}\normalfont
}

\newcommand{\thesisdeclaration}[1]{
 \cleardoublepage
 \renewcommand{\baselinestretch}{1}\normalfont
 \mbox{}\vspace{6em}\\
 {\Huge\bfseries Author's Declaration}
 \begin{quotation}
 #1
 ~\\~\\
 \makebox[0pt][r]{Signed:}\makebox[8cm]{~\dotfill}
 ~\\~\\
 \makebox[0pt][r]{Date:}\makebox[4cm]{~\dotfill}
 \end{quotation}
 \par\renewcommand{\baselinestretch}{1.5}\normalfont
}


\typeout{ }
\typeout{Ensuring contents page/list of figures/list of tables/titles is singlespaced}
\typeout{I'm afraid I can't see anyway of making the contents pages singleside}
% put \addtocontents{toc}{\cleardoublepage} in the section where you want the page break

\let\jas@contents=\tableofcontents
\renewcommand{\tableofcontents}{
 \par\renewcommand{\baselinestretch}{1}\normalfont
 \jas@contents
 \par\renewcommand{\baselinestretch}{1.5}\normalfont
}

\let\jas@figures=\listoffigures
\renewcommand{\listoffigures}{
 \par\renewcommand{\baselinestretch}{1}\normalfont
 \jas@figures
 \par\renewcommand{\baselinestretch}{1.5}\normalfont
}

\let\jas@tables=\listoftables
\renewcommand{\listoftables}{
 \par\renewcommand{\baselinestretch}{1}\normalfont
 \jas@tables
 \par\renewcommand{\baselinestretch}{1.5}\normalfont
}

% Edited from book.cls
%----------------------------------------------------------------------------

\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \renewcommand{\jas@eventext}{#1}
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\def\@makechapterhead#1{%
  \vspace*{5\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \par\renewcommand{\baselinestretch}{1}\normalfont
        \centering\huge\bfseries \@chapapp\space \thechapter
        \par\nobreak\renewcommand{\baselinestretch}{1.5}\normalfont
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \par\renewcommand{\baselinestretch}{1}\normalfont
    \centering\Huge \bfseries #1\par\nobreak\renewcommand{\baselinestretch}{1}\normalfont
    \vskip 40\p@
  }}

\renewcommand\section[2][]{\par\renewcommand{\baselinestretch}{1}\normalfont
                                    \ifthenelse{\equal{#1}{}}{\renewcommand{\jas@oddtext}{#2}
                                     \@startsection {section}{1}{\z@}%
                                     {-3.5ex \@plus -1ex \@minus -.2ex}%
                                     {2.3ex \@plus.2ex}%
                                     {\normalfont\Large\bfseries}{#2}}
                                    {\renewcommand{\jas@oddtext}{#1}
                                     \@startsection {section}{1}{\z@}%
                                     {-3.5ex \@plus -1ex \@minus -.2ex}%
                                     {2.3ex \@plus.2ex}%
                                     {\normalfont\Large\bfseries}[#1]{#2}}
                            \par\nobreak\renewcommand{\baselinestretch}{1.5}\normalfont}

\renewcommand\subsection[2][]{\par\renewcommand{\baselinestretch}{1}\normalfont
                                    \ifthenelse{\equal{#1}{}}{%
                                     \@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}{#2}}
                                    {\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}[#1]{#2}}
                            \par\nobreak\renewcommand{\baselinestretch}{1.5}\normalfont}

\renewcommand\subsubsection[2][]{\par\renewcommand{\baselinestretch}{1}\normalfont
                                    \ifthenelse{\equal{#1}{}}{%
                                     \@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}{#2}}
                                    {\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}[#1]{#2}}
                            \par\nobreak\renewcommand{\baselinestretch}{1.5}\normalfont}
%----------------------------------------------------------------------------

\typeout{ }