webisthesis.cls 12.9 KB
Newer Older
Martin Potthast's avatar
Martin Potthast committed
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
%%
%% webisthesis.cls
%% ===============
%%
%% Options (\documentclass[<comma-separated options list>]{webisthesis})
%% ---------------------------------------------------------------------
%% - english      For a thesis written in English
%% - german       For a thesis written in German
%% - bachelor     For a bachelor thesis (B.Sc. Medieninformatik)
%% - master       For a master thesis   (M.Sc. Computer Science and Media)
%% Default: [german,bachelor]
%%
%% New commands
%% ------------
%% \ThesisSetTitle{<title>}
%% \ThesisSetKeywords{<comma-and-space-separated list of keywords>} (optional)
%% \ThesisSetAuthor{<your first name> <your last name>}
%% \ThesisSetStudentNumber{<your number>}
%% \ThesisSetDateOfBirth{<dd>}{<mm>}{<yyyy of your birthday>}
%% \ThesisSetPlaceOfBirth{<location you were born>}
%% \ThesisSetSupervisors{<comma-separated list of your supervisors>}
%% \ThesisSetSubmissionDate{<dd>}{<mm>}{<yyyy of your final submission>}
%% \ThesisSetLocation{<your current location>} (optional, default: Weimar)
%%   These commands can be used to specify some of the values that are used for
%%   generating the title page, the declaration of independent work and PDF meta
%%   attributes of the document (when \usehyperref is also used).
%%   Besides the commands marked (optional), all of these have to be specified
%%   before \begin{document} or else compilation will abort.
%% 
%% \usehyperref[<additional options>]
%%   This new command allows you to load the hyperref package with some suggested
%%   options (also setting PDF fields (like author)). Because of compatibility
%%   issues, hyperref has to be loaded after most packages, but also before some
%%   certain packages. Use this command at the appropriate place.
%%   The optional parameter can be used to forward additional options to
%%   hyperref.
%%   E.g. \usehyperref[breaklinks=true] to allow linebreaks within links.
%%
Johannes Kiesel's avatar
Johannes Kiesel committed
39
%% \formatdateshort{<dd>}{<mm>}{<yyyy>}
Martin Potthast's avatar
Martin Potthast committed
40
%%   Analogous to \formatdate{<dd>}{<mm>}{<yyyy>} of the datetime package, but
Johannes Kiesel's avatar
Johannes Kiesel committed
41
%%   prints a shorter version to be used in tables or figures.
Martin Potthast's avatar
Martin Potthast committed
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
%%
%% New environments
%% ----------------
%% frontmatter
%%  This will print the title page and the declaration of independent work.
%%  The pagenumbers will be turned to arabic and reset when this environment
%%  ends.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Required packages:
%% - babel
%% - caption
%% - datetime
%% - fancyhdr
%% - fontenc
%% - geometry
%% - hyperref
%% - ifpdf
%% - ifthen
%% - inputenc
%% - tocbibind
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Current maintainer: Johannes Kiesel
%% Based on work of Peter Prettenhofer and
%% Stefan Brecheisen (Institut fuer Informatik der LMU Muenchen)
%%

Johannes Kiesel's avatar
Johannes Kiesel committed
70
\def\fileversion{v1.3}
Johannes Kiesel's avatar
Johannes Kiesel committed
71
\def\filedate{2014/01/08}
Martin Potthast's avatar
Martin Potthast committed
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{webisthesis}[\filedate\space\fileversion]


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load base class (report) and basic utilities
\LoadClass[a4paper,12pt]{report}
\RequirePackage[latin1]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{ifpdf}
\RequirePackage{ifthen}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Options

% Language
\newcommand{\documentlanguage}{}
\DeclareOption{english}{%
  \renewcommand{\documentlanguage}{english}%
}
\DeclareOption{german}{%
  \renewcommand{\documentlanguage}{ngerman}%
}
\ExecuteOptions{german} % default

% Type
\newcommand{\thesistype}{}
\DeclareOption{bachelor}{%
  \renewcommand{\thesistype}{Bachelor}%
}
\DeclareOption{master}{%
  \renewcommand{\thesistype}{Master}%
}
\ExecuteOptions{bachelor} % default

\ProcessOptions

