aboutsummaryrefslogtreecommitdiff
path: root/UiO_profile.cls
blob: 0b03c90c0721b12f3e580fd79dc05cac13fc8de9 (plain) (blame)
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{UiO_profile/UiO_profile}[2023/01/01 Package that tries to follow the UiO profile]

% Required packages
\RequirePackage[T1]{fontenc}
\RequirePackage{xcolor}

% Options
\DeclareOption{binding}{\def \uiop@bind {24pt}}
\DeclareOption{font=cmr}{\def \uiop@font {\RequirePackage{lmodern}
    \RequirePackage[scaled]{helvet}}}
\DeclareOption{font=garamond}{\def \uiop@font {\RequirePackage[garamond]{mathdesign}
    \RequirePackage[scaled]{helvet}}}
\DeclareOption{font=times}{\RequirePackage{txfonts}}

\def \uiop@bind {0pt}
\def \uiop@base {report}

% UiO Brand colors
% Blue
\definecolor{UiOBlue}{RGB}{67, 101, 226}
\definecolor{UiODarkBlue}{RGB}{124, 155, 206}
\definecolor{UiOLightBlue}{RGB}{223, 231, 243}
% Red
\definecolor{UiORed}{RGB}{182, 0, 0}
\definecolor{UiODarkRed}{RGB}{251, 102, 102}
\definecolor{UiOLightRed}{RGB}{253, 224, 225}
% Green
\definecolor{UiOGreen}{RGB}{182, 0, 0}
\definecolor{UiODarkGreen}{RGB}{116, 198, 165}
\definecolor{UiOLightGreen}{RGB}{197, 228, 207}

\definecolor{UiOFrontpageBackground}{RGB}{255, 255, 255}
\definecolor{UiOFrontpagePrimary}{RGB}{220, 221, 223}
\DeclareOption{red}{
  \colorlet{UiOFrontpagePrimary}{UiODarkRed}
  \colorlet{UiOFrontpageBackground}{UiOLightRed}
}
\DeclareOption{blue}{
  \colorlet{UiOFrontpagePrimary}{UiODarkBlue}
  \colorlet{UiOFrontpageBackground}{UiOLightBlue}
}
\DeclareOption{green}{
  \colorlet{UiOFrontpagePrimary}{UiODarkGreen}
  \colorlet{UiOFrontpageBackground}{UiOLightGreen}
}


\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\uiop@base}}

\ExecuteOptions{font=cmr}

\ProcessOptions\relax

\LoadClass[a4paper,11pt,twoside,openright]{report}

% Margins
\RequirePackage[vmargin=3cm,bindingoffset=\uiop@bind]{geometry}

% Adjustements
\pretolerance = 3000
\tolerance = 6000   \hbadness = \tolerance
\setlength{\parskip}{0cm plus 1mm}

% Font
\uiop@font
\renewcommand*\familydefault{\sfdefault} 

% Other required packages for frontpage and stuff
\RequirePackage{titling}

%% Chapter and section headers:
%% (mainly to use \sf for these):
\RequirePackage{titlesec}
\titleformat{\part}[display]
  {\centering\sf\bfseries\Huge}{%
    \partname~\thepart}{15pt}{\Huge\sf\bfseries}
\titleformat{\chapter}[display]
  {\sf\huge\bfseries}{\chaptertitlename\ \thechapter}{15pt}{\Huge\sf\bfseries}
\titlespacing*{\chapter} {0pt}{50pt}{40pt}
\titleformat{\section}
  {\sf\Large\bfseries}{\thesection}{1em}{}
\titlespacing*{\section} {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titleformat{\subsection}
  {\sf\large\bfseries}{\thesubsection}{1em}{}
\titlespacing*{\subsection} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titleformat{\subsubsection}
  {\sf\normalsize\bfseries}{\thesubsubsection}{1em}{}
\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titleformat{\paragraph}[runin]
  {\sf\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titleformat{\subparagraph}[runin]
  {\sf\normalsize\bfseries}{\thesubparagraph}{1em}{}
\titlespacing*{\subparagraph} {\parindent}{3.25ex plus 1ex minus .2ex}{1em}

%% Redefine the table of contents and lists of figures and tables:
\RequirePackage{titletoc}
\contentsmargin{0.9cm}
\titlecontents{part}[0.0em]{\addvspace{2.25em plus 1pt}\large\sf\bfseries}{}{}
  {\hfill\contentspage}
\titlecontents{chapter}[2.5em]{\sf}{\contentslabel{2.5em}}{\hspace*{-2.5em}}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{section}[5.5em]{\sf}{\contentslabel{3.0em}}{\hspace*{-3.0em}}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}[9.0em]{\sf}{\contentslabel{3.5em}}{\hspace*{-3.5em}}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsubsection}[13.0em]{\sf}{\contentslabel{4.0em}}{\hspace*{-4.0em}}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{figure}[3.0em]{\sf}{\contentslabel{3.0em}}{\hspace*{-3.0em}}
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{table}[3.0em]{\sf}{\contentslabel{3.0em}}{\hspace*{-3.0em}}
  {\titlerule*[1pc]{.}\contentspage}

%% Redefine \begin{abstract}...\end{abstract} and
%% define \begin{xabstract}[heading] ... \end{xabstract}
% First, we need a modified quotation environment
% with no indentation of the first line:
\newenvironment{uiom@noindent@quotation}
  {\list{}{%
     \listparindent = 1.5em\relax
     \rightmargin = \leftmargin
     \parsep \z@ \@plus\p@}%
     \item\relax}
  {\endlist}
% Then, we need an environment for formatting the abstract:
\newenvironment{uiom@abstract}[1][\abstractname]
  {\begin{center}\small\textsf{\textbf{#1}}\end{center}\uiom@noindent@quotation}
  {\enduiom@noindent@quotation}             
\renewenvironment{abstract}[1][\abstractname]
  {\cleardoublepage \pagestyle{empty}\vspace*{5\baselineskip}
    \uiom@abstract[#1]}
  {\enduiom@abstract}
% We also define an environment for a second abstract:
\newenvironment{xabstract}[1][\abstractname]
  {\par\vspace{3\baselineskip}\uiom@abstract[#1]}
  {\enduiom@abstract}


%% Define \begin{preface}
\newenvironment{preface}{%
  \chapter*{\prefacename}
  \markboth{\prefacename}{}
  }
  {}

%% Headers and footers:
\RequirePackage{fancyhdr}
\fancyhead{}
\setlength{\headheight}{15pt}
\fancyhead[LE]{\textsf{\small \nouppercase{\leftmark}}}
\fancyhead[RO]{\textsf{\small \nouppercase{\rightmark}}}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}
\fancyfoot[LE,RO]{\textsf{\thepage}}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}
\fancypagestyle{plain}{\fancyhead{}}

%% Figurer og tabeller
\RequirePackage[labelfont=sf,font=small]{caption}

%% Document parts:
\newcommand{\frontmatter}{\cleardoublepage \pagenumbering{roman}}
\newcommand{\mainmatter}{\cleardoublepage \pagenumbering{arabic}}
\newcommand{\backmatter}{\cleardoublepage}

\providecommand{\preface}{\chapter*{}\markboth{}{}}
\providecommand{\endpreface}{}

\endinput