-
Notifications
You must be signed in to change notification settings - Fork 1
/
tud-title.sty
142 lines (130 loc) · 4.89 KB
/
tud-title.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
% -----------------------------------------------------------------------------
%
% Copyright (c) 2020. San Kilkis. All rights reserved.
%
% This Source Code Form is subject to the terms of the Mozilla Public
% License, v. 2.0. If a copy of the MPL was not distributed with this
% file, You can obtain one at http://mozilla.org/MPL/2.0/
%
% --- Package Documentation: --------------------------------------------------
%
% This package redefines the \maketitle macro for creating the inner titlepage.
%
% The basic usage is to define the title and subtitle using the \title and
% \subtitle macros followed by a call to the \maketitle macro:
%
% \title{An Important Topic Worth Writing About}
% \subtitle{A Very Important Report}
% \author{John Doe | 0000001, Jane Doe | 0000002}
% \course{[TU0000] A Very Futuristic and Challenging Course}
% \supervisor{Dr. Jan Jansen}
% \abstract{A summary of the document}
% \maketitle
%
% Note:
% The calls to \course and \abstract are optional. However, make sure to
% call \maketitle within a document environment i.e. after calling
% \begin{document}
%
% -----------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tudelft-light/tud-title}
\RequirePackage{geometry}
\RequirePackage{tudelft-light/tud-cover}
\RequirePackage{tudelft-light/tud-style}
\newcommand*{\@title@makeplural}[2][\relax]{%
% Makes the supplied word plural by adding an "s" suffix to it
%
% This macro is useful for adding a plural to the supervisor and author
% headings if the number of items. If the optional number of arguments is
% passed then this will be used as a condition for applying the suffix.
% The intended usage of the macro with the supplied optional argument
% is given below
%
% \makeplural[\@author@itemslen]{Author}
%
% Optional Arguments:
% 1 (number): Number of items used to conditionally make the word plural
%
% Positional Arguments:
% 2 (string): Sets the subtitle of the document (Stored in PDF subject)
%
% Returns:
% (string): The provided string with the suffix "s" applied
%
\if #1\relax
% If no optional argument is provided make it plural
#2s%
\else
% Otherwise check if it needs to be made plural
\ifnum #1<2 #2\else#2s\fi
\fi%
}
\newcommand*{\@title@printauthor}{%
% Formats and prints the author(s) supplied by the \author macro.
\large\emph{\@title@makeplural[\@author@itemslen]{Author}:} \\
\foreachitem \x \in \@author@items{
\setsepchar{{|}}%
\readlist*\splitlist{\x}
\ifnum \splitlistlen=2%
% Author [1] was supplied with a Student Number [2]
\splitlist[1] \begingroup\color{gray}{\splitlist[2]}\endgroup\\%
\else%
% No student number provided
\splitlist[1]\\%
\fi
}
}
\newcommand*{\@title@printsupervisor}{%
% Formats and prints the supervisor(s) supplied by the \supervisor macro.
\large\emph{\@title@makeplural[\@supervisor@itemslen]{Supervisor}:} \\
\foreachitem \x \in \@supervisor@items{\x\\}
}
\renewcommand*{\maketitle}{
\@titlepagetrue
% \newgeometry{margin=\tud@margin} %Change Title-Page Margin Differently
\let\thepage@old\thepage % Backup definition of \thepage
\renewcommand{\thepage}{Title \Roman{page}} % Change PDF Label to Title I
\thispagestyle{empty} % Remove page numbers and fancyheaders
\begin{titlepage}
\begin{center}
\textsc{\LARGE Delft University of Technology}\\[0.25cm]
% Optional course code and name
\ifx\@course\undefined\else%
\textsc{\normalsize\@course}\\[1.5cm]
\fi
% TU Delft Seal Logo
\includegraphics[width=0.25\textwidth]{%
tudelft-light/images/delft_seal.pdf%
}\\[1.5cm]
% Title and subtitle
{\huge \bfseries \@title} \\
\huge \@subtitle \\[1.0cm]
% Supervisor and author split minipage
\begin{minipage}[t]{0.4\textwidth}
\begin{flushleft}
\@title@printsupervisor
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.4\textwidth}
\begin{flushright}
\@title@printauthor
\end{flushright}
\end{minipage}%
\\[2.0cm]
% Creating abstract on title page if defined with \abstract
\ifx \@abstract\undefined\else
\large \textsc{Abstract}\\
\begin{minipage}[t]{0.8\textwidth}
\large\@abstract
\end{minipage}
\fi
\vfill
\small{\today}
\end{center}
\end{titlepage}
% \restoregeometry
\cleardoublepage
\renewcommand{\thepage}{\thepage@old} % Restore \thepage
\@titlepagefalse
}