summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lion-msc/lion-msc.cls
blob: a970d94d4b8ec522ff32aca51e3939290a580d7d (plain)
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
% lion-msc.cls                                                                %
%                                                                             %
% A LaTeX document class for preparing a bachelor/master thesis according to  %
% the specifications of the Leiden Institute of Physics (LION),               %
% Leiden University, The Netherlands                                          %
%                                                                             %
%  Original version written by: Michiel de Dood                               %
%                               Leiden Institute of Physics                   %
%                               Leiden University                             %
%                               Niels Bohrweg 2                               %
%                               2333 CA, Leiden, The Netherlands              %
%                                                                             %
%      Please report errors to: Michiel de Dood                               %
%                       e-mail: dood@physics.leidenuniv.nl                    %
%                    telephone: +31-(0)71.527.5929                            %
%                                                                             %
% Permission to copy all or part of this work is granted.                     %
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/06/01 or later.
%
% This work has the LPPL maintenance status "author-maintained".
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Considerations:
% 1. use the ifpdf package to make class a bit more robust?
% 2. add metadata to pdf?
% see http://www.howtotex.com/tips-tricks/adding-pdf-metadata-in-latex/
% \usepackage{ifpdf}
% \ifpdf
% \pdfinfo{
%    /Author (Author Name)
%    /Title (Adding PDF metadata in LaTeX)
%    /Keywords (PDF;LaTeX;howtoTeX.com) }
% \fi
% 4. potential problem with double line spacing option on title pages.

\typeout{}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{lion-msc}[2020/06/03 v0.30]
\typeout{}
\typeout{Leiden Institute of Physics thesis class - version 0.30}
\typeout{}
\typeout{Copyright (c) 2014-2020 Michiel de Dood}
\typeout{Please send questions, comments, additions, complaints to:}
\typeout{dood@physics.leidenuniv.nl}
\typeout{}

% The following are default options that are passed on to the documentclass

% == start : draft and final options
% Option [double] (default) - sets a double line spacing for easy commenting
% Option [single]           - single line spacing for final report

\def\mystretch{1.5}		% This is the default option, sets double line spacing
                        % if nothing is specified \mystretch is still defined
\DeclareOption{double}{}	% When [double] is specified do nothing
\DeclareOption{single}{	% This option creates the final version
    \typeout{single linespacing}
    \def\mystretch{1}}	

% Note that the linespacing is set after the \Loadclass command!
% == ** continued after \Loadclass

% A Master or Bachelor thesis is very similar to a report. The report class
% is a basic class that should be compatible with many options

\typeout{loading report class}

% Suspicious code. I cannot overule any of these values that are intended to
% be the default option. In particular the 12pt option...

\PassOptionsToClass{a4paper}{report}
\PassOptionsToClass{fleqn}{report}
\PassOptionsToClass{openright}{report}

% 14-03-2017 Michiel de Dood
% PassOptionsToClass or ExecuteOptions forces the 12 pt font size onto the
% user. This is unintended behavior, but the report class uses 10 pt font
% as a default, which is fairly small font
% http://tex.stackexchange.com/questions/40893/how-to-set-default-font-size-in-latex-cls-file

\def\@@ptsize{12pt}
\DeclareOption{10pt}{\def\@@ptsize{10pt}}
\DeclareOption{11pt}{\def\@@ptsize{11pt}}
\DeclareOption{12pt}{\def\@@ptsize{12pt}}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions\relax
\LoadClass[\@@ptsize]{report}

% == continue : draft and final options
\def\baselinestretch{\mystretch}	% This sets the line spacing
% == end : double and single options

% A number of packages are provided with the class to minimize potential
% issues with the use of commands. This is equivalent to \usepackage in the
% tex file.

% Use the natbib package to take care of citations. Place citations between
% square brackets, comma separated, and sort and combine multiple references.
% This should resemble a citation used by the APS.

% 10-01-2014 adding the numbers option to natbib seems to avoid the following:
%            'natbib error bibliography not compatible with author-year citations'
%            thanks to http://tex.stackexchange.com/questions/54480
\RequirePackage[square,comma,sort&compress,numbers]{natbib}

% 10-04-2014 added input encoding. Thanks to Merlijn van Deen
%           This allows to use non-ascii input character, e.g. � instead of \"o
% 14-03-2017 added latin9 as option to ensure compatibility with LyX for unknown
%           reasons. Thanks to Vasco Tenner
\RequirePackage[utf8,latin9]{inputenc}

% Font selection
% \RequirePackage{mathptmx}
\RequirePackage{mathpazo}   % Just to make it look less like a Word document

% Special AMS symbols for displaying math
\RequirePackage{amsmath}
\RequirePackage{amssymb}

% insertion of graphics
\RequirePackage[pdftex]{graphicx}

