%%
%% This is file `hecthese.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hecthese.dtx  (with options: `class')
%% 
%% This is a stripped version of the original file.
%% 
%% Copyright 2017-2026 HEC Montreal
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Benoit Hamel
%% <benoit.2.hamel@hec.ca>.
%% 
%% This work consists of the files hecthese.dtx, hecthese-fr.ins,
%% hecthese-en.ins, hecthese.pdf, hecthese-en.pdf
%% and the derived files listed in the README file.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{hecthese}[2026/04/20 v3.0 Class for dissertations and theses at HEC Montreal]
%% --- Booleans ----------------------------------

\RequirePackage{etoolbox}
\newbool{HEC@legacy}
\newbool{HEC@phd}
\newbool{HEC@articlebased}

%% --- Class options -----------------------------

\DeclareOption{10pt}{%
\PassOptionsToClass{10pt}{memoir}
}
\DeclareOption{11pt}{%
\PassOptionsToClass{11pt}{memoir}
}
\DeclareOption{12pt}{%
\PassOptionsToClass{12pt}{memoir}
}
\DeclareOption{legacy}{%
\booltrue{HEC@legacy}
}
\DeclareOption{msc}{%
\boolfalse{HEC@phd}
}
\DeclareOption{phd}{%
\booltrue{HEC@phd}
}
\DeclareOption{monograph}{%
\boolfalse{HEC@articlebased}
}
\DeclareOption{articles}{%
\booltrue{HEC@articlebased}
}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
\ExecuteOptions{10pt} % Default font size
\ProcessOptions\relax
\LoadClass{memoir}
\@ifclasslater{memoir}{2025/10/02}{}{%
\ClassError{hecthese}{%
Outdated version of class memoir: \memversion
}{%
Please update the memoir class version to version 2025/10/02 v3.8.4
or later.
}
}
%% --- Required packages -------------------------

\RequirePackage{xkeyval}
\RequirePackage{amsmath}
\RequirePackage{mathtools}
\ifbool{HEC@legacy}{% true
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
}{% false
\RequirePackage{fontspec}
\RequirePackage{unicode-math}
}
\RequirePackage{babel}
\RequirePackage{csquotes}
 % Mandatory for the acronyms list's customization
\RequirePackage{calc}
 % Mandatory for the acronyms list's customization
\RequirePackage{enumitem}
%% --- Layout ------------------------------------

%% ------ Margins --------------------------------

\setlrmarginsandblock{4cm}{2.5cm}{*}
\setulmarginsandblock{2.5cm}{2.5cm}{*}
\checkandfixthelayout[fixed] % Fixed algorithm for fixed margins
%% ------ Line and paragraph spacing -------------

\OnehalfSpacing
\setlength{\parskip}{.5\baselineskip}
\setlength{\parindent}{0pt}
%% ------ Fonts ----------------------------------

\ifbool{HEC@legacy}{% true
%% Computer Modern for text, mathptmx for maths
\RequirePackage{mathptmx}
}{% false
%% Managed by fontspec
%% TeX Gyre fonts are available across all TeX Live distros and Overleaf
\setmainfont{TeX Gyre Termes}
\setsansfont{TeX Gyre Adventor}
\setmonofont{TeX Gyre Cursor}
\setmathfont{TeX Gyre Termes Math} % from the unicode-math pkg
}
%% \DescribeMacro{\setmainfont}
%% --- Thesis metadata ---------------------------

