% \iffalse meta-comment
%
% Copyright (©) 2014-2015 by Emmanuel Rousseaux <emmanuel.rousseaux@gmail.com>
% -------------------------------------------------------
% 
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, version 1.3c
% of this license.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{gsemthesis.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{gsemthesis}
%<*class>
    [2015/02/09 v0.9.4 .dtx gsemthesis file]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\RequirePackage[top=2.5cm, bottom=2.5cm, left=4.5cm, right=3.5cm]{geometry}
\RequirePackage{xcolor}
\definecolor{erblue}{HTML}{126199}
\RequirePackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=black, filecolor=erblue, citecolor=erblue, urlcolor=erblue}
\RequirePackage{url}
\RequirePackage{float}
\newenvironment{itemize*}%
  {\vspace{-2mm}\begin{itemize}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{0pt}%
  }%
  {\end{itemize}\vspace{-2mm}%
  }
\EnableCrossrefs         
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{gsemthesis.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v0.1.0}{2014/02/19}{First draft}
% \changes{v0.9.0}{2014/12/05}{Added French abstract, minor fixes}
% \changes{v0.9.1}{2014/12/06}{French option, draft option, update frontmatter, update backmatter, page numbering at the top of the page, refined cover page}
% \changes{v0.9.2}{2015/01/09}{rewriting of the cover page, improve bibliography management, and a lot of minor fixes}
% \changes{v0.9.3}{2015/01/16}{tested requirements on Debian and Windows, added the minimal working example, first complete version of the user manual}
% \changes{v0.9.4}{2015/02/09}{fixed RO-LE headers, custombib, graphicx and hyperref in final mode, utf-8, French T1, and a lot of minor fixes}
%
% \GetFileInfo{gsemthesis.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
% 
%
% \title{The \textsf{gsemthesis} class\thanks{This document
%   corresponds to \textsf{gsemthesis}~\fileversion, dated \filedate.}}
% \author{Emmanuel Rousseaux \\ \url{emmanuel.rousseaux@gmail.com}}
%
% \maketitle
%
% \begin{abstract}
% This article introduces the |gsemthesis| class for \LaTeX. The |gsemthesis| class is a PhD thesis  template for the Geneva School of Economics and Management (GSEM), University of Geneva, Switzerland. The class provides utilities to easily set up the cover page, the front matter pages, the pages headers, etc. with respect to the official guidelines of the GSEM Faculty for writing PhD dissertations.
% This class is released under the LaTeX Project Public License version 1.3c.
% \end{abstract}
%
% \newpage
%
% \tableofcontents
%
% \vfill
%
% \section{Introduction}
%
% PhD thesis published within the Geneva School of Economics and Management have to follows some guidelines, especially for the cover page. The |gsemthesis| class is a \LaTeX{} template providing utilities to easily set up these guidelines in your thesis. In addition the class loads several usefull packages generally used when writing a thesis.
% We recommend the user to have a look to the class definition in Section \ref{sec:classdef} to be aware of the list of packages that the class already includes. The Section \ref{sec:usage} details how to start with the |gsemthesis| class and how to configure your thesis. The Section \ref{sec:example} provides a minimal working example you can copy/paste for starting your dissertation. The user interested in customizing the class can read the Section \ref{sec:implementation} which details the full implementation of the class with usefull comments.
% 
% \medskip
%
% This class was successfully tested with TeX Live 2013/Debian, TeX Live 2014/CentOS;Windows7 and MiKTeX-2.9.5105/Windows7.
%
% \medskip
%
% This class has been written by Emmanuel \textsc{Rousseaux} with contributions from William \textsc{Aeberhard} and Tuan \textsc{Nguyen}.
%
% \medskip
%
% The development version is hosted on GitHub\footnote{\url{https://github.com/emmanuelrousseaux/gsemthesis}}. If you are interested in contributing to this class or if you want to beta test latest versions, please visit the repository.
% 
% \section{Usage}
% \label{sec:usage}
% 
% This Section introduces the use of the |gsemthesis| class. All macros and environments the class provides are described. We assume the user is already familiar with \LaTeX.
%
% \subsection{Requirements}
%
% The class requires a recent version of either TeX Live ($\ge$ 2014 recommended, $\ge$ 2013 minimal) or MiKTeX ($\ge$ 2.9.5x minimal). As the class preload some common packages (see Section \ref{sec:implementation} for the detailed list), we suggest to use install your \LaTeX{} distribution in full mode to make things working out-of-the-box.
% 
% \medskip
%
% \noindent The class uses biblatex/biber for managing the bibliography. Please refer to the Section \ref{sec:bibliography} for configuring your editor to use it.
%
% \subsection{Getting started}
%
% To use the class start your document with the command |\documentclass{gsemthesis}|. A minimal document is:
% \begin{verbatim}
% \documentclass{gsemthesis}
% \begin{document}
% \printcoverpage
% \newpage
% Here is it, I started my PhD!
% \end{document}
% \end{verbatim}
%
% \noindent The Section \ref{sec:example} provides a minimal working example you can copy/paste for starting your dissertation. Commands available for configuring your thesis are explained in the following sections.
%
% \subsection{Configuring your editor to store files in UTF-8}
%
% The class assumes that all your |.tex| and |.bib| files are encoded in UTF-8. The UTF-8 encoding is a dominant character encoding available on all recent systems and used by default by a lot of editors. As a consequence, it limits encoding problems when sharing files from different systems (Windows, MacOS, Unix/Linux, web sites, etc.). If some of your source files are stored with a different encoding, you may experience rendering problems with accentued/foreign characters. These characters can occur, for instance, in author names of the bibliography. For making sure you won't experience rendering problems, consider (1) storing your files in UTF-8 and (2) set UTF-8 as the default encoding of your editor.
%  Any recent text editor is able to convert files to UTF-8. TeXstudio and TeXmaker seem to used UTF-8 by default. Rstudio seems to use the system default encoding. To change this setting go to \emph{File $>$ Save with encoding}. On NotePad++ go to \emph{Encoding $>$ Convert to UTF-8}.
%
% \subsection{Writing the dissertation in French}
%
% The GSEM accepts English and French for PhD thesis dissertations. Default language is English. If you write your dissertation in French, you have to you the |fr| class option as follows:
% \begin{verbatim}
% \documentclass[fr]{gsemthesis}
% \end{verbatim}
%
% \subsection{Configuring and printing the cover page}
%
% \DescribeMacro{\printcoverpage}
% The class provides the GSEM PhD thesis cover page ready to be printed. You can ask to print it by calling |\printcoverpage| just after the |\begin{document}|. Before printing the cover page you first need to configure it with your thesis details: title, author, supervisors, committee, etc.
% 
% \DescribeMacro{\title}
% \DescribeMacro{\date}
% The class uses the classical |\title{|\emph{text}|}| and |\date{|\emph{text}|}| commands of the |book| class to set the title and the date.
% \DescribeMacro{\authorFirstname}
% \DescribeMacro{\authorLastname}
% Instead of using the |\author{|\emph{text}|}| command we provide the two commands |\authorFirstname{|\emph{text}|}| and |\authorLastname{|\emph{text}|}| to separately handle the firstname and the lastname.
% \DescribeMacro{\thesisField}
% You specify the PhD you are enrolled in with the |\thesisField{|\emph{text}|}|, among others: Economics, Management, Statistics, Information Systems. Please contact the scientific committee of your PhD to obtain the applicable title.
% \DescribeMacro{\thesisCommitteeA-F}
% You can specify information about members of your thesis committee with the six |\thesisCommitteeA-F{|\emph{title}|}{|\emph{firstname}|}{|\emph{lastname}|}{|\emph{role}|}| commands. With the \emph{role} field you specify the role played by this member in the committee and his/her affiliation. Generally you specify the role ``Chair'' in |\thesisCommitteeA|, the role ``adviser'' for your adviser/co-advisers, and leave the field empty for the other members.
% \DescribeMacro{\thesisNumber}
% When your manuscript has been accepted by your jury, the Faculty attributes a unique thesis number which has to be printed on the cover page. The |\thesisNumber{|\emph{text}|}| allows to supply it.
% 
% \subsection{Configuring and printing the front matter pages}
%
% After the cover page the thesis has to provide in a the following order (1) the acknowledgements, (2,3) an abstract in both English and French (the order depending on the main language of your dissertation: if your dissertation is written in English you will start with the English abstract; if your dissertation is written in Frenchyou will start with the French abstract), (4) the table of contents, and (5) an optional dedication. These elements are usually called the front matter. 
% \DescribeMacro{\printfrontmatter}
% These pages will be printed by calling the |\printfrontmatter| command. The best place for this command is just after the |\printcoverpage| command.
% \DescribeMacro{\acknowledgements}
% \DescribeMacro{\abstractEN}
% \DescribeMacro{\abstractFR}
% \DescribeMacro{\dedication}
% To fill these pages use the commands |\acknowledgements{|\emph{text}|}|, |\abstractEN{|\emph{text}|}|, |\abstractFR{|\emph{text}|}|, and |\dedication{|\emph{text}|}|. We suggest you use these commands in the preambule of the document, just after the commands used to set the cover page.
%
% \subsection{Introduction and conclusion}
%
% Generally we don't want to number the introduction and the conclusion, but we want they appear in the table of contents. This leads to a specific handling of the creation of these chapter, especially to have correct page headers.
% \DescribeMacro{\startintroduction}
% \DescribeMacro{\startconclusion}
% Therefore, instead of using |\chapter{introduction}| (respectively |\chapter{conclusion}|) to start a such chapter we provide the function |\startintroduction| (respectively |\startconclusion|) to easily start the chapter with a correct handling of the table of contents and page headers.
%
% \subsection{Bibliography}
% \label{sec:bibliography}
%
% To produce the bibliography, the |gsemthesis| class uses the package |biblatex| with |biber| in backend instead of the package |bibtex|. The package |biblatex| is installed by default with any recent version of TeX Live\footnote{On Ubuntu/Debian, you may have to install it manually: sudo apt-get install texlive-bibtex-extra biber} (full installation) and MiKTeX, but you must first configure your TeX Editor to use it.
%
% \subsubsection{Configure TeXstudio to run biber}
%
% In the TeXstudio preferences (click on Options $\rightarrow$ Configure TeXstudio), choose the `Build' tab and modify the `Default Bibliography' to `Biber'.
%
% \medskip
%
% \noindent Run `Build \& View' from the `Tools' menu (or press the two green arrows icon), which will create a PDF but with the bibliography not completed.
%
% \medskip
%
% \noindent Run `Bibliography' from the `Tools' menu.
%
% \medskip
%
% \noindent Run `Build \& View' again to create a PDF with the bibliography.
%
% \subsubsection{Configure Texmaker to run biber}
%
% In the Texmaker preferences (click on Options $\rightarrow$ Configure Texmaker), choose the `Commands' tab and replace |bibtex %| by |biber %| in the field |Bib(la)tex|. On Windows, you may also browse to the |biber.exe| using the folder icon on the side.
%
% \medskip
%
% \noindent Choose the `Quick Build' tab and select the second option |PdfLaTeX + Bib(la)tex +| |PdfLaTex (x2) + View Pdf|
%
% \medskip
%
% \noindent Now your `Quick Build' button will create a PDF with the bibliography.
%
% \subsubsection{Configure Rstudio/knitr to run biber}
%
% In Rstudio/knitr you have to include the following chunk in your |.Rnw| document:
%
% \begin{verbatim}
% <<tex-setup, include=FALSE, cache=FALSE, echo=FALSE>>=
% Sys.setenv(
%   TEXINPUTS=getwd(),
%   BIBINPUTS=getwd(),
%   BSTINPUTS=getwd()
% )
% @
% \end{verbatim}
%
% \subsubsection{Basic commands}
%
% To add a bibliography into your document, you have to define your bib file in the preamble of your tex file: |\addbibresource{literature-review-topic1.bib}| Then, at the end of your document, the command |\printbibliography| will create the biblography.
%
% \subsubsection{Using you own bibliography management configuration}
%
% If you prefer not to use the bibliography management configuration we implemented in this class, you can disabled it and writing you own. Disabling the \emph{gsemthesis} bibliography management configuration is easily done with the |custombib| class option:
% \begin{verbatim}
% \documentclass[custombib]{gsemthesis}
% \end{verbatim}
% When using this option you will have to provide the package you want to use for managing your bibliography (|natbib|, |chapterbib|, etc.). As the option disables all settings you will also need to load the package |biblatex| if you want to use it.
%
% \subsection{\emph{Draft} mode}
%
% When sharing draft versions of your dissertation you may prefer to hide some items of the cover page (thesis committee, thesis number, etc.) and some Sections (acknowledgments, the dedications. etc.) that probably have not been defined yet. For this purpose you can use the |draft| option:
% \begin{verbatim}
% \documentclass[draft]{gsemthesis}
% \end{verbatim}
% \noindent\emph{Note:} this draft mode extends the classical \LaTeX draft mode and then all packages supporting a draft mode will also switch to the draft mode\footnote{Common packages supporting a draft mode are: |changes| (final disables markup of changes, and list of changes), |graphics| (draw frames instead of including images), |graphicx| (draw frames instead of including images), |hyperref| (disable all linking features), |listings| (don't include external files), |listofsymbols| (final suppresses printing of macro names and unused symbols), |mfpic| (assume every latex run to be the first one), |microtype| (disable all features), |pdfcomment| (final suppresses the comments), |pdfpages| (don't include external file but print a frame box), |pgf| (similar to graphics/x: all images will be replaced by empty rectangles), |showkeys| (draft shows the labels, the default option), |thumbs| (thumbs' width=2pt, thumbs' text=black, thumbs' color=grey), |varioref| (turn warnings in error messages). \emph{Source:} \url{http://tex.stackexchange.com/questions/49277/what-does-the-draft-mode-change/49278}}. For convenience purposes we forced packages |graphicx| and |hyperref| to be in \emph{final} mode even when draft mode is on.
%
% \subsection{Miscellaneous}
%
% The class also provides some optional functions that can turn out to be usefull when writing your thesis.
% \DescribeEnv{itemize*}
% The default |itemize| environment set important spaces between each items, the previous paragraph and the next paragraph. The |itemize*| environment reduces these spaces to allow a more compact (and nicer) presentation of a list item.
% \emph{Forthcoming}. To add: section in redaction, todonotes
%
% \newpage
% \section{Minimal working example}
% \label{sec:example}
% \begin{verbatim}
% \documentclass{gsemthesis}
% 
% \title{An innovative approach to deal with a very important issue}
% \date{\today}
% \authorFirstname{Firstname}
% \authorLastname{Lastname}
% \thesisField{Econometrics}
% 
% \thesisCommitteeA{Prof.}{Mike}{Moore}{Adviser, University of Geneva}
% \thesisCommitteeB{Prof.}{Mike}{Moore}{Chair, University of Honolulu}
% \thesisCommitteeC{Prof.}{Mike}{Moore}{University of Omsk}
% \thesisCommitteeD{Dr.}{Mike}{Moore}{Eidgenössische Technische Hochschule Zürich}
% \thesisNumber{480}
% 
% \acknowledgements{Your acknowledgements}
% 
% \abstractEN{English version of the abstract}
% 
% \abstractFR{French version of the abstract}
% 
% \dedication{To my family.}
% 
% \addbibresource{literature-review-topic1.bib}
% \addbibresource{literature-review-topic2.bib}
% 
% \begin{document}
% 
% \printcoverpage
% 
% \printfrontmatter
% 
% % INTRODUCTION
% \startintroduction 
% 
% Write your introduction here.
% 
% % CHAPTER
% \chapter{A first chapter}
% \label{ch:chapterone}
%
% My chapter 1.
% 
% % CONCLUSION
% \startconclusion
% 
% The conclusion.
% 
% % BACKMATTER
% \listoftables
% \listoffigures
% 
% % Bibliography (at the end)
% \newpage
% \printbibliography
% 
% \end{document}
% \end{verbatim}
%
% \section{Implementation}
% \label{sec:implementation}
%
% In this Section the full code of the |gsemthesis| is discussed. The reader interested in customizing the class will find useful comments to understand the design of the class.
%
% \subsection{Document properties}
% \label{sec:classdef}
%
% The class is derived from the standard |book| class as follows:
%    \begin{macrocode}
\LoadClass[a4paper,12pt,twoside]{book}
%    \end{macrocode}%
% We set the document encoding to UTF-8
%    \begin{macrocode}
\usepackage[utf8]{inputenc}
%    \end{macrocode}%
% We use the |lmodern| vectorial fonts to render the document.
%    \begin{macrocode}
\usepackage{lmodern}
%    \end{macrocode}
% We use the |etoolbox| package for defining class options (fr, draft)
%    \begin{macrocode}
\usepackage{etoolbox}
%    \end{macrocode}%
% We add the option \emph{fr}
%    \begin{macrocode}
\newtoggle{fr}
\DeclareOption{fr}{\toggletrue{fr}}
%    \end{macrocode}%
% We add the option \emph{draft}
%    \begin{macrocode}
\newtoggle{draft}
\DeclareOption{draft}{\toggletrue{draft}}
%    \end{macrocode}%
% We add the option \emph{custombib}
%    \begin{macrocode}
\newtoggle{custombib}
\DeclareOption{custombib}{\toggletrue{custombib}}
%    \end{macrocode}%
% The recommended page format is A4. The B5 page format is given in option.
%    \begin{macrocode}
\DeclareOption{b5paper}{
  \PassOptionsToClass{\CurrentOption}{book}
}
%    \end{macrocode}%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}%
% We use the |geometry| package to set margin properties
%    \begin{macrocode}
\RequirePackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}
%    \end{macrocode}
% We use the || package to handle some specific text spacing (title)
%    \begin{macrocode}
\usepackage{setspace}
%    \end{macrocode}
%
% \subsection{Colors}
% We define some nice colors that will be later used for links (url, email, citations, etc.). The |gsemblue| color is the official color (to date 2014.02.20) of the GSEM Faculty.
%    \begin{macrocode}
\usepackage{xcolor}
\definecolor{erblue}{HTML}{126199}
\definecolor{erorange}{HTML}{FF7F00}
\definecolor{gsemblue}{HTML}{465F7F}
%    \end{macrocode}
% \subsection{Graphics}
% We add some practical packages to handle several image files (.png, .pdf), handle placement of graphics, and handle subfigures
%    \begin{macrocode}
\usepackage[final]{graphicx}
\usepackage{float}
\usepackage{subfigure}
%    \end{macrocode}
% \subsection{Link management}
% We use the |hyperref| package to manage internal links and set colors for each link type.
%    \begin{macrocode}
\RequirePackage{hyperref}
% \hypersetup{%
% colorlinks=true,%
% linkcolor=black,%
% filecolor=gsemblue,%
% citecolor=gsemblue,%
% urlcolor=gsemblue%
% }%
\hypersetup{
  colorlinks=true,
  linkcolor=black,
  filecolor=erblue,
  citecolor=erblue,
  urlcolor=erblue,
  final
}
%    \end{macrocode}
% We use the |url| package for a complete support of external links and define a nice font style.
%    \begin{macrocode}
\RequirePackage{url}
\urlstyle{sf}
%    \end{macrocode}
% \subsection{Maths}
% We add standard packages from the American Mathematical Society to handle mathematical symbols, environment (equations, etc.) and the Computer Modern font use by default to render math.
%    \begin{macrocode}
\usepackage{amssymb,amsmath,amsfonts}
%    \end{macrocode}
% \subsection{Page headers management}
% We use the |fancyhdr| package for a fine tuning of headers and footers of the different page type (cover page, chapters, unumbered chapters, etc.).
%    \begin{macrocode}
\usepackage{fancyhdr}
%    \end{macrocode}
% The capital letters given in option of |\fancyhead| or |\fancyfoot| commands respectively stands for:
% \begin{itemize*}
%   \item E: Even page
%   \item O: Odd page
%   \item L: Left field
%   \item C: Center field
%   \item R: Right field
%   \item H: Header
%   \item F: Footer
% \end{itemize*}
% We set the |fancy| page style (default page style) as follows:
%    \begin{macrocode}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LO]{\nouppercase{\rightmark}}
\fancyhead[RO]{\thepage}
\fancyfoot[LE,RO]{}
%    \end{macrocode}
% We reset the |plain| style
%    \begin{macrocode}
\fancypagestyle{plain}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[LE,RO]{}
}
%    \end{macrocode}
% We define a style for the cover page (actually not used)
%    \begin{macrocode}
\fancypagestyle{cover}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0.5pt}
  \renewcommand{\footrulewidth}{0.5pt}
}
%    \end{macrocode}
% We define a style for unumbered chapters (starred chapters)
%    \begin{macrocode}
\fancypagestyle{unnumberedchapter}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  \fancyhead[LE]{\thepage}
  \fancyhead[RE]{}
  \fancyhead[LO]{}
  \fancyhead[RO]{\thepage}
  \fancyfoot[LE,RO]{}
}
%    \end{macrocode}
% When a new chapter starts on a odd number, we add a blank page to force it to start to a even number. We define an empty style for this blank page
%    \begin{macrocode}
\fancypagestyle{empty}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[LE,RO]{}
}
%    \end{macrocode}
% Then we apply the empty style to odd page before a new chapter
%    \begin{macrocode}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}
    \thispagestyle{empty}
    \newpage
    \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\clearpage{\pagestyle{empty}\cleardoublepage}
