-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathku-frontpage.sty
executable file
·259 lines (230 loc) · 12.7 KB
/
ku-frontpage.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
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
% ku-frontpage.sty
%------------------------------------------------------------------------------
% Copyright (c) 2021 by M.O.Larsen.
% Copyright (c) 2021 Malte Leip <[email protected]>
%
% Distributed under the terms of the MIT License:
% -----------------------------------------------------------------------------
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
% SOFTWARE.
% -----------------------------------------------------------------------------
%
%
% LaTeX style for front pages adhering to University of Copenhagen's design
% guide (http://designguide.ku.dk/) for SCIENCE, SUND, and SAMF faculty, and
% main KU-style.
%
% Original author:
% Mads Ohm Larsen <[email protected]>
%
% Inspired by Christian Aastrups package 'ku-forside' from 2007
% (http://www.math.ku.dk/~m00cha/), however translated all call to their
% English equivalant and included newer logos.
%
% Layout inspired by Joshua Hunt's PhD thesis.
%------------------------------------------------------------------------------
\ProvidesPackage{ku-frontpage}[2021/11/04 v1.1 Frontpages with University of Copenhagen logos]
%%% Define 'if''s for language.
\newif\if@kuenglish \DeclareOption{english}{\@kuenglishtrue}
\newif\if@kudanish \DeclareOption{danish}{\@kudanishtrue}
%%% Define 'if''s for faculties.
\newif\if@science \DeclareOption{science}{\@sciencetrue}
\newif\if@sund \DeclareOption{sund}{\@sundtrue}
\newif\if@samf \DeclareOption{samf}{\@samftrue}
\newif\if@ku \DeclareOption{ku}{\@kutrue}
%%% Define 'if' for submission statement as required by PhD regulations.
\newif\if@submissionstatement\@submissionstatementfalse
\DeclareOption{submissionstatement}{\@submissionstatementtrue}
%%% Define 'if''s for other things.
\newif\if@hyperref \DeclareOption{hyperref}{\@hyperreftrue}
\newif\if@dropcaps \DeclareOption{dropcaps}{\@dropcapstrue}
%%% Warning about unknown options
\DeclareOption*{
\ClassWarning{ku-frontpage}{Unknown option '\CurrentOption'}
}
%%% Define standard values.
\ExecuteOptions{english}
\ExecuteOptions{science}
%%% No more options.
\ProcessOptions\relax
%%% Parse options.
\if@kuenglish \def\KULANG{english} \fi
\if@kudanish \def\KULANG{danish} \fi
\if@science \def\KUFACULTY{science} \fi
\if@sund \def\KUFACULTY{sund} \fi
\if@samf \def\KUFACULTY{samf} \fi
\if@ku \def\KUFACULTY{ku} \fi
%%% Some packages are required for this package.
% Absolutely positioned graphics - LPPL 1.2
\RequirePackage{eso-pic}
% Absolutely positioned text - LPPL 1.3
\RequirePackage[absolute]{textpos}
% Graphics stuff, defining colors, etc. - LPPL 1.3c
\RequirePackage{graphicx}
% For \ifthenelse - LPPL 1.3c
\RequirePackage{ifthen}
% For patching commands - LPPL 1.3
\RequirePackage{xpatch}
% For \ifdefstring - LPPL 1.3c
\RequirePackage{etoolbox}
%%% Define colors
\definecolor{KU}{HTML}{901A1E}
\definecolor{KUscience}{HTML}{46743C}
\definecolor{KUsund}{HTML}{2A216A}
%%% Since 2020 the red KU-logo and color should be used rather than
%%% faculty logos and colors.
\def\KUCOLOR{KU}
%%% Define the page to have 12 horizontal modules and 24 vertical modules.
\TPGrid{12}{24}
%%% Define custom methods for frontpage.
\def\KU@ASSIGNMENT{Use \texttt{$\backslash$assignment$\lbrace \ldots \rbrace$}}
\def\KU@AUTHOR{Use \texttt{$\backslash$author$\lbrace \ldots \rbrace$}}
\def\KU@TITLE{Use \texttt{$\backslash$title$\lbrace \ldots \rbrace$}}
\def\KU@SUBTITLE{Use \texttt{$\backslash$subtitle$\lbrace \ldots \rbrace$}}
\def\KU@ADVISOR{Use \texttt{$\backslash$advisor$\lbrace \ldots \rbrace$}}
\def\KU@DATE{Use \texttt{$\backslash$date$\lbrace \ldots \rbrace$}}
\def\KU@FRONTPAGEIMAGE{}
%%% Construct the correct submission statement.
\if@submissionstatement
\def\KU@SUBMISSIONSTATEMENT{
Use \texttt{$\backslash$submissionstatement$\lbrace \ldots \rbrace$}
}
\ifdefstring{\KUFACULTY}{science}
{
% See https://www.science.ku.dk/phd/rules/
% Section 5.1 of the rules, under "Formal requirements to the PhD thesis"
\def\KU@SUBMISSIONSTATEMENT{%
This thesis has been submitted to
the PhD School of The Faculty of Science, University of Copenhagen%
}
}{}
\ifdefstring{\KUFACULTY}{sund}
{
% See https://healthsciences.ku.dk/phd/guidelines/
% Section 5.1 of the rules, under "Specific requirements"
\def\KU@SUBMISSIONSTATEMENT{%
This thesis has been submitted to the Graduate School
of the Faculty of Health and Medical Sciences,\\ University of Copenhagen%
}
}{}
\else
\def\KU@SUBMISSIONSTATEMENT{}
\fi
%%% Make sure the commands we want to patch exist.
%%% For example, some classes (like scrbook) define \subtitle, others do not.
\providecommand{\author}[1]{}
\providecommand{\title}[1]{}
\providecommand{\date}[1]{}
\providecommand{\assignment}[1]{}
\providecommand{\subtitle}[1]{}
\providecommand{\advisor}[1]{}
\providecommand{\frontpageimage}[1]{}
\providecommand{\submissionstatement}[1]{}
%%% Patch commands
\xpretocmd{\author}{\def\KU@AUTHOR{#1}}{}{\PackageWarning{ku-frontpage}{Tried to patch the 'author' command, but failed. Instead you will have to use the 'frontpageauthor' command to set the author for the frontpage, and the 'author' command to set the author for the rest of the document. See the readme for more information.}{} \newcommand{\frontpageauthor}[1]{\def\KU@AUTHOR{#1}} \def\KU@AUTHOR{Use \texttt{$\backslash$frontpageauthor$\lbrace \ldots \rbrace$}} }
\xpretocmd{\title}{\def\KU@TITLE{#1}}{}{\PackageWarning{ku-frontpage}{Tried to patch the 'title' command, but failed. Instead you will have to use the 'frontpagetitle' command to set the title for the frontpage, and the 'title' command to set the title for the rest of the document. See the readme for more information.}{} \newcommand{\frontpagetitle}[1]{\def\KU@TITLE{#1}} \def\KU@TITLE{Use \texttt{$\backslash$frontpagetitle$\lbrace \ldots \rbrace$}} }
\xpretocmd{\date}{\def\KU@DATE{#1}}{}{\PackageWarning{ku-frontpage}{Tried to patch the 'date' command, but failed. Instead you will have to use the 'frontpagedate' command to set the date for the frontpage, and the 'date' command to set the date for the rest of the document. See the readme for more information.}{} \newcommand{\frontpagedate}[1]{\def\KU@DATE{#1}} \def\KU@DATE{Use \texttt{$\backslash$frontpagedate$\lbrace \ldots \rbrace$}} }
\xpretocmd{\subtitle}{\def\KU@SUBTITLE{#1}}{}{\PackageWarning{ku-frontpage}{Tried to patch the 'subtitle' command, but failed. Instead you will have to use the 'frontpagesubtitle' command to set the title for the frontpage, and the 'subtitle' command to set the subtitle for the rest of the document. See the readme for more information.}{} \newcommand{\frontpagesubtitle}[1]{\def\KU@SUBTITLE{#1}} \def\KU@SUBTITLE{Use \texttt{$\backslash$frontpagesubtitle$\lbrace \ldots \rbrace$}} }
\xpretocmd{\assignment}{\def\KU@ASSIGNMENT{#1}}{}{\PackageError{ku-frontpage}{Tried to patch assignment command, but failed.}{}}
\xpretocmd{\advisor}{\def\KU@ADVISOR{#1}}{}{\PackageError{ku-frontpage}{Tried to patch advisor command, but failed.}{}}
\xpretocmd{\frontpageimage}{\def\KU@FRONTPAGEIMAGE{#1}}{}{\PackageError{ku-frontpage}{Tried to patch frontpageimage command, but failed.}{}}
\xpretocmd{\submissionstatement}{\def\KU@SUBMISSIONSTATEMENT{#1}}{}{\PackageError{ku-frontpage}{Tried to patch submissionstatement command, but failed.}{}}
%%% Include hyperref for PDF attributes.
\if@hyperref
\RequirePackage{hyperref} % LPPL 1.3
\newcommand{\kupdfsetup}[3]{
\hypersetup{
pdftitle={#1},
pdfsubject={#2},
pdfauthor={#3},
colorlinks=true,
citecolor={\KUCOLOR},
linkcolor={\KUCOLOR},
urlcolor={\KUCOLOR},
}
}
\fi
%%% Define drop caps
\if@dropcaps
\RequirePackage{lettrine} % LPPL 1.3
\renewcommand\LettrineFontHook{\color{\KUCOLOR}}
\renewcommand{\DefaultOptionsFile}{NoFileOnPurposeHack.cfg}
\LettrineOptionsFor{A}{loversize= 0.05,lhang= 0.10,findent= 0.000\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{B}{loversize= 0.10,lhang= 0.30,findent= 0.025\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{C}{loversize= 0.00,lhang= 0.15,findent= 0.175\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{D}{loversize= 0.10,lhang= 0.30,findent=-0.025\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{E}{loversize= 0.10,lhang= 0.10,findent= 0.100\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{F}{loversize= 0.10,lhang= 0.30,findent= 0.100\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{G}{loversize=-0.08,lhang= 0.10,findent= 0.000\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{H}{loversize=-0.01,lhang= 0.00,findent= 0.040\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{I}{loversize= 0.10,lhang= 0.00,findent= 0.050\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{J}{loversize=-0.08,lhang= 0.00,findent=-0.025\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{K}{loversize=-0.05,lhang= 0.00,findent=-0.050\LettrineWidth,nindent= 0.60\LettrineWidth}
\LettrineOptionsFor{L}{loversize= 0.00,lhang= 0.00,findent= 0.100\LettrineWidth,nindent= 0.40\LettrineWidth}
\LettrineOptionsFor{M}{loversize= 0.10,lhang= 0.40,findent= 0.040\LettrineWidth,nindent= 0.10\LettrineWidth}
\LettrineOptionsFor{N}{loversize= 0.00,lhang= 0.20,findent=-0.010\LettrineWidth,nindent= 0.40\LettrineWidth}
\LettrineOptionsFor{O}{loversize= 0.10,lhang= 0.20,findent=-0.010\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{P}{loversize= 0.10,lhang= 0.30,findent= 0.050\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{Q}{loversize= 0.00,lhang= 0.20,findent= 0.050\LettrineWidth,nindent= 0.70\LettrineWidth}
\LettrineOptionsFor{R}{loversize=-0.05,lhang= 0.25,nindent= 0.500\LettrineWidth,nindent= 0.50\LettrineWidth}
\LettrineOptionsFor{S}{loversize= 0.10,lhang= 0.00,findent= 0.000\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{T}{loversize= 0.10,lhang= 0.35,findent= 0.100\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{U}{loversize= 0.10,lhang= 0.20,findent= 0.050\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{V}{loversize= 0.10,lhang= 0.40,findent= 0.050\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{W}{loversize= 0.10,lhang= 0.30,findent= 0.040\LettrineWidth,nindent= 0.50em}
\LettrineOptionsFor{X}{loversize= 0.10,lhang= 0.40,findent= 0.040\LettrineWidth,nindent= 0.20\LettrineWidth}
\LettrineOptionsFor{Y}{loversize= 0.10,lhang= 0.20,findent= 0.100\LettrineWidth,nindent= 0.20\LettrineWidth}
\LettrineOptionsFor{Z}{loversize=-0.05,lhang= 0.00,findent= 0.050\LettrineWidth,nindent= 0.55\LettrineWidth}
\fi
%%% Construct the titlepage
\def\KUbold{\fontseries{bx}\selectfont}
\def\KUsemibold{\fontseries{sb}\selectfont}
\def\maketitle{
\thispagestyle{empty}
\AddToShipoutPicture*{\put( 0, -35){\includegraphics*{logos/ku-logo}}}
\AddToShipoutPicture*{\put(-8, 8){\includegraphics*{logos/\KUFACULTY-\KULANG}}}
\ifthenelse{\equal{\KU@FRONTPAGEIMAGE}{}}{}{
\AddToShipoutPicture*{
\AtPageUpperLeft{\raisebox{-185mm}{\hspace{55pt}\includegraphics*[width=\textwidth, height=100mm, keepaspectratio]{\KU@FRONTPAGEIMAGE}}}
}
}
\begin{textblock}{10}(1.14, 15.9)
\noindent\fontsize{16pt}{18pt}\KUsemibold\KU@ASSIGNMENT
\end{textblock}
\begin{textblock}{10}(1.14, 16.9)
\noindent\fontsize{28pt}{30pt}\KUsemibold\KU@TITLE
\par\vspace{2mm}
\noindent\fontsize{14pt}{16pt}\KUsemibold\KU@SUBTITLE
\par\vspace{4mm}
\noindent\fontsize{16pt}{18pt}\KUsemibold\KU@AUTHOR
\end{textblock}
\begin{textblock}{10}(1.14, 20.5)
\begingroup
\fontsize{11pt}{12pt}\KUsemibold
\noindent\KU@ADVISOR
\par\vspace{4mm}
\noindent\KU@DATE
\endgroup
\par\vspace{4mm}
\fontsize{11pt}{12pt}
\noindent\KU@SUBMISSIONSTATEMENT
\end{textblock}
\phantom{...}
\newpage
\noindent
}