Modify things and test around

Options are always passed to memoir, even if I don't want them to, like 8pt...
This commit is contained in:
Alphrag
2023-11-12 02:07:03 +00:00
parent d54c633b7b
commit 2e9103c4af
5 changed files with 247 additions and 11 deletions

Binary file not shown.

View File

@@ -27,14 +27,14 @@
%%% ==== Begin file
% FORMAT: Font size must be at least 11pt, 12pt is set as default
% TODO: Change `draft` to `final` for the published version.
\documentclass[draft]{yorkthesis}
\documentclass[draft,8pt]{uoythesis}
% Import the personal options for the class
\usepackage{thesisoptions}
% Import the preamble with all the packages and macros
\input{mypreamble}
%%% ==== Thesis title page info
\title{Writing your maths thesis at UoY\todo{change title}}
\subtitle{A documented example on its structure and use\todo{change/remove subtitle}} % optional

View File

@@ -25,9 +25,8 @@
%%% ===== Folder structure
% Important packages to use in order to work with the subfiles
\usepackage{xr-hyper} % cross-referencing with use of hyperref
\usepackage{subfiles} % use file structure in subfolders
\externaldocument{\subfix{main}} % all refs available in subfiles by \ref{labelname} as usual
\externaldocument[XR-]{\subfix{main}} % all refs available in subfiles by \ref{labelname} as usual
%% NOTE: The following code make an additional paths search
%% search to simplify the calls to \subfile if you don't want
@@ -35,11 +34,11 @@
%% the folders' name appropriately to the list with the {dir/}
%% syntax (brackets and trailing slash).
%% WARNING: This slows down compilation time A LOT!!!
\makeatletter
\def\input@path{ %
{../Bibfiles/}{C-Begin/}{C-Middle/}{C-End/} % list of folders
}
\makeatother
%\makeatletter
%\def\input@path{ %
% {../Bibfiles/}{C-Begin/}{C-Middle/}{C-End/}{Bibfiles/} % list of folders
% }
%\makeatother
%%% ===== BEGIN OVERLEAF_EXTERNAL_DOC
@@ -68,7 +67,6 @@
%%% ===== List of recommended packages you need to include
\usepackage{amsmath, amsthm}
\usepackage{amssymb, amsfonts}
\usepackage[final]{hyperref} % links with final option to force them to appear even in draft mode
\usepackage{xspace} % for automatic spaces after text commands
\usepackage{xcolor} % to use colours in different parts
% NOTE: Package for the todo notes. Notice that it uses multiple packages such as
@@ -97,7 +95,7 @@
% (i.e. \u{}), see
% https://tex.stackexchange.com/a/170586/27664.
]{biblatex}
\addbibresource{\subfix{firstbib.bib}}
\addbibresource{\subfix{Bibfiles/firstbib.bib}}

View File

@@ -23,6 +23,13 @@
% https://git.tigrau.ovh/Ambroise/LaTeX-Templates/.
\ProvidesPackage{thesisoptions}[2022/07/08 v1.0 Options for the York Thesis class]
\@ifundefined{is@uoyth@classloaded}{
\PackageError{thesisoption}{
This package should only be used if the uoythesis class is used
}{
Verify that you are indeed using the uoythesis class, or remove the loading of this package
} % make error
}{ } % silently pass
%%% ==== Fonts
\usepackage[utf8]{inputenc} % Allow unicode input
@@ -118,3 +125,5 @@
%%%% ==== DEBUG
% If you want the version of the packages you use appear when they load in the log file, uncomment the following line:
\listfiles
\endinput

229
York-Thesis/uoythesis.cls Normal file
View File

@@ -0,0 +1,229 @@
%% 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