summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dithesis/dithesis.cls
blob: 7e37fba3022cc666763d95f0d46c2d1f1a4bde17 (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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
%%
%% dithesis.cls version 0.2
%% dithesis - Latex2e document class for undergraduate theses at the Department
%%            of Informatics and Telecommunications, University of Athens.
%% Copyright (C) 2011-12 Yannis Mantzouratos <mantzouratos@gmail.com>
%%
%% LICENSE:
%%
%% This work 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 
%% 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%% The Current Maintainer of this work is Yannis Mantzouratos.
%%
%% This work consists of the source file dithesis.cls and the documentation
%% files sample.tex, samplewArial.tex, sample.pdf and samplewArial.pdf.
%% To ensure proper compilation, however, the logo of the University of Athens 
%% is also distributed alongside this work, under the filename athena.jpg.
%%
%% NOTES and WARRANTY:
%%
%% This work conforms to the requirements of the Department of Informatics and
%% Telecommunications at the University of Athens regarding the preparation of 
%% undergraduate theses, as of Sep 1, 2011.
%%
%% This work is distributed in the hope that it will be useful, but WITHOUT ANY
%% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
%% FOR A PARTICULAR PURPOSE.
%% The entire risk as to the quality and performance of this work is with you.
%% Should this work prove defective, you assume the cost of all necessary 
%% servicing, repair, or correction.
%% See the LaTeX Project Public License for more details.
%%
%% The latest official Microsoft Word(...) template can be found in
%% http://www.di.uoa.gr/lib.
%%
%% CHANGELOG:
%%
%% version 0.2:
%% - Fixed pagestyle inconsistencies for multi-page Table of Contents, List of
%%   Figures, List of Tables, as well as the thesis prologue, acknowledgments,
%%   dedication, and abstract environments.
%% - Fixed spacing between the title and entries of List of Figures and List of
%%   Tables; the spacing between entries is now the same for sections, figures
%%   and tables, too.
%% - Fixed line spacing between different bibliography entries to zero.
%% - Added explicit enforcement of 12pt entries in List of Figures and List of
%%   Tables.
%%

%% ============================================================
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{dithesis}[2011/09/01 v0.2 DIT.UoA Undergraduate Thesis LaTeX
  document class]

\LoadClass[a4paper,titlepage,oneside,12pt]{article}[2005/09/16]
%% ============================================================

%%
%% User Interface Commands
%%
% \thesistitle{text}: set the title of thesis to text
% \thethesistitle:    access the title of thesis later in the document
\DeclareRobustCommand{\thesistitle}[1]{\title{#1}\let\thethesistitle\thetitle}
% \thesissection{title}:  set a new numbered section of thesis, with some title
% \thesissection*{title}: similar to \thesissection, but produces an unnumbered
%                         section, which will be included in the ToC.
\makeatletter
\DeclareRobustCommand{\thesissection}{%
  \@ifstar\thesissectionstar\thesissectionnostar
}
\makeatother
\newcommand{\thesissectionstar}[1]{%
  \newpage
  \phantomsection
  \addcontentsline{toc}{section}{\texorpdfstring{\MakeUppercase{#1}}{#1}}
  \section*{#1}
}
\newcommand{\thesissectionnostar}[1]{%
  \newpage
  \section[\texorpdfstring{\MakeUppercase{#1}}{#1}]{#1}%
}
% \thesissubsection,    \thesissubsection*
% \thesissubsubsection, \thesissubsubsection*
% all like before.
\makeatletter
\DeclareRobustCommand{\thesissubsection}{%
  \@ifstar\thesissubsectionstar\thesissubsectionnostar
}
\makeatother
\newcommand{\thesissubsectionstar}[1]{%
  \phantomsection
  \addcontentsline{toc}{subsection}{#1}
  \subsection*{#1}
}
\newcommand{\thesissubsectionnostar}[1]{%
  \subsection{#1}
}
\makeatletter
\DeclareRobustCommand{\thesissubsubsection}{%
  \@ifstar\thesissubsubsectionstar\thesissubsubsectionnostar
}
\makeatother
\newcommand{\thesissubsubsectionstar}[1]{%
  \phantomsection
  \addcontentsline{toc}{subsubsection}{#1}
  \subsubsection*{#1}
}
\newcommand{\thesissubsubsectionnostar}[1]{%
  \subsubsection{#1}
}

% \thesiskeywords{SAlabel}{SA}{KWlabel}{KW}{KW}{KW}{KW}{KW}:
%     set the Subject Area label, the Subject Area, the Keyword label and
%     five keywords, respectively, at the end of the current page.
\DeclareRobustCommand{\thesiskeywords}[8]{%
  \vfill
  \begin{tabularx}{\textwidth}{l X}
    {\bfseries\MakeUppercase{#1}:}  & #2
  \end{tabularx}

  \begin{tabularx}{\textwidth}{l X}
    {\bfseries\MakeUppercase{#3}:}  & \MakeLowercase{#4, #5, #6, #7, #8}
  \end{tabularx}

}

% \university:      the name of university
% \school:          the name of school
% \department:      the name of the department
% \thesislabel:     how to label the thesis (do NOT confuse with title)
% \supervisorlabel: how to label the supervisor(s)
% \idlabel:         how to label the ID of the author(s)
% \thesisplace:     the place where the thesis was deemed successfully completed
% \thesisdate:      the date when the thesis was successfully completed
\newcommand{\university}{National and Kapodistrian University of Athens}
\newcommand{\school}{School of Science}
\newcommand{\department}{Department of Informatics and Telecommunications}
\newcommand{\thesislabel}{Thesis}
\newcommand{\supervisorlabel}{Supervisors}
\newcommand{\idlabel}{A.M.}
\newcommand{\thesisplace}{Athens}
\newcommand{\thesisdate}{September 2011}

% \thesisauthor{Name}{ID}: set the author of the thesis; their name is Name and 
%                          their departmental identification number is ID.
% for multiple authors, just use the \thesisauthor command multiple times.
% relative ordering is preserved.
% \thethesisauthor:        access the author(s) of the thesis, as a list of
%                          comma-separated values.
\makeatletter
\newcommand{\thesisauthor}[2]{%
  \ifthenelse{\isundefined{\theauthorsattitlepage}}{%
    \def\theauthorsattitlepage{#1}
  }%
  {%
    \g@addto@macro\theauthorsattitlepage{\\#1}
  }
  \ifthenelse{\isundefined{\theauthorsatacceptancepage}}{%
    \def\theauthorsatacceptancepage{\textbf{#1}\\\textbf{\idlabel:} #2}
  }%
  {%
    \g@addto@macro\theauthorsatacceptancepage{%
      \\\textbf{#1}\\\textbf{\idlabel:} #2}
  }
  \ifthenelse{\isundefined{\theauthorsatfooters}}{%
    \def\theauthorsatfooters{#1}
  }%
  {%
    \g@addto@macro\theauthorsatfooters{, #1}
  }
}
\makeatother
\newcommand{\thethesisauthor}{\theauthorsatfooters}

% \supervisor{Name}{Profession}: set the supervisor of the thesis; their name is
%                                Name and their profession is indicated by
%                                Profession (e.g. Professor, PhD Student, etc).
% for multiple supervisors, just use the \supervisor command multiple times.
% relative ordering is preserved.
\makeatletter
\newcommand{\supervisor}[2]{%
  \ifthenelse{\isundefined{\thesupervisorslist}}{%
    \def\thesupervisorslist{\textbf{#1,} #2}
  }%
  {%
    \g@addto@macro\thesupervisorslist{\\&\textbf{#1,} #2}
  }
}
\makeatother

\newcommand{\thesupervisorsattitlepage}{%
  \begin{table*}[!h]
    \centering
    \begin{tabular}{l l}
      \textbf{\supervisorlabel:} & \thesupervisorslist \\
    \end{tabular}
  \end{table*}
}

\newcommand{\thesupervisorsatacceptancepage}{%
  \begin{table*}[!h]
    \centering
    \begin{tabular}{l l}
      \textbf{\MakeUppercase{\supervisorlabel:}} & \thesupervisorslist \\
    \end{tabular}
  \end{table*}
}
%%
%% End of User Interface Commands
%% ============================================================

%%
%% User Interface Environments
%%
% the following are self explanatory.
% thesisabstract:         the abstract title is parameterized
% thesisdedication
% thesisacknowledgments:  the acknowledgments title is parameterized
% thesisprologue:         the prologue title is parameterized
% thesisterminology:      the terminology title is parameterized
% thesisabbreviations:    the abbreviations title is parameterized
% thesisbibliography[]{}: wrapper of thebibliography, where the (optional)
%                         references title is parameterized
\newenvironment{thesisabstract}[1][Abstract]
               { \newpage
                 \pagestyle{empty}
                 \section*{#1}
                 \vspace*{0.3in}}
               {\clearpage\pagestyle{fancy}}

\newenvironment{thesisdedication}
               { \newpage
                 \pagestyle{empty}
                 \vspace*{3.5in}
                 \begin{flushright}
                   \fontsize{12pt}{14.4pt}\selectfont\itshape}
               { \end{flushright}\clearpage\pagestyle{fancy}}

\newenvironment{thesisacknowledgments}[1][Acknowledgements]
               { \newpage
                 \pagestyle{empty}
                 \section*{#1}
                 \vspace*{0.3in}}
               {\clearpage\pagestyle{fancy}}

\newenvironment{thesisprologue}[1][Prologue]
               { \thesissection*{#1}
                 \pagestyle{empty}}
               {\clearpage\pagestyle{fancy}}

\newenvironment{thesisterminology}[1][Terminology Table]
               { \thesissection*{#1}}
               {}

\newenvironment{thesisabbreviations}[1][Abbreviations, Initials and Acronyms]
               { \thesissection*{#1}}
               {}

\let\oldrefname\refname
\newenvironment{thesisbibliography}[2][\oldrefname]
               { \renewcommand{\refname}{#1}
                 \newpage
                 \phantomsection
                 \addcontentsline{toc}{section}%
                                 {\texorpdfstring{\MakeUppercase{#1}}{#1}}
                 \begin{thebibliography}{#2}
                   \fontsize{10pt}{12pt}\selectfont}
               { \end{thebibliography}}
%%
%% End of User Interface Environments
%% ============================================================

%%
%% General Packages
%%
\RequirePackage{hyperref} % In-text references
\RequirePackage{tabularx} % Special tables
%%
%% End of General Packages
%% ============================================================

%%
%% Figures, Subfigures and Captions
%%
\RequirePackage{graphicx}              % To include graphics
\RequirePackage{float}                 % Figures
\RequirePackage[caption=false]{subfig} % Subfigures
\RequirePackage[%
  justification=centering,
  labelsep=colon,
  figureposition=bottom,
  tableposition=top]{caption}          % Captions

% caption fonts should be boldface 10pt.
\renewcommand{\captionfont}{\fontsize{10pt}{12pt}\selectfont\bfseries}
%%
%% End of Figures, Subfigures and Captions
%% ============================================================

%%
%% Margins of Text Pages
%%
\RequirePackage[%
  a4paper,
  top=2cm,   bottom=2cm,     left=2cm,    right=2cm, bindingoffset=0.5cm, 
  head=14pt, headsep=0.50cm, foot=0.75cm]{geometry}
%%
%% End of Margins of Text Pages
%% ============================================================

%%
%% Paragraph and Line Spacing
%%
\RequirePackage{parskip}                  % Paragraphs
\RequirePackage[onehalfspacing]{setspace} % Lines

% Indentation preceeding a paragraph should be 0 pt, and vertical space after
% a paragraph should be 6 pt.
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt}

% The following excerpt redefines thebibliography in order to achieve zero line
% spacing between different bibliography items.
% It is a copy of bibspacing.sty by Jakob Schiotz [dcwww.camd.dtu.dk/~schiotz/],
% self-contained for ease of use.
% Retrieved date: Sep 1, 2012.
\makeatletter
\newdimen\bibindent
\setlength\bibindent{1.5em}
\renewenvironment{thebibliography}[1]{%
  \section*{\refname
        \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
         \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep 
            \itemsep\z@skip
            \parsep\z@skip
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy\clubpenalty4000\widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother
% End of bibspacing.sty.
%%
%% End of Paragraph and Line Spacing
%% ============================================================

%%
%% Headers and Footers of Text Pages
%%
\RequirePackage{fancyhdr}

% each page should have a left header with the thesis title at 8 pt, a left 
% footer with the names of authors at 8 pt, and a right footer with the current
% page number at 10 pt.
\pagestyle{fancy}
\fancyhead[R]{}
\fancyhead[C]{}
\fancyhead[L]{\fontsize{8pt}{9.6pt}\selectfont\thethesistitle}
\fancyfoot[R]{\fontsize{10pt}{12pt}\selectfont\thepage}
\fancyfoot[C]{}
\fancyfoot[L]{\fontsize{8pt}{9.6pt}\selectfont\theauthorsatfooters}
\renewcommand{\headrulewidth}{0pt}
%%
%% End of Headers and Footers of Text Pages
%% ============================================================

%%
%% Format of Titles for Thesis Sections, Subsections and Subsubsections.
%%
\RequirePackage{titlesec}

% sections should be boldfaced, uppercase and centered, at 14pt, with no 
% further spacing near them.
\titleformat{\section}[block]
            {\fontsize{14pt}{16.8pt}\selectfont\centering\bfseries}
            {\thesection . }{0pt}{\MakeUppercase}
\titlespacing{\section}{0pt}{0pt}{0pt}
% subsections should be boldfaced and justified at left, at 12pt, with
% 12pt vertical spacing before them.
\titleformat{\subsection}[block]
            {\fontsize{12pt}{14.4pt}\selectfont\raggedright\bfseries}
            {\thesubsection\quad}{0pt}{}
\titlespacing{\subsection}{0pt}{12pt}{0pt}
% subsubsections should be boldfaced and justified at left, at 12pt, with
% 12pt vertical spacing before them.
\titleformat{\subsubsection}[block]
            {\fontsize{12pt}{14.4pt}\selectfont\raggedright\bfseries}
            {\thesubsubsection\quad}{0pt}{}
\titlespacing{\subsubsection}{0pt}{12pt}{0pt}
%%
%% End of Format of Titles for Thesis Sections, Subsections and Subsubsections.
%% ============================================================

%%
%% Format of Table of Contents, List of Figures and List of Tables.
%%
\RequirePackage{titletoc}
\RequirePackage[subfigure,titles]{tocloft}

% Table of Contents
\let\oldtableofcontents\tableofcontents
\DeclareRobustCommand{\tableofcontents}{
  \newpage
  \pagestyle{empty}
  \oldtableofcontents
  \clearpage
  \pagestyle{fancy}
}

% place dots between each section and the respective page number
\renewcommand{\cftsecleader}{\bfseries\cftdotfill{\cftdotsep}}
% place dots between each subsection and the respective page number
\renewcommand{\cftsubsecleader}{\bfseries\cftdotfill{\cftdotsep}}
% place a dot after each section number
\renewcommand{\cftsecaftersnum}{.}
% section entries should be 12 pt and bold
\renewcommand{\cftsecfont}{\fontsize{12pt}{14.4pt}\selectfont\bfseries}
% subsection entries should be 10 pt
\renewcommand{\cftsubsecfont}{\fontsize{10pt}{12pt}\selectfont\bfseries}
% subsubsection entries should be 10 pt
\renewcommand{\cftsubsubsecfont}{\fontsize{10pt}{12pt}\selectfont}
% subsections should not be indented, whereas subsubsections should
\setlength\cftsubsubsecindent\cftsubsecindent
\setlength{\cftsubsecindent}{0pt}
% subsections should have the same vertical space with sections
\setlength\cftbeforesubsecskip\cftbeforesecskip
% space between sections and numbering in case of double digit numbers
\newlength{\tocbinnumwidth}
\settowidth{\tocbinnumwidth}{9}
\addtolength{\cftsecnumwidth}{\tocbinnumwidth}

% List of Figures
\let\oldlistoffigures\listoffigures
\DeclareRobustCommand{\listoffigures}{
  \newpage
  \pagestyle{empty}
  \oldlistoffigures
  \clearpage
  \pagestyle{fancy}
}
% place ``Figure x:'' labels in front of each figure
\newlength{\figlabelwidth}
\renewcommand{\cftfigpresnum}{\figurename\enspace}
\renewcommand{\cftfigaftersnum}{:}
\settowidth{\figlabelwidth}{\cftfigpresnum\cftfigaftersnum}
\addtolength{\cftfignumwidth}{\figlabelwidth}
% explicitly enforce 12pt fonts
\renewcommand{\cftfigfont}{\fontsize{12pt}{14.4pt}\selectfont}
% and make the spacing the same as with sections
\setlength\cftbeforefigskip\cftbeforesecskip

% List of Tables
\let\oldlistoftables\listoftables
\DeclareRobustCommand{\listoftables}{
  \newpage
  \pagestyle{empty}
  \oldlistoftables
  \clearpage
  \pagestyle{fancy}
}
% place ``Table x:'' labels in front of each table
\newlength{\tablabelwidth}
\renewcommand{\cfttabpresnum}{\tablename\enspace}
\renewcommand{\cfttabaftersnum}{:}
\settowidth{\tablabelwidth}{\cfttabpresnum\cfttabaftersnum}
\addtolength{\cfttabnumwidth}{\tablabelwidth}
% explicitly enforce 12pt fonts
\renewcommand{\cfttabfont}{\fontsize{12pt}{14.4pt}\selectfont}
% and make the spacing the same as with sections
\setlength\cftbeforefigskip\cftbeforesecskip
%%
%% End of Format of Table of Contents, List of Figures and List of Tables.
%% ============================================================

%%
%% Format of the Title and Acceptance Pages
%%
\RequirePackage{titling}
\RequirePackage{xifthen}

% the logo should exist to go on.
\IfFileExists{athena.jpg}{}{
  \ClassError{dithesis}{The University of Athens logo athena.jpg was not found.}
             {Add athena.jpg in the class folder and try again.}
}

% maketitle modifications (refer to the titling package)
\setlength{\droptitle}{-204pt}
\renewcommand{\maketitlehooka}{%
  \begin{center}
    \begin{singlespace}
      \includegraphics[height=2cm]{athena.jpg}
      \vspace*{0.08in}

      {\fontsize{14pt}{16.8pt}\selectfont\bfseries
        \MakeUppercase{\university}}

      \vspace*{0.08in}
    
      {\fontsize{12pt}{14.4pt}\selectfont\bfseries
        \MakeUppercase{\school}} \\
      {\fontsize{12pt}{14.4pt}\selectfont\bfseries
        \MakeUppercase{\department}}

      \vspace*{0.82in}

      {\fontsize{12pt}{14.4pt}\selectfont\bfseries
        \MakeUppercase{\thesislabel}}

      \vspace*{0.25in}
    \end{singlespace}
  \end{center}
}

\pretitle{%
  \begin{center}
    \begin{singlespace}
      \fontsize{16pt}{19.2pt}\selectfont\bfseries}
\posttitle{\end{singlespace}\end{center}}

\renewcommand{\maketitlehookb}{%
  \vspace*{0.43in}
}

\preauthor{%
  \author{\theauthorsattitlepage}
  \begin{center}
    \begin{singlespace}
      \fontsize{12pt}{14.4pt}\selectfont\bfseries}
\postauthor{\end{singlespace}\end{center}}

\renewcommand{\maketitlehookc}{%
  \begin{center}
    \begin{singlespace}
      \vspace*{1.49in}

      {\fontsize{12pt}{14.4pt}\selectfont\thesupervisorsattitlepage}
    
      \vspace*{1.34in}

      {\fontsize{12pt}{14.4pt}\selectfont\bfseries\MakeUppercase{\thesisplace}}
    \end{singlespace}
  \end{center}
}

\predate{%
  \date{\thesisdate}
  \begin{center}
    \fontsize{12pt}{14.4pt}\selectfont\bfseries\MakeUppercase}
\postdate{\end{center}}

\renewcommand{\maketitlehookd}{%
  \newpage
  \thispagestyle{empty}
  \begin{center}
    \vspace*{0.56in}

    {\fontsize{12pt}{14.4pt}\selectfont\bfseries\MakeUppercase{\thesislabel}}

    \vspace*{0.36in}

    {\fontsize{12pt}{14.4pt}\selectfont\thethesistitle}

    \vspace*{0.56in}
    {\fontsize{12pt}{14.4pt}\selectfont\theauthorsatacceptancepage}

    \vspace*{2.76in}
    {\fontsize{12pt}{14.4pt}\selectfont\thesupervisorsatacceptancepage}
  \end{center}
}

\let\oldmaketitle\maketitle
\renewcommand{\maketitle}{\oldmaketitle\setcounter{page}{3}}
%%
%% End of Format of the Title and Acceptance Pages
%% ============================================================