% styling of captions using the captions package
% 28/03/2014 removed the small (0.5cm) margin for the figure captions
% 22/05/2014 added hypcap option as suggested by Casper Remeijer
% 08/07/2013 corrected sl,small override - Tobias de Jong and David Kok
\RequirePackage[margin=0cm,font={small,sl},labelfont={bf,sl},tableposition=top,singlelinecheck=false,hypcap]{caption}

% Use US english (default) hyphenation rules and provide dutch as an option
% 14/05/2019 The USenglish as an option started generating errors.
%            changed the option to english instead hoping for more
%            stable behavior (M.J.A. de Dood)
\RequirePackage[dutch,english]{babel}

% For standard formatting of dates I use the datetime package
% It is important to load this package AFTER the babel package
\RequirePackage[us,nodayofweek]{datetime}

% The calc package allows to specify lengths etc. as an arithmetic expression
\RequirePackage{calc}

% Colored text
\RequirePackage{xcolor}
			% used to be color package, but this gives conflicts with user packages
			% reported by Casper Remeijer June 9, 2016

\definecolor{mygrey}{gray}{0.5}
\definecolor{lionblue}{RGB}{0,43,127} % The official color, thanks to Ferry Besamusca

% Consistent section styling
% \RequirePackage{sectsty}
% \allsectionsfont{\sffamily} % changed 26/03/2014 avoid mixing of fonts

% Chapter styling
\RequirePackage[Lenny]{fncychap} % consider titlesec as alternative
\ChRuleWidth{1pt}

% Enable fancy headers
\RequirePackage{fancyhdr}

% Formatting tools for the title
\RequirePackage{titling}

% 09/07/2014 Redefine the \cleardoublepage command to get completely empty pages
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}
    \thispagestyle{empty}
    \newpage
    \if@twocolumn\hbox{}\newpage\fi\fi\fi}


% == start : define several variables to be placed on the titlepage
\gdef\@studentid{\color{red}use $\backslash$\texttt{studentid\{\ldots\}} to define}
\gdef\@abstract{\color{red}Please use $\backslash$\texttt{abstract\{\ldots\}} to define an abstract in the document preamble.}
\gdef\@supervisor{\color{red}use $\backslash$\texttt{supervisor\{\ldots\}} to define}
\gdef\@corrector{\color{red}use $\backslash$\texttt{corrector\{\ldots\}} to define}
\gdef\@affiliation{\color{black}Huygens-Kamerlingh Onnes Laboratory, Leiden University}
\gdef\@address{\color{black}P.O. Box 9500, 2300 RA Leiden, The Netherlands}
\gdef\@degree{\color{black}Bachelor of Science}
\gdef\@major{\color{black}Physics}

\def\studentid#1{\gdef\@studentid{#1}}
\def\abstract#1{\gdef\@abstract{#1}}
\def\supervisor#1{\gdef\@supervisor{#1}}
\def\corrector#1{\gdef\@corrector{#1}}
\gdef\affiliation#1{\gdef\@affiliation{#1}}
\gdef\address#1{\gdef\@address{#1}}
\gdef\degree#1{\gdef\@degree{#1}}   % 22/05/2014 corrected mix-up of degree and major: Error spotted by Leandros Talman
\gdef\major#1{\gdef\@major{#1}}

\gdef\theauthor{\@author}

% Optional cover picture
\def\coverpicture#1{\gdef\@coverpicture{#1}\cover@picturetrue}
% New if construct:             Default condition:
\newif\ifcover@picture          \cover@picturefalse

% Optional dedication added 14-05-2019. Requested by Ruoyan Wang
% use \dedicate to define
\def\dedicate#1{\gdef\@dedicate{#1}\dedicationtrue}
% default option is off
\newif\ifdedication				\dedicationfalse

% == start : title page using titling package

% shift the title up a little compared to the standard definition
\setlength{\droptitle}{-4cm}

\pretitle{ % this is inserted before the title.
    \pagestyle{empty}
    \begin{center}
        \color{lionblue}
        \vskip 1em
        \includegraphics[width=2.5cm]{lion-msc-logo.pdf}
        \color{lionblue}
        \noindent\rule{\textwidth}{0.4mm}
        \vskip 0.5em
        \huge
}

\posttitle{
        \noindent\rule{\textwidth}{0.4mm}
        \vfill
        \ifcover@picture
         \@coverpicture
        \fi
        \vfill
        \vskip 1em
    \end{center}

    \begin{center}
        \begin{minipage}[b]{.75\textwidth}
            \color{black}
            \begin{center}
                \normalsize
                \textsc{Thesis} \\ \vskip 0.5em
                submitted in partial fulfillment of the \\
                requirements for the degree of \\ \vskip 0.5em
                \textsc{\@degree} \\
                in \\
                \textsc{\@major} \\ \vskip 0.5em
            \normalsize
            Author :             \hfill {\@author} \\
            Student ID :         \hfill {\@studentid} \\
            Supervisor :         \hfill {\@supervisor} \\
            Second corrector : \hfill {\@corrector}
            \par
            \vskip 1em
            Leiden, The Netherlands, \@date
            \end{center}
        \end{minipage}
    \end{center}
    \cleardoublepage
}

