From 5082a0135b9741f8b4fe78c6b0f6522d778f753f Mon Sep 17 00:00:00 2001
From: "jakob.stendahl" <jakob.stendahl@infomedia.dk>
Date: Wed, 3 May 2023 14:57:13 +0200
Subject: Add abstracts

---
 UiO_profile.cls | 81 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 67 insertions(+), 14 deletions(-)

(limited to 'UiO_profile.cls')

diff --git a/UiO_profile.cls b/UiO_profile.cls
index ca9dc67..0b03c90 100644
--- a/UiO_profile.cls
+++ b/UiO_profile.cls
@@ -70,25 +70,78 @@
 \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}
 
-%% Redefine \begin{abstract}...\end{abstract}
-\renewenvironment{abstract}{%
-  \ifthenelse{\equal{\uiom@base}{report}}
-    {\cleardoublepage
-     \markboth{\abstractname}{}%           
-     \vspace*{5\baselineskip}}%
-    {\bigskip}%
-  \small
-  \begin{center}%
-    {\sf\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%
-  \end{center}%
-  \quotation}%
-{\endquotation \bigskip}
 
 %% Define \begin{preface}
 \newenvironment{preface}{%
   \chapter*{\prefacename}
-    \markboth{\prefacename}{}}
+  \markboth{\prefacename}{}
+  }
   {}
 
 %% Headers and footers:
-- 
cgit v1.2.3

