-
Notifications
You must be signed in to change notification settings - Fork 0
/
hismetadata.sty
109 lines (99 loc) · 4.09 KB
/
hismetadata.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
%%
%% Copyright 2016-2018 by Thomas Fischer <thomas.fischer@his.se>
%%
%% This file has been released under the following license:
%% Creative Commons Attribution-Share Alike 4.0 Unported
%% (CC-BY-SA 4.0)
%%
%% hismetadata.sty is a package that defines commands
%% metadata like author's name, thesis title, etc
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hismetadata}[2018/06/20 University of Skovde Thesis Metadata by Thomas Fischer]
\RequirePackage{ifthen}
\RequirePackage[table,svgnames,dvipsnames]{xcolor}
\RequirePackage[unicode=true,pdfborder={0 0 0}]{hyperref}% used to set a PDF file's title and author
\newcommand{\missingparam}[1]{\colorbox{red!30}{{\normalfont\textbf{\textbackslash{}#1}\ not set}}}
\newcommand{\@year}{\missingparam{date}}
\newcommand{\@month}{\missingparam{date}}
\newcommand{\@day}{\missingparam{date}}
\renewcommand\date[3]{%
\renewcommand{\@year}{#1}%
\renewcommand{\@month}{#2}%
\renewcommand{\@day}{#3}%
}
\newcommand{\@seriesnumber}{\missingparam{seriesnumber}}
\newcommand{\seriesnumber}[1]{\renewcommand\@seriesnumber{#1}}
\newcommand{\@subtitle}{~}% subtitle cannot be empty, would give compilation errors
\newcommand{\@subtitleUC}{~}% subtitle cannot be empty, would give compilation errors
\newcommand{\subtitle}[1]{\renewcommand{\@subtitleUC}{\MakeUppercase{#1}}\renewcommand\@subtitle{#1}}
\newcommand\@subject{\missingparam{subject}}
\newcommand\subject[1]{\renewcommand\@subject{#1}}
\renewcommand{\@title}{\missingparam{title}}
\newcommand{\@titleUC}{\missingparam{title}}
\renewcommand{\title}[1]{\renewcommand{\@titleUC}{\MakeUppercase{#1}}\renewcommand{\@title}{#1}%
\hypersetup{pdftitle={#1}}%
}
%
\renewcommand{\@author}{\missingparam{author}}
\newcommand{\@authorUC}{\missingparam{author}}
\renewcommand{\author}[1]{\renewcommand{\@authorUC}{\MakeUppercase{#1}}\renewcommand{\@author}{#1}%
\hypersetup{pdfauthor={#1}}%
}
%
\newcommand{\@spokenlanguage}{\missingparam{spokenlanguage}}
\newcommand{\spokenlanguage}[1]{\renewcommand{\@spokenlanguage}{#1}}
%
\newcommand{\@opponent}{\missingparam{opponent}}
\newcommand{\opponent}[1]{\renewcommand{\@opponent}{#1}}
%
\newcommand{\@dissertationtype}{\missingparam{disserationtype}}
\newcommand{\dissertationtype}[1]{\renewcommand{\@dissertationtype}{#1}}
%
\newcommand{\@dissertationarea}{\missingparam{dissertationarea}}
\newcommand{\dissertationarea}[1]{\renewcommand{\@dissertationarea}{#1}}
%
\newcommand{\@decidedby}{}% no warning here, this value is optional
\newcommand{\decidedby}[1]{\renewcommand{\@decidedby}{#1}}
%
\newcommand{\@defensedaytimeroom}{\missingparam{defensedaytimeroom}}
\newcommand{\defensedaytimeroom}[6]{\renewcommand\@defensedaytimeroom{#1dagen den #2\ #3\ #4 kl.~#5, #6}}
%
\newcommand{\@isbn}{\missingparam{isbn}}
\newcommand{\isbn}[1]{\renewcommand{\@isbn}{#1}}
%
\newcommand{\@printshop}{\missingparam{printshop}}
\newcommand{\printshop}[1]{\renewcommand{\@printshop}{#1}}
\definecolor{specialpagebackground}{RGB}{15,191,0}% default value if nothing else is set
%% To differ between doctoral dissertations (default) and licentiates:
%% Use either
%% \publicationtype{dissertation}
%% or
%% \publicationtype{licentiate}
%% or
%% \publicationtype{thesisproposal}
%% or
%% \publicationtype{researchproposal}
\newcommand{\@publicationtype}{}
\newcommand{\publicationtype}[1]{%
% Whenever a new publication type is set, redefine special page color
\ifthenelse{\equal{#1}{licentiate}}{%
% If publication is a licentiate thesis
\definecolor{specialpagebackground}{RGB}{94,97,100}% grey
}{\ifthenelse{\equal{#1}{dissertation}}{%
% If publication is a doctoral thesis
\definecolor{specialpagebackground}{RGB}{86,34,97}% purple
}{%
% Either 'thesisproposal' or 'researchproposal'
\definecolor{specialpagebackground}{RGB}{72,45,24}% TODO settle with some color for 'thesisproposal' and 'researchproposal'
}%
}%
\renewcommand{\@publicationtype}{#1}%
%
% Update page background color for cover document
\@ifclassloaded{hiscover}{% take special action about page color if being used in 'hiscover' class
\renewcommand{\nopagecolor}{specialpagebackground}%
\newpagecolor{specialpagebackground}%
}% end of 'then' for @ifclassloaded
{}% nothing in 'else'
}