Many changes and adding examples
- Fix use of sizes (maybe set exception for 13pt?) - Prepare keys for margins - Show example of bibfile modification on the go - Show how to use `\xkvview` to check defined keys
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
% https://git.tigrau.ovh/Ambroise/LaTeX-Templates/.
|
||||
|
||||
|
||||
% Comments starting with FORMAT highlight requirements from the UoY thesis
|
||||
% regulations, as of November 2023.
|
||||
% Comments starting with `FORMAT` highlight requirements from the
|
||||
% University of York thesis regulations, as of November 2023.
|
||||
% See https://www.york.ac.uk/research/graduate-school/academic/thesis/format/#tab-2
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
@@ -29,73 +29,134 @@
|
||||
|
||||
\providecommand{\is@uoyth@classloaded}{true}
|
||||
\RequirePackage{xkeyval}
|
||||
\RequirePackage{etoolbox}
|
||||
\RequirePackage{xstring}
|
||||
|
||||
% To be able to check which keys are set
|
||||
\RequirePackage{xkvview}
|
||||
\let\tablename=\undefined % reset this which is defined in memoir
|
||||
|
||||
%%% Set class options
|
||||
\newcommand{\uoyth@tmp@classoptionslist}{}
|
||||
\newcommand{\AddToClassOptionList}[1]{\csappto{uoyth@tmp@classoptionslist}{, #1}}
|
||||
%\newcommand{\changeoptions}[1]{\cspreto{@classoptionslist}{#1,}}
|
||||
\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}
|
||||
\ClassWarning{uoythesis}{You gave size '#1' which is too small according to the guidelines. Automatically changing to the smallest value accepted: 11pt. (Classoptions:\@classoptionslist )}
|
||||
}
|
||||
\newcommand{\uoyth@fontsize}{12pt}
|
||||
\newcommand{\uoyth@SetFontSize}[1]{
|
||||
\AddToClassOptionList{#1}
|
||||
\renewcommand{\uoyth@fontsize}{#1}
|
||||
\PassOptionsToClass{#1}{memoir}
|
||||
}
|
||||
|
||||
% options passed onto memoir: draft, final, oneside, twoside
|
||||
|
||||
\newif\ifuoyth@draft
|
||||
\uoyth@draftfalse
|
||||
\DeclareOptionX{draft}{\uoyth@drafttrue \PassOptionsToClass{draft}{memoir}}
|
||||
\DeclareOptionX{final}{\uoyth@draftfalse \PassOptionsToClass{final}{memoir}}
|
||||
\newif\ifuoyth@onesided
|
||||
\uoyth@onesidedfalse
|
||||
\PassOptionsToClass{twoside}{memoir}
|
||||
\DeclareOptionX{oneside}{\uoyth@onesidedtrue \PassOptionsToClass{oneside}{memoir}}
|
||||
\DeclareOptionX{twoside}{\uoyth@onesidedfalse \PassOptionsToClass{twoside}{memoir}}
|
||||
|
||||
% new available options: pagenbhead, pagenbfoot, noxr, nohyperref, hyperfinal, margins
|
||||
% new available options: pagenb (head or foot), noxr, nohyperref, hyperfinal, margins
|
||||
\newif\ifuoyth@pgnbhead
|
||||
\uoyth@pgnbheadtrue
|
||||
\define@choicekey*{uoythesis.cls}{pagenb}[\userval\choiceval]{head,foot}[head]{
|
||||
\define@choicekey*+{uoythesis.cls}{pagenb}[\userval\choiceval]{head,foot}[head]{
|
||||
\ifcase\choiceval\relax
|
||||
\uoyth@pgnbheadtrue
|
||||
\or
|
||||
\uoyth@pgnbheadfalse
|
||||
\fi
|
||||
}
|
||||
}{
|
||||
\ClassWarning{uoythesis}{The \texttt{pagenb} option must be set to either `head' or `foot', but you gave `#1'}
|
||||
}
|
||||
\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}}
|
||||
\define@boolkey+{uoythesis.cls}[uoyth@]{hyperfinal}[true]{}{\RaiseBooleanValueWarning{hyperfinal}}
|
||||
\ExecuteOptionsX{hyperfinal}
|
||||
\DeclareOptionX{hyperoptions}{
|
||||
\ClassInfo{uoythesis.cls}{Passing options '#1' to package hyperref}
|
||||
\ClassInfo{uoythesis}{Passing options '#1' to package hyperref}
|
||||
\PassOptionsToPackage{#1}{hyperref}
|
||||
}
|
||||
%\ExecuteOptionsX{hyperoptions={}}
|
||||
\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}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{spine}{}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{foredge}{}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{hratio}{}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{top}{}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{bottom}{}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{vratio}{}
|
||||
\define@cmdkey{uoythesis.cls}[uoyth@]{margins}{\setkeys{uoythesis.cls}{#1}}
|
||||
|
||||
\newcommand{\showmargins}{
|
||||
all margins=\key@ifundefined{uoythesis.cls}{margins}{undef}{`\uoyth@margins '};
|
||||
spine=\key@ifundefined{uoythesis.cls}{spine}{undef}{`\uoyth@spine '};
|
||||
foredge=\key@ifundefined{uoythesis.cls}{foredge}{undef}{\@ifundefined{uoyth@foredge}{unset}{`\uoyth@foredge'}}
|
||||
}
|
||||
\DeclareOptionX{8pt}{\uoyth@setsmallfontsize \RaiseFontSizeValueWarning{\CurrentOption}}
|
||||
\DeclareOptionX{9pt}{\uoyth@setsmallfontsize \RaiseFontSizeValueWarning{\CurrentOption}}
|
||||
\DeclareOptionX{10pt}{\uoyth@setsmallfontsize \RaiseFontSizeValueWarning{\CurrentOption}}
|
||||
|
||||
\newcommand{\uoythsetup}[1]{\setkeys{uoythesis.cls}{#1}}
|
||||
% FORMAT: Font size must be at least 11pt, so we disable small values
|
||||
%\DeclareOptionX{8pt}{
|
||||
% \RaiseFontSizeValueWarning{\CurrentOption}
|
||||
% \changeoptions{11pt}
|
||||
% \ChangeSizeToSmallest
|
||||
% \ClassWarning{uoythesis}{Options passed are KV:\XKV@classoptionslist; and normal:\@classoptionslist}
|
||||
%}
|
||||
%\DeclareOptionX{9pt}{
|
||||
% \RaiseFontSizeValueWarning{\CurrentOption} \ChangeSizeToSmallest
|
||||
%}
|
||||
%\DeclareOptionX{10pt}{
|
||||
% \RaiseFontSizeValueWarning{\CurrentOption} \ChangeSizeToSmallest
|
||||
%}
|
||||
%\DeclareOptionX{13pt}{
|
||||
% \ClassInfo{uoythesis}{Font size 13pt not available, downsizing to 12pt}
|
||||
% \uoyth@SetFontSize{12pt}
|
||||
%}
|
||||
|
||||
% Pass all remaining unknown options to memoir to deal with them
|
||||
\DeclareOptionX*{%
|
||||
\PassOptionsToClass{\CurrentOption}{memoir}
|
||||
\IfEndWith{\CurrentOption}{pt}{ % this is possibly a font size
|
||||
\StrGobbleRight{\CurrentOption}{2}[\val]
|
||||
\IfInteger{\val}{ % as a font size verifies if at least 11
|
||||
\ifnum\val<12 % if too small, set to 11 and raise warning
|
||||
\RaiseFontSizeValueWarning{\CurrentOption}
|
||||
\uoyth@SetFontSize{11pt}
|
||||
\else
|
||||
\uoyth@SetFontSize{\CurrentOption}
|
||||
\fi
|
||||
}{
|
||||
\PassOptionsToClass{\CurrentOption}{memoir}
|
||||
}
|
||||
}{
|
||||
\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}
|
||||
\ifuoyth@draft
|
||||
\AddToClassOptionList{draft}
|
||||
\else
|
||||
\AddToClassOptionList{final}
|
||||
\fi
|
||||
\ifuoyth@onesided
|
||||
\AddToClassOptionList{oneside}
|
||||
\else
|
||||
\AddToClassOptionList{twoside}
|
||||
\fi
|
||||
|
||||
\disable@keys{uoythesis.cls}{draft,oneside,8pt,9pt,10pt}
|
||||
\renewcommand{\@classoptionslist}{\uoyth@tmp@classoptionslist}
|
||||
% FORMAT: Document must be on A4 paper and avoid blank pages when starting new chapters
|
||||
\LoadClass[a4paper,openany,\uoyth@fontsize]{memoir}
|
||||
|
||||
\disable@keys{uoythesis.cls}{draft,oneside}
|
||||
|
||||
|
||||
\ifuoyth@hyperfinal
|
||||
|
||||
Reference in New Issue
Block a user