%    \end{macrocode}
% We define the default language of the document.
%    \begin{macrocode}
\iftoggle{fr}{
  \usepackage[francais]{babel}
  \usepackage[T1]{fontenc}
}{
  \usepackage[english]{babel}
}
%    \end{macrocode}
% This package provides the commands |\og| and |\fg| for correctly handling French quotes.
%    \begin{macrocode}
\usepackage{csquotes}
%    \end{macrocode}
% We define the date format for the cover page (non-draft mode).
%    \begin{macrocode}
\usepackage{datetime}
\newdateformat{monthyeardate}{\monthname[\THEMONTH] \THEYEAR}
%    \end{macrocode}
%
% \subsection{Bibliography management}
% We use biblatex/biber to process the bibliography with the following settings: (1) citations with more than two authors will always be writen as ``First author et al.'', (2) this ``et al.'' rule is applied even if it leads to ambiguities between long list of authors with the same first author. 
%    \begin{macrocode}
\iftoggle{custombib}{}{
  \usepackage[backend=biber,natbib=true,style=authoryear-comp,sorting=nymdt,%
  maxbibnames=99,mincitenames=1,maxcitenames=2,uniquelist=false]{biblatex}
}
%    \end{macrocode}
% We use the style authoryear to print authors and the year when citing a document in the text. We define a customized sorting style to sort the list of references (printed at the end of the document) according to this (ordered) attributes: name, year, month, day, and title.
% We define the following sorting scheme:
%    \begin{macrocode}
\iftoggle{custombib}{}{
  \DeclareSortingScheme{nymdt}{
    \sort{
      \field{presort}
    }
    \sort[final]{
      \field{sortkey}
    }
    \sort{
      \name{sortname}
      \name{author}
      \name{editor}
      \name{translator}
      \field{sorttitle}
      \field{title}
    }
    \sort{
      \field{sortyear}
      \field{year}
    }
    \sort{
      \field[padside=left,padwidth=2,padchar=0]{month}
      \literal{00}
    }
    \sort{
      \field[padside=left,padwidth=2,padchar=0]{day}
      \literal{00}
    }
    \sort{
      \field{sorttitle}
    }
    \sort{
      \field[padside=left,padwidth=4,padchar=0]{volume}
      \literal{0000}
    }
  }
}
%    \end{macrocode}
% \subsection{Cover page}
% \subsubsection{System-level functions}
%  The following commands define labels for the different parts of the cover page
%    \begin{macrocode}
\def\theFaculty{Geneva School of Economics and Management}