\newcommand{\thesubtitle}{}
\newcommand{\thesissubtitle}[1]{%
\renewcommand{\thesubtitle}{#1}
}

\newcommand{\thespecialization}{}
\newcommand{\specialization}[1]{%
\renewcommand{\thespecialization}{#1}
}

\newcommand{\theyear}{}
\newcommand{\copyrightyear}[1]{%
\renewcommand{\theyear}{#1}
}
%% ------ Key-values for jury list ---------------

\newbool{HEC@islastjury}
\define@boolkey{HEC@jury}{last}[false]{%
\ifKV@HEC@jury@last
\booltrue{HEC@islastjury}
\else
\boolfalse{HEC@islastjury}
\fi
}
\newcommand{\HEC@jurygender}{}
\define@choicekey{HEC@jury}{gender}{M,F}[M]{%
\renewcommand{\HEC@jurygender}{#1}
}
%% ------ M.Sc. Director ------------------------------

\newcommand{\themscdirector}{}
\newcommand{\mscdirector}[2][]{%
\setkeys{HEC@jury}{gender=M,#1}
\renewcommand{\themscdirector}{%
#2 \\ % Name
HEC Montréal \\
Direct\ifdefstring{\HEC@jurygender}{F}{rice}{eur} de recherche%
}
}
%% ------ Jury list ------------------------------

\newcommand{\phddirector}[2][]{%
\setkeys{HEC@jury}{gender=M,last=false,#1}
#2 \\ % Name
HEC Montréal \\
Direct\ifdefstring{\HEC@jurygender}{F}{rice}{eur} de recherche%
\ifbool{HEC@islastjury}{}{\vfill}
}

\newcommand{\phdpresidentrapporteur}[2][]{%
\setkeys{HEC@jury}{gender=M,last=false,#1}
#2 \\ % Name
HEC Montréal \\
\ifdefstring{\HEC@jurygender}{F}{Présidente-rapportrice}%
{Président-rapporteur}
\ifbool{HEC@islastjury}{}{\vfill}
}

\newcommand{\phdcodirector}[3][]{%
\setkeys{HEC@jury}{gender=M,last=false,#1}
#2 \\ % Name
\ifstrempty{#3}{HEC Montréal}{#3} \\ % Affiliation
Codirect\ifdefstring{\HEC@jurygender}{F}{rice}{eur} de recherche
\ifbool{HEC@islastjury}{}{\vfill}
}

\newcommand{\phdjurymember}[3][]{%
\setkeys{HEC@jury}{gender=M,last=false,#1}
#2 \\ % Name
\ifstrempty{#3}{HEC Montréal}{#3} \\ % Affiliation
Membre du jury
\ifbool{HEC@islastjury}{}{\vfill}
}

\newcommand{\phdexternalexaminator}[3][]{%
\setkeys{HEC@jury}{gender=M,last=false,#1}
#2 \\ % Name
\ifstrempty{#3}{HEC Montréal}{#3} \\ % Affiliation
Examinat\ifdefstring{\HEC@jurygender}{F}{rice}{eur} externe
\ifbool{HEC@islastjury}{}{\vfill}
}

\newcommand{\phddirectorrep}[2][]{%
\setkeys{HEC@jury}{gender=M,last=false,#1}
#2 \\
HEC Montréal \\
Représentant\ifdefstring{\HEC@jurygender}{F}{e}{} du directeur de HEC
Montréal
\ifbool{HEC@islastjury}{}{\vfill}
}
%% --- Thesis parts ------------------------------

%% ------ Innerpage ------------------------------

\newcommand{\frontinnerpage}{%
\pagenumbering{Alph} % prevents warnings from hyperref package
\pagestyle{empty}
\mbox{}
\cleardoublepage
}
%% ------ Title pages ----------------------------

\newcommand{\msctitlepage}{%
\frontinnerpage
\setcounter{page}{1}
\begin{titlingpage*}
\centering
\begin{SingleSpace}
{\Large HEC MONTRÉAL}
\vfill
{\bfseries
\thetitle
\ifdefempty{\thesubtitle}{\\[12pt]}{~: \thesubtitle \\[12pt]}
par \\[12pt]
\theauthor
\vfill
Sciences de la gestion \\
(Spécialisation \thespecialization)
}
\vfill
{\itshape
Mémoire présenté en vue de l'obtention \\
du grade de maîtrise ès sciences \\
(M. Sc.)
}
\vfill
\themscdirector
\vfill
\thedate \\
\copyright\ \theauthor, \theyear
\end{SingleSpace}
\end{titlingpage*}
}
\newcommand{\phdtitlepage}{%
\frontinnerpage
\setcounter{page}{1}
\begin{titlingpage*}
\centering
\begin{SingleSpace}
{\Large HEC MONTRÉAL} \\
École affiliée à l'Université de Montréal
\vfill
{\bfseries
\thetitle\ifdefempty{\thesubtitle}{}{~: \\ \thesubtitle}
\vfill
par \\
\theauthor
\vfill
Thèse présentée en vue de l'obtention du grade de Ph.D.
en administration \\
(Spécialisation \thespecialization)
\vfill
\thedate
}
\vfill
\copyright\ \theauthor, \theyear
\end{SingleSpace}
\end{titlingpage*}
}
\newcommand{\thejury}{}
\newcommand{\phdjurylist}[1]{%
\renewcommand{\thejury}{#1}
}
\newcommand{\phdjurypage}{%
\begin{titlingpage*}
\centering
\begin{SingleSpace}
{\Large HEC MONTRÉAL} \\
École affiliée à l'Université de Montréal
\vfill
Cette thèse intitulée :
\vfill
{\bfseries
\thetitle\ifdefempty{\thesubtitle}{}{\\ \thesubtitle}
}
\vfill
Présentée par
\vfill
\textbf{\theauthor}
\vfill
a été évaluée par un jury composé des personnes suivantes :
\vfill
\thejury
\end{SingleSpace}
\end{titlingpage*}
}
\newcommand{\titlepageblock}{%
\settitlingpagenumbering{\roman}
\ifbool{HEC@phd}{%
\phdtitlepage
\phdjurypage
}{%
\msctitlepage
}
\frontmatter*
\pagenumbering*{roman}
\pagestyle{plain}
}
%% ------ Abstracts ------------------------------

\renewcommand{\absnamepos}{flushleft}
\renewcommand{\abstractnamefont}{\chapnamefont}
\renewcommand{\abstracttextfont}{\normalfont}
\setlength{\absleftindent}{\parindent}
\setlength{\absrightindent}{\parindent}
\setlength{\abstitleskip}{\afterchapskip}
%% ------ Sectional divisions --------------------

\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}

%% ------ Table of contents ----------------------

\settocdepth{subsection}
\addto\captionsenglish{%
\renewcommand{\contentsname}{Table of Contents}
}

\define@boolkey{HEC@dedication}{signed}[true]{}

\epigraphtextposition{flushleftright}
\setlength{\epigraphrule}{0pt}
\newcommand{\dedication}[2][]{%
\setkeys{HEC@dedication}{signed=true,#1}
\begin{vplace}
\epigraph{#2}{\ifKV@HEC@dedication@signed\theauthor\fi}
\end{vplace}
}


\addto\captionsfrench{%
\renewcommand{\listfigurename}{Liste des figures}
}


\newcommand{\acronymslisttitle}{}
\addto\captionsfrench{%
\renewcommand{\acronymslisttitle}{Liste des abréviations}
}
\addto\captionsenglish{%
\renewcommand{\acronymslisttitle}{List of Acronyms}
}


\newcommand{\acknowledgementstitle}{}
\addto\captionsfrench{%
\renewcommand{\acknowledgementstitle}{Remerciements}
}
\addto\captionsenglish{%
\renewcommand{\acknowledgementstitle}{Acknowledgements}
}


\newcommand{\prefacetitle}{}
\addto\captionsfrench{%
\renewcommand{\prefacetitle}{Avant-propos}
}
\addto\captionsenglish{%
\renewcommand{\prefacetitle}{Preface}
}

\newcommand{\introductiontitle}{Introduction}
\ifbool{HEC@articlebased}{%
\addto\captionsfrench{%
\renewcommand{\introductiontitle}{Introduction générale}
}
\addto\captionsenglish{
\renewcommand{\introductiontitle}{General Introduction}
}
}{}


\newcommand{\theoreticalframeworktitle}{}
\addto\captionsfrench{%
\renewcommand{\theoreticalframeworktitle}{Cadre théorique général}
}
\addto\captionsenglish{%
\renewcommand{\theoreticalframeworktitle}{Theoretical Framework}
}


\newcommand{\literaturereviewtitle}{}
\addto\captionsfrench{%
\renewcommand{\literaturereviewtitle}{Revue de littérature}
}
\addto\captionsenglish{%
\renewcommand{\literaturereviewtitle}{Literature Review}
}


\newcommand{\articleabstract}{}
\addto\captionsfrench{%
\renewcommand{\articleabstract}{Résumé}
}
\addto\captionsenglish{%
\renewcommand{\articleabstract}{Abstract}
}

\newcommand{\conclusiontitle}{Conclusion}
\ifbool{HEC@articlebased}{%
\addto\captionsfrench{%
\renewcommand{\conclusiontitle}{Conclusion générale}
}
\addto\captionsenglish{%
\renewcommand{\conclusiontitle}{General Conclusion}
} 
}{}

\newcommand{\bibliotitle}{\bibname}
\ifbool{HEC@articlebased}{%
\addto\captionsfrench{%
\renewcommand{\bibliotitle}{\bibname\ générale}
}
\addto\captionsenglish{%
\renewcommand{\bibliotitle}{General \bibname}
} 
}{}

\newcommand{\referencestitle}{}
\addto\captionsfrench{%
\renewcommand{\referencestitle}{Références}
}
\addto\captionsenglish{%
\renewcommand{\referencestitle}{References}
}
\endinput
%%
%% End of file `hecthese.cls'.
