-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUppsalaExjobb.sty
329 lines (288 loc) · 8.64 KB
/
UppsalaExjobb.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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
\NeedsTeXFormat{LaTeX2e}
% \ProvidesClass{UppsalaExjobb}[2016/02/28 v0.9 Uppsala University TekNat Exjobb Thesis Theme]
\ProvidesPackage{UppsalaExjobb}
\def\fileversion{1.2}
\def\filedate{2016-05-16}
\def\docdate{2016-05-16}
\typeout{Using UppsalaExjobb style, version \fileversion, dated \filedate}
%\ProcessOptions\relax
%\LoadClass{book}
% Causes the options of this class to be passed to the book class
% Needed to change the text font and other behaviours.
%\LoadClassWithOptions{report}
\DeclareFontShape{OT1}{cmr}{bx}{sc}{<-> cmbcsc10}{}
% -------------------------------------------------------------------------------------
\RequirePackage{graphicx} %needed for covers
\RequirePackage{color}
\RequirePackage{xcolor}
\RequirePackage[english,swedish]{babel}
\RequirePackage[a4paper]{geometry}
\usepackage{times,helvet}
% line breaks also at hypens in URLs.
\RequirePackage[hyphens]{url}
\RequirePackage[hidelinks]{hyperref}
\urlstyle{same}
\RequirePackage{float}
\floatstyle{ruled}
%\floatstyle{boxed}
\restylefloat{figure}
\restylefloat{table}
% but patch it to put the caption below instead of at top
\renewcommand\fs@ruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled
\def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}%
\def\@fs@post{\kern2pt\hrule\relax}%
\def\@fs@mid{\kern2pt\hrule\kern2pt}%
\let\@fs@iftopcapt\iffalse}
%\RequirePackage{a4wide}
%%%%%%%%%%%%%%%%
%% compatibility with IEEEtran
\def\bstctlcite{\@ifnextchar[{\@bstctlcite}{\@bstctlcite[@auxout]}}
\def\@bstctlcite[#1]#2{\@bsphack
\@for\@citeb:=#2\do{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\if@filesw\immediate\write\csname #1\endcsname{\string\citation{\@citeb}}\fi}%
\@esphack}
%%%%%%%%%%%%%%%%%
%%%%% Parameters
\let\@seriesname\@empty %Exjobb 30 hp, Sj.arb, etc
\let\@seriesnumber\@empty % nummer i serien
\let\@progname\@empty %Program
\let\@prognameeng\@empty % program på engelska
\let\@handledare\@empty %Handledare
\let\@exthandledare\@empty %Extern handledare
\let\@reviewer\@empty %Ämnesgranskare
\let\@examinator\@empty %Examinator
\let\@issn\@empty %if there is one
\let\@printer\@empty %if there is one
\let\@logo\@empty %don't usually touch these, filenames for logo
\let\@logosv\@empty
\let\@logosvback\@empty
\let\@logogr\@empty
% The commands to set the parameters
\newcommand{\enhetsnamn}[1]{\gdef\@enhetsnamn{#1}}
\newcommand{\avdelningsnamn}[1]{\gdef\@avdelningsnamn{#1}}
\newcommand{\besoksadress}[1]{\gdef\@besoksadress{#1}}
\newcommand{\postadress}[1]{\gdef\@postadress{#1}}
\newcommand{\telefon}[1]{\gdef\@telefon{#1}}
\newcommand{\telefax}[1]{\gdef\@telefax{#1}}
\newcommand{\hemsida}[1]{\gdef\@hemsida{#1}}
\newcommand{\seriesname}[1]{\def\@seriesname{#1}}
\newcommand{\seriesnumber}[1]{\def\@seriesnumber{#1}}
\newcommand{\progname}[2]{\def\@progname{#1}\def\@prognameeng{#2}}
\newcommand{\handledare}[1]{\def\@handledare{#1}}
\newcommand{\exthandledare}[1]{\def\@exthandledare{#1}}
\newcommand{\reviewer}[1]{\def\@reviewer{#1}}
\newcommand{\examinator}[1]{\def\@examinator{#1}}
\newcommand{\printer}[1]{\def\@printer{#1}}
\newcommand{\issn}[1]{\def\@issn{#1}}
\newcommand{\subtitle}[1]{\def\@subtitle{#1}}\subtitle{}
% This is old remains, don't use or change stuff here!
\newcommand{\logo}[1]{\def\@logoname{#1}}\logo{./logo_name.pdf}
\newcommand{\logosv}[1]{\def\@logonamesv{#1}}\logosv{./logo_name_sv.pdf}
\newcommand{\logogr}[1]{\def\@logonamegr{#1}}\logogr{./logo_grey.pdf}
\def\@logo{\includegraphics[width=30mm]{\@logoname}}
\def\@logogr{\includegraphics[width=170mm]{\@logonamegr}}
\def\@logosv{\includegraphics[width=40mm]{\@logonamesv}}
\def\@logosvback{\includegraphics[width=30mm]{\@logonamesv}}
% Set empty defaults
\enhetsnamn{}
\avdelningsnamn{}
\besoksadress{}
\postadress{}
\telefon{}
\telefax{}
\hemsida{}
% För vanliga exjobb:
% \enhetsnamn{Teknisk-naturvetenskaplig fakultet}
% \avdelningsnamn{Enheten för studentservice}
% \besoksadress{Ångströmslaboratoriet\\ Lägerhyddsvägen 1\\ Hus 1, plan 1}
% \postadress{Box 536\\ 751 21 Uppsala}
% \telefon{018--471~30~03}
% \hemsida{http://www.teknat.uu.se/student}
%%%%%%%%%%%%%%%%
% -------------------------------------------------------------------------------------
% C H A P T E R H E A D I N G AND P A G E S T Y L E
%
\newcommand\frontmatter{ %@@@@
\pagenumbering{roman}
\pagestyle{plain}
}
\newcommand\mainmatter{ %@@@@
\pagenumbering{arabic}
\pagestyle{fancy}
% The lines below are needed so that the empty pages after the frontmatter are completely empty.
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{\clearpage{\pagestyle{empty}\origdoublepage}}
\let\cleardoublepage\clearemptydoublepage
}
\RequirePackage{fancyhdr}
\renewcommand{\headrulewidth}{0.3pt}
\if@twoside
\fancyhead[LO]{\nouppercase{\textsl{\rightmark}}}
\fancyhead[RE]{\nouppercase{\textsl{\leftmark}}}
\fancyhead[LE,RO]{\thepage}
\fancyfoot{}
\else
\lhead{} \chead{}
\rhead{\nouppercase{\textsl{\leftmark}}}
\lfoot{} \rfoot{}
\cfoot{\thepage}
\fi
%%%% make all section headers sans-serif
\RequirePackage{sectsty}
\allsectionsfont{\sffamily}
\setlength{\headheight}{14.5pt}
\def\@timesfont #1#2{\fontfamily{ptm}\fontsize{#1}{#2pt}\selectfont}
\def\@helvfont #1#2{\fontfamily{phv}\fontsize{#1}{#2pt}\selectfont}
%%%%%%%%% NEW ENVS
%%%%%%% ABSTRACT
\renewenvironment{abstract}
{
\parindent 5mm
\parskip 0mm
\begin{picture}(0,0)(24,250)
\put(6,240){\includegraphics[width=30mm]{\@logonamesv}}
\put(0,230){\parbox[t]{5.5cm}{\raggedright\@helvfont{8}{11} %
\parskip=\baselineskip
\textbf{\@enhetsnamn}
%
\ifx\@avdelningsnamn\@empty
\else\newline\@avdelningsnamn\fi
\ifx\@besoksadress\@empty
\else Bes{\"o}ksadress:\newline
\@besoksadress
\fi
\ifx\@postadress\@empty
\else Postadress:\newline
\@postadress
\fi
\ifx\@telefon\@empty
\else
Telefon:\newline
\@telefon\newline
\fi
%
\ifx\@telefax\@empty
\else
Telefax:\newline
\@telefax\newline
\fi
\ifx\@hemsida\@empty
\else
Hemsida:\newline
\@hemsida
\fi
}}
\end{picture}
\thispagestyle{empty}
\hspace{3cm}\begin{minipage}[t]{11cm}
\begin{otherlanguage}{english}
\noindent
{\@helvfont{12}{13}{\abstractname}}\\
\vspace{0.2cm}
\noindent
{\@helvfont{14}{16}\textbf{\@title}}\\[0.3em]
{\@helvfont{12}{15}\@subtitle}
\vspace{0.2cm}
\hrule
\vspace{0.3cm}
\noindent
{\@helvfont{12}{15}\textit{\@author}}
\vspace{2em}
\small
% \begin{quote}
}
{%
% \end{quote}
\end{otherlanguage}
\end{minipage}
\vfill
{\@timesfont{11}{13}
\noindent
\ifx\@exthandledare\@empty\else
Extern handledare: \@exthandledare\\
\fi
\ifx\@handledare\@empty\else
Handledare: \@handledare\\
\fi
\ifx\@reviewer\@empty\else
{\"A}mnesgranskare: \@reviewer\\
\fi
\ifx\@examinator\@empty\else
Examinator: \@examinator\\
\fi
\ifx\@issn\@empty\else
\@issn,
\fi
\@seriesnumber\\
\ifx\@printer\@empty\else
Tryckt av: \@printer
\fi
}
%\setlength{\oddsidemargin}{\@tmpoddsidemarg}
\normalsize
\cleardoublepage
}
%%%%%%% SAMMANFATTNING
\newenvironment{sammanfattning}
{
% HACK THIS
\thispagestyle{plain}
% \begin{minipage}[t]{13cm}
\begin{otherlanguage}{swedish}
\section*{\abstractname}
\vspace{0.5cm}
%\begin{quote}
}
{%
%\end{quote}
\end{otherlanguage}
% \end{minipage}
\cleardoublepage
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% F R O N T P A G E %%%%%%%%%%%%%
\def\@firstTitle{
\newgeometry{ignoreall,noheadfoot,nomarginpar,margin=0mm}
\setlength{\unitlength}{1mm}
\thispagestyle{empty}
\pagenumbering{gobble}
\begin{picture}(0,0)(-9,295) %(24,250) %oneside: 33,250
\put(-15,3){\colorbox{gray!30}{\rule{0cm}{\paperheight}\hspace{4cm}}}
\put(-7,250){\includegraphics[width=30mm]{\@logoname}}
\put(40,263){\parbox[tr]{14cm}{\raggedleft\@helvfont{10}{14} %
\ifx\@seriesnumber\@empty\else
\@seriesnumber\linebreak
\fi
\@helvfont{14}{16}\@seriesname\linebreak\@date}}
\put(40,182){\parbox[bl]{14cm}{\raggedright\@helvfont{25}{30}\@title\vskip 2mm\@helvfont{18}{22}{\@subtitle}}}
\put(40,158){\makebox(0,0)[tl]{\line(1,0){140}}}
\put(40,150){\parbox[t]{10cm}{\@helvfont{18}{22}%\begin{tabular}[t]{@{}l@{}}
\@author
%\end{tabular}
}}
\ifx\@progname\@empty\else
\put(40,22){\parbox[br]{14cm}{\raggedleft\@helvfont{14}{16}\@progname}}
\put(40,19){\makebox(0,0)[tl]{\line(1,0){140}}}
\put(40,14){\parbox[br]{14cm}{\raggedleft\@helvfont{13}{16}\textsl{\@prognameeng}}}
\fi
\end{picture}
\null\vfill
\restoregeometry
}
\AtBeginDocument{% This is needed so that \maketitle works
\renewcommand\maketitle{
\@firstTitle
% \null\vfill
\cleardoublepage
}
}
% -------------------------------------------------------------------------------------
% F O N T S E L E C T I O N
%%% Check if the document is built with xelatex and load the Times new roman font
\RequirePackage{ifxetex}
\ifxetex
\RequirePackage{fontspec}
\setmainfont{Times New Roman}
\fi
\endinput