\preauthor{
    \thispagestyle{empty}
    \begin{center}
        \Huge \@title \\
        \vskip 1 em
        \color{black}
        \large \bf
}

\postauthor{
    \end{center}
    \begin{center}
        \normalsize \@affiliation \\ \@address
        \lineskip 0.5em
        \par
    \end{center}
}

\predate{
    \begin{center}
        \normalsize
}

% Changed the alignment of the abstract. The centering is plain ugly
% Following comments of Casper Remeijer

\postdate{
    \end{center}
    \begin{center}
            \vskip 1 em
            \color{black} \large \textbf{Abstract}
    \end{center}
    \vskip 1em
    \normalsize \@abstract
    \vfill
	\ifdedication
		 \clearpage
	     \thispagestyle{empty}
	     \vskip 3em
	     \textit{\@dedicate}
	\fi
}


% == end   : title page using titling package

% == start : pagesize commands
% note: a4 = 297x210 mm, letter = 280x216 mm

% \setlength{\textwidth}{160mm}   % used to be 160
% \setlength{\textheight}{240mm}  % used to be 240

% Now we need to set margins and headers to center the page on the paper.
% This can be done with a little help of the calc package.

% \setlength{\oddsidemargin}{(\paperwidth-\textwidth)/2-1in}
% \setlength{\evensidemargin}{(\paperwidth-\textwidth)/2-1in}

% \setlength{\topmargin}{(\paperheight-\textheight-\headheight-\headsep-\footskip)/2-1in}
% == end   : pagesize commands

% == start : Bibliography name changed to References

%% Small caps References as labels for page headers
%% added \itemsep command to adjust vertical space between references
%% IMPORTANT NOTE: The references consist of one big list with many \bibitems...
%% VERY IMPORTANT: \def\bibname should be within the thebibliography environment.
%%                 It seems to be defined elsewhere as well (BibTeX?)
%\newdimen\bibindent
%\setlength\bibindent{1.5em}
%\renewenvironment{thebibliography}[1]
%    {\def\bibname{References}
%     \chapter*{\bibname
%        \@mkboth{\textsc\bibname}{\textsc\bibname}}%
%      \list{\@biblabel{\@arabic\c@enumiv}}%
%           {\itemsep 0em
%            \settowidth\labelwidth{\@biblabel{#1}}%
%            \leftmargin\labelwidth
%            \advance\leftmargin\labelsep
%            \@openbib@code
%            \usecounter{enumiv}%
%            \let\p@enumiv\@empty
%            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
%      \sloppy
%      \clubpenalty4000
%      \@clubpenalty \clubpenalty
%      \widowpenalty4000%
%      \sfcode`\.\@m}
%     {\def\@noitemerr
%       {\@latex@warning{Empty `thebibliography' environment}}%
%      \endlist}
%% == end   : Bibliography name changed to References

% == start : appearance of footnotes
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
% == end   : appearance of footnotes

% == start : remove dots in TOC.
\renewcommand{\@dotsep}{10000} %% Default value is 4.5
% == end   : remove dots in TOC

% == start : definition of headers
% 28/03/2014 - removed font change in the headers and footers.


\pagestyle{fancy} % 10/04/2014 I moved this up into the creation of the title.
                  % 09/07/2014 and I placed it back because it doesn't work!

\renewcommand{\chaptermark}[1]{\markboth{\small \textit{#1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\small \textit{\thesection{} #1}}}

%\renewcommand{\sectionmark}[1]{}

\fancyhf{}
\fancyfoot[CE,CO]{\vskip 5mm \scriptsize{\color{mygrey}Version of \@date -- Created \today~-~\currenttime}}
\fancyfoot[RO,LE]{\thepage}
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\leftmark}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\addtolength{\headheight}{2.5pt}
\fancypagestyle{plain}{%
    \fancyhead{}
    \renewcommand{\footrulewidth}{0pt}
    \renewcommand{\headrulewidth}{0pt}
}
% == end   : definition of headers

% Make references etc. available as hyperlinks.
% 10-01-2014 [hidelinks] option with thanks to Vasco Tenner
% 11-10-2014 Move this all the way to the end so that appendices work. Thanks to Thomas Ruytenberg
% 13-03-2016 Suggestion by Max Snijders to add pdfusetitle to the options of hyperref
%            This adds metadata to the PDF File
\RequirePackage[pdfusetitle,hidelinks]{hyperref}