\def\thesisLocationLabel{
  ~ \\[0.4em]%
  \iftoggle{fr}{
    Une thèse soumise à la\\[0.2em]
    \theFaculty\\[0.2em]
    Université de Genève, Suisse,\\[0.2em]
    pour l'obtention du\\[0.2em]
  }{
    A thesis submitted to the\\[0.2em]
    \theFaculty, \\[0.2em]
    University of Geneva, Switzerland,\\[0.2em]
    in fulfillment of the requirements for the degree of\\[0.2em]
  }
}

\iftoggle{fr}{
  \def\thesisByLabel{par}
}{
  \def\thesisByLabel{by}
}
\iftoggle{fr}{
  \def\thesisFieldLabel{Doctorat en}
}{
  \def\thesisFieldLabel{PhD in}
}
\iftoggle{fr}{
  \def\thesisCommitteeLabel{Membres du jury:}
}{
  \def\thesisCommitteeLabel{Members of the thesis committee:}
}
\iftoggle{fr}{
  \def\thesisNumberLabel{Thèse no.}
}{
  \def\thesisNumberLabel{Thesis No.}
}

%    \end{macrocode}
%
%
% \subsubsection{User-level functions}
% 
% Set up of the cover page and assimilated functions.
%
% \begin{macro}{\authorFirstname}
% Set up the |\theauthorFirstname| variable.
%    \begin{macrocode}
\def\theauthorFirstname{}
\newcommand{\authorFirstname}[1]{\def\theauthorFirstname{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\authorLastname}
% Set up the |\theauthorLastname| variable.
%    \begin{macrocode}
\def\theauthorLastname{}
\newcommand{\authorLastname}[1]{\def\theauthorLastname{\textsc{#1}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisField}
% Set up the |\thethesisField| variable.
%    \begin{macrocode}
\def\thethesisField{}
\newcommand{\thesisField}[1]{\def\thethesisField{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisCommitteeA}
% Set up the |\thethesisCommitteeA| variable.
%    \begin{macrocode}
\def\thethesisCommitteeA{}
\newcommand{\thesisCommitteeA}[4]{%
\ifx&#3&%
  \def\thethesisCommitteeA{}%
\else
  \def\thethesisCommitteeA{#1~#2~\textsc{#3},~#4}%
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisCommitteeB}
% Set up the |\thethesisCommitteeB| variable.
%    \begin{macrocode}
\def\thethesisCommitteeB{}
\newcommand{\thesisCommitteeB}[4]{%
\ifx&#3&%
  \def\thethesisCommitteeB{}%
\else
  \def\thethesisCommitteeB{#1~#2~\textsc{#3},~#4}%
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisCommitteeC}
% Set up the |\thethesisCommitteeC| variable.
%    \begin{macrocode}
\def\thethesisCommitteeC{}
\newcommand{\thesisCommitteeC}[4]{%
\ifx&#3&%
  \def\thethesisCommitteeC{}%
\else
  \def\thethesisCommitteeC{#1~#2~\textsc{#3},~#4}%
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisCommitteeD}
% Set up the |\thethesisCommitteeD| variable.
%    \begin{macrocode}
\def\thethesisCommitteeD{}
\newcommand{\thesisCommitteeD}[4]{%
\ifx&#3&%
  \def\thethesisCommitteeD{}%
\else
  \def\thethesisCommitteeD{#1~#2~\textsc{#3},~#4}%
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisCommitteeE}
% Set up the |\thethesisCommitteeE| variable.
%    \begin{macrocode}
\def\thethesisCommitteeE{}
\newcommand{\thesisCommitteeE}[4]{%
\ifx&#3&%
  \def\thethesisCommitteeE{}%
\else
  \def\thethesisCommitteeE{#1~#2~\textsc{#3},~#4}%
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisCommitteeF}
% Set up the |\thethesisCommitteeF| variable.
%    \begin{macrocode}
\def\thethesisCommitteeF{}
\newcommand{\thesisCommitteeF}[4]{%
\ifx&#3&%
  \def\thethesisCommitteeF{}%
\else
  \def\thethesisCommitteeF{#1~#2~\textsc{#3},~#4}%
\fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thesisNumber}
% Set up the |\thethesisNumber| variable.
%    \begin{macrocode}
\def\thethesisNumber{}
\newcommand{\thesisNumber}[1]{\def\thethesisNumber{#1}}
%    \end{macrocode}
% \end{macro}
% The cover page is created with the following code
% \begin{macro}{\printcoverpage}
% Print the cover page of the thesis.
%    \begin{macrocode}
\newcommand{\printcoverpage}{%
  \thispagestyle{empty}
  \begin{center}
  \rule{\linewidth}{0.4pt}
  
  \vspace*{1.2cm}
  
  {\huge
    {\scshape
      \begin{spacing}{0.8}
        \@title
      \end{spacing}
    }
  }
  
  \vspace*{1.2cm}
  
  \thesisByLabel
  
  \vspace*{0.4cm}
  
  {\large \theauthorFirstname~\theauthorLastname}
    
  \vspace*{0.8cm}
  
  \thesisLocationLabel
  \thesisFieldLabel{~}\thethesisField
  
  \vfill
  
  \iftoggle{draft}{
    \iftoggle{fr}{
      \emph{Ébauche}
    }{
      \emph{Draft}
    }
  }
  
  \iftoggle{draft}{~}{
    \vspace*{0.8cm}
    
    \thesisCommitteeLabel
  }

  \vspace*{0.2em}
  
  \iftoggle{draft}{~}{\thethesisCommitteeA}
  
  \vspace*{0.2em}
  
  \iftoggle{draft}{~}{\thethesisCommitteeB}
  
  \vspace*{0.2em}
  
  \iftoggle{draft}{~}{\thethesisCommitteeC}
  
  \vspace*{0.2em}
  
  \iftoggle{draft}{~}{\thethesisCommitteeD}
  
  \vspace*{0.2em}
  
  \iftoggle{draft}{~}{\thethesisCommitteeE}
  
  \vspace*{0.2em}
  
  \iftoggle{draft}{~}{\thethesisCommitteeF}
  
  \vspace*{1.4cm}  
  
  \iftoggle{draft}{~}{\thesisNumberLabel{~}\thethesisNumber}
  
  \vspace*{0.1cm}
  
  \iftoggle{draft}{\@date}{\monthyeardate\today}
  
  \vspace*{0.1cm}
  
  \rule{\linewidth}{0.4pt}
  \end{center}
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Front matter}
%
% \begin{macro}{\acknowledgements}
% Set up the |\theacknowledgements| variable.
%    \begin{macrocode}
\def\theacknowledgements{}
\newcommand{\acknowledgements}[1]{\def\theacknowledgements{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\abstractEN}
% Set up the |\theabstractEN| variable.
%    \begin{macrocode}
\def\theabstractEN{}
\newcommand{\abstractEN}[1]{\def\theabstractEN{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\abstractFR}
% Set up the |\theabstractFR| variable.
%    \begin{macrocode}
\def\theabstractFR{}
\newcommand{\abstractFR}[1]{\def\theabstractFR{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dedication}
% Set up the |\thededication| variable.
%    \begin{macrocode}
\def\thededication{}
\newcommand{\dedication}[1]{\def\thededication{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\printfrontmatter}
% The front matter pages are created with the following code
%    \begin{macrocode}
\newcommand{\printfrontmatter}{%
  
  \iftoggle{draft}{~}{
    \frontmatter
    
    \iftoggle{fr}{
      \chapter*{Remerciements}
      \addcontentsline{toc}{chapter}{Remerciements}
    }{
      \chapter*{Acknowledgements}
      \addcontentsline{toc}{chapter}{Acknowledgements}
    }
    \label{ch:acknowledgements}
    \thispagestyle{plain}
    \theacknowledgements
    
    \newpage
    
    \iftoggle{fr}{
      \chapter*{Résumé}
      \addcontentsline{toc}{chapter}{Résumé}
      \label{ch:abstractFR}
      \thispagestyle{plain}
      \theabstractFR
      
      \newpage
      
      \chapter*{Abstract}
      \addcontentsline{toc}{chapter}{Abstract}
      \label{ch:abstractEN}
      \thispagestyle{plain}
      \theabstractEN
    }{
      \chapter*{Abstract}
      \addcontentsline{toc}{chapter}{Abstract}
      \label{ch:abstractEN}
      \thispagestyle{plain}
      \theabstractEN
      
      \newpage
      
      \chapter*{Résumé}
      \addcontentsline{toc}{chapter}{Résumé}
      \label{ch:abstractFR}
      \thispagestyle{plain}
      \theabstractFR
    }
  }
  
  \tableofcontents
  
  \iftoggle{draft}{~}{
    \cleardoublepage
    
    \thispagestyle{plain}
    
    \vspace*{4cm}
    {\em
    \raggedleft\thededication\par
    }
    
    \newpage
  }
  
  \mainmatter
}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Introduction and conclusion starter}
%
% \begin{macro}{\startintroduction}
% The front matter pages are created with the following code
%    \begin{macrocode}
\newcommand{\startintroduction}{%
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
\label{ch:introduction}
\markboth{}{Introduction}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\startconclusion}
% The front matter pages are created with the following code
%    \begin{macrocode}
\newcommand{\startconclusion}{%
\chapter*{Conclusion}
\addcontentsline{toc}{chapter}{Conclusion}
\label{ch:conclusion}
\markboth{}{Conclusion}
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Miscellaneous}
% \begin{environment}{itemize*}
% A narrowed version of the |itemize| environment.
% implementation here.
%    \begin{macrocode}
\newenvironment{itemize*}%
  {\vspace{-2mm}\begin{itemize}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{0pt}%
  }%
  {\end{itemize}\vspace{-2mm}%
  }
%    \end{macrocode}
% \end{environment}
%
% \Finale
\endinput