% Language
\RequirePackage[\documentlanguage]{babel}
% Datetime
Johannes Kiesel's avatar
Johannes Kiesel committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125
% Add ``.'' after abbreviated months
\expandafter\newcommand\csname shortdateperiod1\endcsname{.}
\expandafter\newcommand\csname shortdateperiod2\endcsname{.}
\expandafter\newcommand\csname shortdateperiod3\endcsname{.}
\expandafter\newcommand\csname shortdateperiod4\endcsname{.}
\expandafter\newcommand\csname shortdateperiod5\endcsname{}% May
\expandafter\newcommand\csname shortdateperiod6\endcsname{e}% June
\expandafter\newcommand\csname shortdateperiod7\endcsname{y}% July
\expandafter\newcommand\csname shortdateperiod8\endcsname{.}
\expandafter\newcommand\csname shortdateperiod9\endcsname{.}
\expandafter\newcommand\csname shortdateperiod10\endcsname{.}
\expandafter\newcommand\csname shortdateperiod11\endcsname{.}
\expandafter\newcommand\csname shortdateperiod12\endcsname{.}
\newcommand{\formatdateshort}[3]{{\shortdate\formatdate{#1}{#2}{#3}}}
Martin Potthast's avatar
Martin Potthast committed
126
\ifthenelse{\equal{\documentlanguage}{english}}{%
Johannes Kiesel's avatar
Johannes Kiesel committed
127 128
  \RequirePackage[us,nodayofweek]{datetime}%
  \renewcommand{\formatdateshort}[3]{\shortmonthname[#2]{}\csname shortdateperiod#2\endcsname{}\ #1, #3}%
Martin Potthast's avatar
Martin Potthast committed
129 130
}{}
\ifthenelse{\equal{\documentlanguage}{ngerman}}{%
Johannes Kiesel's avatar
Johannes Kiesel committed
131 132 133 134
  \RequirePackage[nodayofweek]{datetime}%
  \newdateformat{germanlongdate}{\THEDAY.\ \monthname[\THEMONTH]{} \THEYEAR}%
  \germanlongdate%
  %\renewcommand{\dateseparator}{.}%
Johannes Kiesel's avatar
Johannes Kiesel committed
135
  \renewcommand{\formatdateshort}[3]{\twodigit{#1}.\twodigit{#2}.#3}%
Martin Potthast's avatar
Martin Potthast committed
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
}{}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Variables
\newtoks\thesistitle
\newcommand{\ThesisSetTitle}[1]{\global\thesistitle{#1}}

\newtoks\thesisauthor
\newcommand{\ThesisSetAuthor}[1]{\global\thesisauthor{#1}}

\newtoks\thesissupervisors
\newcommand{\ThesisSetSupervisors}[1]{\global\thesissupervisors{#1}}

\newtoks\thesissubmissiondate
Johannes Kiesel's avatar
Johannes Kiesel committed
151
\newcommand{\ThesisSetSubmissionDate}[3]{\global\thesissubmissiondate{\formatdate{#1}{#2}{#3}}}
Martin Potthast's avatar
Martin Potthast committed
152 153 154 155 156 157 158 159 160

\newtoks\thesislocation
\newcommand{\ThesisSetLocation}[1]{\global\thesislocation{#1}}
\ThesisSetLocation{Weimar} % default

\newtoks\thesisauthorstudentnumber
\newcommand{\ThesisSetStudentNumber}[1]{\global\thesisauthorstudentnumber{#1}}

\newtoks\thesisauthordateofbirth
Johannes Kiesel's avatar
Johannes Kiesel committed
161
\newcommand{\ThesisSetDateOfBirth}[3]{\global\thesisauthordateofbirth{\formatdateshort{#1}{#2}{#3}}}
Martin Potthast's avatar
Martin Potthast committed
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

\newtoks\thesisauthorplaceofbirth
\newcommand{\ThesisSetPlaceOfBirth}[1]{\global\thesisauthorplaceofbirth{#1}}

\newtoks\thesiskeywords
\newcommand{\ThesisSetKeywords}[1]{\global\thesiskeywords{#1}}

% Check if variables are set
% \checkthesisvariable{variable value}{name}{setter command}{example}
\newcommand{\checkthesisvariable}[4]{%
  \ifthenelse{\equal{#1}{}}{%
    \ClassWarning{webisthesis}{%
      #2 was not defined! %
      Use command "#3{#2}" (e.g.: "#4") before "begin{document}"}%
    \global\thesisvariableerrors{true}%
  }{}%
}
\newcommand{\checkthesisvariabledate}[3]{%
  \ifthenelse{\equal{#1}{}}{%
    \ClassWarning{webisthesis}{%
      #2 was not defined! %
      Use command "#3{day}{month}{year}" (e.g.: "#3{31}{12}{2022}") before "begin{document}"}%
    \global\thesisvariableerrors{true}%
  }{}%
}
% Checking all variables...
\newcommand{\checkthesisvariables}{%
  \newtoks\thesisvariableerrors%
  \checkthesisvariable{\the\thesistitle}{Title}{ThesisSetTitle}{Title of my Thesis}%
  \checkthesisvariable{\the\thesisauthor}{Author}{ThesisSetAuthor}{First name Last name}%
  \checkthesisvariable{\the\thesissupervisors}{Supervisors}{ThesisSetSupervisors}{Prof. Dr. Benno Stein,Prof. Albert Einstein}%
  \checkthesisvariabledate{\the\thesissubmissiondate}{Submission date}{ThesisSetSubmissionDate}%
  \checkthesisvariable{\the\thesisauthorstudentnumber}{Student Number}{ThesisSetStudentNumber}{01234}%
  \checkthesisvariabledate{\the\thesisauthordateofbirth}{Date of Birth (Author)}{ThesisSetDateOfBirth}%
  \checkthesisvariable{\the\thesisauthorplaceofbirth}{Place of Birth (Author)}{ThesisSetPlaceOfBirth}{Duckburg}%
  \ifthenelse{\equal{\the\thesisvariableerrors}{true}}{%
    \ClassError{webisthesis}{%
      Not all required variables for the thesis template have been set}{%
      See the Warnings for class webisthesis above.}%
  }{}%
}
% ... at the begin of the document
\AtBeginDocument{\checkthesisvariables}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Template words
\newtoks\thesisfrontpagefaculty
\newtoks\thesisfrontpagecourse
\newtoks\thesisfrontpagetypename
\newtoks\thesisfrontpagestudentnumber
\newtoks\thesisfrontpageborn
\newtoks\thesisfrontpagesupervisor
\newtoks\thesisfrontpagedateofsubmission
\newtoks\thesisdeclarationtitle
\newtoks\thesisdeclarationtext
\newtoks\thesisfrontmatterkeywords
\ifthenelse{\equal{\documentlanguage}{english}}{%
  \global\thesisfrontpagefaculty{Faculty of Media}
Johannes Kiesel's avatar
Johannes Kiesel committed
220
  \global\thesisfrontpagecourse{Degree Programme }
Martin Potthast's avatar
Martin Potthast committed
221
  \global\thesisfrontpagetypename{'s Thesis}
Johannes Kiesel's avatar
Johannes Kiesel committed
222 223 224 225 226
  \global\thesisfrontpagestudentnumber{Matriculation Number}
  \global\thesisfrontpageborn{Born \the\thesisauthordateofbirth{} in %
    \the\thesisauthorplaceofbirth}
  \global\thesisfrontpagesupervisor{Referee}
  \global\thesisfrontpagedateofsubmission{Submission date}
Martin Potthast's avatar
Martin Potthast committed
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
  \global\thesisdeclarationtitle{Declaration}
  \global\thesisdeclarationtext{Unless otherwise indicated in the text or %
    references, this thesis is entirely the product of my own scholarly work.}
  \global\thesisfrontmatterkeywords{Keywords}
}{}
\ifthenelse{\equal{\documentlanguage}{ngerman}}{%
  \global\thesisfrontpagefaculty{Fakult\"at Medien}
  \global\thesisfrontpagecourse{Studiengang }
  \global\thesisfrontpagetypename{arbeit}
  \global\thesisfrontpagestudentnumber{Matrikelnummer}
  \global\thesisfrontpageborn{geb. am: \the\thesisauthordateofbirth{} in %
    \the\thesisauthorplaceofbirth}
  \global\thesisfrontpagesupervisor{Gutachter}
  \global\thesisfrontpagedateofsubmission{Datum der Abgabe}
  \global\thesisdeclarationtitle{Erkl\"arung}
  \global\thesisdeclarationtext{Hiermit versichere ich, dass ich diese Arbeit %
    selbstst\"andig verfasst und keine anderen als die angegebenen Quellen und %
    Hilfsmittel verwendet habe.}
  \global\thesisfrontmatterkeywords{Schl\"usselworte}
}{}

\newtoks\thesisfrontpagecoursename
\ifthenelse{\equal{\thesistype}{Bachelor}}{%
  \global\thesisfrontpagecoursename{Medieninformatik}%
}{}
\ifthenelse{\equal{\thesistype}{Master}}{%
  \global\thesisfrontpagecoursename{Computer Science and Media}%
}{}

% Frontpage
\newcommand{\frontpage}{%
  \begin{titlepage}
		\vspace{2cm}
		\hspace*{-1cm}
    \parbox{10cm}{\normalsize Bauhaus-Universit\"at Weimar\\
      \the\thesisfrontpagefaculty\\
      \the\thesisfrontpagecourse\the\thesisfrontpagecoursename}

		\begin{center}
			\vspace{3cm}\Huge
      {\bf\the\thesistitle}

      \vspace{3cm}\Huge
      {\bf\thesistype\the\thesisfrontpagetypename}
		\end{center}
    \vspace{\fill}\normalsize
Johannes Kiesel's avatar
Johannes Kiesel committed
273 274 275 276 277 278 279 280 281 282
    \the\thesisauthor\hfill\the\thesisfrontpagestudentnumber{} %
      \the\thesisauthorstudentnumber\\%
    \the\thesisfrontpageborn\\[3em]
    \newcounter{supervisors}\makeatletter%
    \@for \name:=\the\thesissupervisors\do{%
      \addtocounter{supervisors}{1}\arabic{supervisors}. %
      \the\thesisfrontpagesupervisor: \name \\%
    }%
    \makeatother\\[3em]%
    \the\thesisfrontpagedateofsubmission: \the\thesissubmissiondate
Martin Potthast's avatar
Martin Potthast committed
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
  \end{titlepage}
}%

% Declaration of independent work
\newcommand{\declaration}{
  \begin{titlepage}
    \vspace*{\fill}
    \parindent 0cm
    \begin{center}
      \textbf{\huge \the\thesisdeclarationtitle}
    \end{center}

    \vspace{1cm}

		\large \the\thesisdeclarationtext

    \vspace{1cm}
    \the\thesislocation, \the\thesissubmissiondate

    \vspace{2cm}
    \makebox[10cm]{\dotfill}\\
    \the\thesisauthor

    \vspace*{\fill}
  \end{titlepage}
}

\newenvironment{frontmatter}{%
  \pagenumbering{roman}%
  \frontpage%
  \declaration%
}{%
  \clearpage%
  \pagenumbering{arabic}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page layout
\RequirePackage{geometry}
\RequirePackage{fancyhdr}

\geometry{body={140mm,210mm},footskip=12mm}
\pagestyle{fancy}
\headheight 14pt
\fancyhf{}
\fancyhead[L]{\small\slshape\leftmark}
\fancyfoot[C]{\thepage}

% Enumerate subsections and include them in the table of contents
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}

% List bibliography in table of contents
\RequirePackage[nottoc,notlot,notlof]{tocbibind}

% Specification of figure/table caption style
\RequirePackage[font=small,labelfont=bf]{caption}

% This new command allows you to load the hyperref package with some suggested
% options (also setting PDF fields (like author)). Because of compatibility
% issues, hyperref has to be loaded after most packages, but also before some
% certain packages. Use this command at the appropriate place.
%
% The optional parameter can be used to forward additional options to hyperref.
% e.g. \usehyperref[breaklinks=true] to allow linebreaks within links.
\newcommand{\usehyperref}[1][]{%
  \newcommand{\hyperoptions}{%
    colorlinks=false,%
    pageanchor=false%
  }%
  \ifpdf%
    \newcommand{\hyperpdfoptions}{%
      ,pdftex,%
      pdfborder={0 0 0},%
      pdfauthor={\the\thesisauthor},%
      pdftitle={\the\thesistitle},%
      pdfkeywords={\the\thesiskeywords},%
      pdfdisplaydoctitle,%
      pdfpagemode={UseNone},%
      pdfstartview={Fit}%
    }%
    \usepackage[\hyperoptions\hyperpdfoptions,#1]{hyperref}
  \else%
    \usepackage[\hyperoptions,#1]{hyperref}
  \fi%
}