-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathUSN-base.cls
142 lines (129 loc) · 4.7 KB
/
USN-base.cls
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LaTeX-class for writing theses %%
%% %%
%% (c) Dietmar Winkler (me.dwe.no) %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---Identification----
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{USN-base}[2020/05/14 Template base class for reports and theses]
% --- definitions of options ---
% norsk option:
\newif\if@norsk
\@norskfalse
\DeclareOption{norsk}{\@norsktrue}
% nosummary option:
\newif\if@summary
\@summarytrue
\DeclareOption{nosummary}{\@summaryfalse}
% All other options are passed on to the book class
\DeclareOption*{%
\typeout{Option \CurrentOption\space is passed to package scrbook!}
\PassOptionsToClass{\CurrentOption}{scrbook}
}%
% --- execution of options ---
\ProcessOptions* % process the options in calling order
\LoadClass[12pt, openright]{scrbook}
\KOMAoptions{%
cleardoublepage=plain,
parskip=half,
numbers=noendperiod,
appendixprefix=true
}
% --- package loading ---
\RequirePackage{scrlayer-scrpage} %% needed for the footer setup
\RequirePackage{geometry} %% manual set the page size
\geometry{margin=25mm, includeheadfoot}
\RequirePackage[\if@norsk norsk \else british\fi]{babel} %% adapt to NO or EN
\RequirePackage{amsmath,mathptmx} %% we need lots of math features
\RequirePackage{ifthen} %% provides simple if-then functionality
\RequirePackage{url} %% helps displaying URLs
\RequirePackage{longtable} %% for long tables that might break over pages
\RequirePackage{graphicx} %% needed for inclusion of graphics
\graphicspath{{fig/}} %% this is were the images reside
\RequirePackage[hidelinks]{hyperref} %% generate links in the PDF (but no boxes around them)
%% Adjust the formatting for refrences if autoref is used.
\AtBeginDocument{\def\equationautorefname~#1\null{Equation~(#1)\null}}
\AtBeginDocument{\def\chapterautorefname~#1\null{Chapter~#1\null}}
\AtBeginDocument{\def\sectionautorefname~#1\null{Section~#1\null}}
\RequirePackage{pdfpages} %% for inclusion of PDF documents
\RequirePackage{framed} %% provides framebox
\RequirePackage[super]{nth} %% Generate English ordinal numbers
\RequirePackage{lastpage} %% to calculate the number of pages
\RequirePackage{fontspec} %% needed to set up custom fonts and lmodern fonts
\RequirePackage{carlito} %% Carlito is the metric-compatible free alternative
%% to Calibri font
\RequirePackage{csquotes}
% --- set figure and table captions to footnotesize
\setkomafont{caption}{\footnotesize}
% --- set the fonts of all toc entries to san-serif
% from https://tex.stackexchange.com/questions/360135/koma-change-font-of-toc-section-entries
\newcommand*\tocentryformat[1]{{\sffamily#1}}
\RedeclareSectionCommands
[
tocentryformat=\tocentryformat,
tocpagenumberformat=\tocentryformat
]
{section,subsection,subsubsection,paragraph,subparagraph}
% --- useful commands
\newcommand*{\figref}[1]{\figurename~\ref{#1}}
\newcommand*{\tabref}[1]{\tablename~\ref{#1}}
% --- title page setup
\newcommand{\USNlogo}{% %% lang dependent logo
\if@norsk%
\includegraphics[height=15mm]{USN_logo}%
\else%
\includegraphics[height=15mm]{USN_logo_en}%
\fi%
}
\newcommand{\USNtitlehead}{% %% define the USN title head
\begin{minipage}[c]{.5\textwidth}%
\USNlogo%
\end{minipage}%
\begin{minipage}[c]{.5\textwidth}%
\begin{flushright}
{\sffamily\large\href{http://www.usn.no}{www.usn.no}}
\end{flushright}
\end{minipage}%
}
\titlehead{\USNtitlehead}
\publishers{\textsf{%
\if@norsk%
{\Large Fakultet for teknologi, naturvitenskap og maritime fag}
\else%
{\Large Faculty of Technology, Natural Sciences and Maritime Sciences}
\fi%
\\{\large Campus Porsgrunn}}
}%
%--- special footer setup
% norsk:
\newpagestyle{sammendrag}
{}%header
{%footer
{}%left page two-side
{%right page two-side
\begin{center}
Universitetet i Sørøst-Norge tar ikke ansvar for denne studentrapportens resultater og konklusjoner.
\end{center}
}%
{%all pages one-side
\begin{center}
Universitetet i Sørøst-Norge tar ikke ansvar for denne studentrapportens resultater og konklusjoner.
\end{center}
}%
}%
% english:
\newpagestyle{summary}
{}%header
{%footer
{}%left page two-side
{%right page two-side
\begin{center}
The University of South-Eastern Norway accepts no responsibility for the results and conclusions presented in this report.
\end{center}
}%
{%all pages one-side
\begin{center}
The University of South-Eastern Norway accepts no responsibility for the results and conclusions presented in this report.
\end{center}
}%
}%