%% uoythesis.cls %% Copyright 2023 A. Grau % % This work may be distributed and/or modified under the conditions of the LaTeX % Project Public License, either version 1.3 of this license or (at your option) % any later version, with the exception that distribution of Derived Work is not % subject to the requirements of section 6.2. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX version % 2005/12/01 or later. % % % This work has the LPPL maintenance status `maintained`. % % The Current Maintainer of this work is A. Grau. % % This work consists of all the files listed in the README.md, % and provides a copy of the original hosted on % https://git.tigrau.ovh/Ambroise/LaTeX-Templates/. % Comments starting with FORMAT highlight requirements from the UoY thesis % regulations, as of November 2023. % See https://www.york.ac.uk/research/graduate-school/academic/thesis/format/#tab-2 \NeedsTeXFormat{LaTeX2e} \ProvidesClass{uoythesis}[2023/11/13 v1.0 UoY Thesis] \providecommand{\is@uoyth@classloaded}{true} \RequirePackage{xkeyval} %%% Set class options \newcommand{\RaiseBooleanValueWarning}[1]{ \ClassError{uoythesis}{The option {#1} must be set with either true or false}{Option #1 only accepts a boolean value} } \newcommand{\RaiseFontSizeValueWarning}[1]{ \ClassWarning{uoythesis}{You gave size '#1' which is too small according to the guidelines. Automatically changing to the smallest value accepted: 11pt} } % options passed onto memoir: draft, final, oneside, twoside \newif\ifuoyth@draft \uoyth@draftfalse \DeclareOptionX{draft}{\uoyth@drafttrue \PassOptionsToClass{draft}{memoir}} \newif\ifuoyth@onesided \uoyth@onesidedfalse \PassOptionsToClass{twoside}{memoir} \DeclareOptionX{oneside}{\uoyth@onesidedtrue \PassOptionsToClass{oneside}{memoir}} % new available options: pagenbhead, pagenbfoot, noxr, nohyperref, hyperfinal, margins \newif\ifuoyth@pgnbhead \uoyth@pgnbheadtrue \define@choicekey*{uoythesis.cls}{pagenb}[\userval\choiceval]{head,foot}[head]{ \ifcase\choiceval\relax \uoyth@pgnbheadtrue \or \uoyth@pgnbheadfalse \fi } \ExecuteOptionsX{pagenb=head} \define@boolkey+{uoythesis.cls}[uoyth@]{noxr}[true]{}{\RaiseBooleanValueWarning{noxr}} \ExecuteOptionsX{noxr=false} \define@boolkey+{uoythesis.cls}[uoyth@]{nohyperref}[true]{}{\RaiseBooleanValueWarning{nohyperref}} \ExecuteOptionsX{nohyperref=false} \define@boolkey+{uoythesis.cls}[uoyth@]{hyperfinal}[true]{}{\RaiseBooleanValueWarning{nohyperref}} \ExecuteOptionsX{hyperfinal} \DeclareOptionX{hyperoptions}{ \ClassInfo{uoythesis.cls}{Passing options '#1' to package hyperref} \PassOptionsToPackage{#1}{hyperref} } %\ExecuteOptionsX{hyperoptions={}} % FORMAT: Font size must be at least 11pt, with 12pt recommended \newcommand{\uoyth@fontsize}{12pt} \newcommand{\uoyth@setsmallfontsize}{ \renewcommand{\uoyth@fontsize}{11pt} \PassOptionsToClass{11pt}{memoir} } \DeclareOptionX{8pt}{\uoyth@setsmallfontsize \RaiseFontSizeValueWarning{\CurrentOption}} \DeclareOptionX{9pt}{\uoyth@setsmallfontsize \RaiseFontSizeValueWarning{\CurrentOption}} \DeclareOptionX{10pt}{\uoyth@setsmallfontsize \RaiseFontSizeValueWarning{\CurrentOption}} % Pass all remaining unknown options to memoir to deal with them \DeclareOptionX*{% \PassOptionsToClass{\CurrentOption}{memoir} } % FORMAT: Avoid blank pages. \PassOptionsToClass{openany}{memoir} % FORMAT: The document must be on A4 paper. \PassOptionsToClass{a4paper}{memoir} \ProcessOptionsX \LoadClass[\uoyth@fontsize]{memoir} \disable@keys{uoythesis.cls}{draft,oneside,8pt,9pt,10pt} \ifuoyth@hyperfinal \newcommand{\uoyth@hyperoptions}{final} \else \newcommand{\uoyth@hyperoptions}{} \fi \ifuoyth@noxr \ifuoyth@nohyperref \else \RequirePackage[\uoyth@hyperoptions]{hyperref} \fi \else \ifuoyth@nohyperref \RequirePackage{xr} \else \RequirePackage{xr-hyper} \RequirePackage[\uoyth@hyperoptions]{hyperref} \fi \fi \disable@keys{uoythesis.cls}{noxr,nohyperref,hyperfinal,hyperoptions} %%% Formatting options % FORMAT: Use 1.5 line spacing. \OnehalfSpacing % FORMAT: GRS states as a recommendation that: % spine margin should be at least 40mm, % other margins should be at least 15mm. % In effect, their view is the following: % "We would recommend that they stick with the guidance re. margin on binding edge merely because we still get examiners who prefer to make themselves a physical copy to mark up, rather than using the digital annotation." % I have taken the stand to set the default value to 3cm on both sizes horizontally, % while putting 4cm vertically. The implementation below prevents the use of setting % the blocksize and then letting the margins be defined by a value relatively to that % blocksize. If you want to use these instead, you need to delete the macros below. % DOC: Check memoir package sec2.4.2 p.17-21 \newcommand{\horizontalmarginsvalue}[2][*]{\def\margin@spine{#2} \def\margin@foredge{#1}} \newcommand{\horizontalmarginsratio}[2][*]{\def\margin@spine{#2} \def\margin@hratio{#1}} \newcommand{\verticalmarginsvalue}[2][*]{\def\margin@up{#2} \def\margin@low{#1}} \newcommand{\verticalmarginsratio}[2][*]{\def\margin@up{#2} \def\margin@vratio{#1}} \@ifundefined{margin@spine}{ % none of the horizontal commands have been called \setlrmarginsandblock{3cm}{*}{1} % default with 3cm each side }{ % if margin@spine is defined, so is one of margin@foredge or margin@hratio \@ifundefined{margin@foredge}{ % at least ratio value is defined \setlrmarginsandblock{\margin@spine}{*}{\margin@hratio} }{ % at least foredge value is defined; hratio value is discarded if defined \setlrmarginsandblock{\margin@spine}{\margin@foredge}{*} } } \@ifundefined{margin@up}{ % none of the vertical commands have been called \setulmarginsandblock{4cm}{*}{1} % default with 3cm each side }{ % if margin@up is defined, so is one of margin@low or margin@vratio \@ifundefined{margin@low}{ % at least ratio value is defined \setulmarginsandblock{\margin@up}{*}{\margin@vratio} }{ % at least low value is defined; vratio value is discarded if defined \setulmarginsandblock{\margin@up}{\margin@low}{*} } } % Call the layout to respect the values set \checkandfixthelayout % FORMAT: Table of contents must include all document subdivisions. % Do not go below subsubsections. \settocdepth{subsubsection} \setsecnumdepth{subsubsection} % FORMAT: The font size of the headings should be smaller than the font size of % the main text. % NOTE: Hyperref messes up the capitalisation of headings containing a reference % label, so we use small-caps headings as a workaround. % See https://tex.stackexchange.com/q/562773/27664 \nouppercaseheads \pagestyle{headings} %\makeevenhead{headings}{\thepage}{}{\small\slshape\scshape\leftmark} %\makeoddhead{headings}{\small\slshape\scshape\rightmark}{}{\thepage} % FORMAT: A bibliography should contain every item consulted in writing the % thesis, while a list of references only contains the items explicitly % mentioned in the document. \renewcommand{\bibname}{References} %%% Title page \newcommand{\department}[1]{\def\@department{#1}} \newcommand{\qualification}[1]{\def\@qualification{#1}} \newcommand{\submitdate}[1]{\def\@submitdate{#1}} \newcommand{\subtitle}[1]{\gdef\cfg@subtitle{#1}} % Empty submitdate defaults to the current month and year. % Taken from the yorkThesis class by J H Pickering: % https://www.york.ac.uk/language/current/resources/software-resources/latex/ \def\@submitdate{% \ifcase\the\month\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi \space \number\the\year} \newlength{\droplen} \newcommand*{\makethesistitle}{\begingroup% % FORMAT: The title page should have number 1 (not visible), % hence the starred version of `titlingpage`. \begin{titlingpage*} % Centre the title with respect to the physical page, not the typeblock \calccentering{\unitlength} \begin{adjustwidth*}{\unitlength}{-\unitlength} \droplen=0.1\textheight \vspace*{\droplen} \centering {\Huge \@title} \@ifundefined{cfg@subtitle}{}{\\[\baselineskip]{\large\scshape\cfg@subtitle}} \\[2\baselineskip] {\Large \itshape \@author}\par \begin{vplace}[2] % Split surrounding vertical space with a 2:1 ratio {\large \scshape \@qualification}\\[2\baselineskip] {\LARGE \scshape University of York}\\[.5\baselineskip] {\LARGE \scshape \@department} \end{vplace} {\large \@submitdate}\par \vspace*{\droplen} \end{adjustwidth*} % FORMAT: The abstract should be on page 2, so we prevent clearing to % the next recto page. \titlingpageend{\clearforchapter}{\clearforchapter} \end{titlingpage*} \endgroup} \endinput