%%%% Modèle proposé par frederic.mazaleyrat@ens-paris-saclay.fr %%%%
%%%% 3 avril 2021 %%%%

%%%% Modifié par sergiu.ivanov@universite-paris-saclay.fr pour son
%%%% manuscrit de HDR.
%%%% 5 janvier 2024

\documentclass[12pt,a4paper]{book}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage[dvipsnames]{xcolor}
\definecolor{Prune}{RGB}{99,0,60}
\colorlet{PruneLink}{Prune!70!Blue}
\colorlet{PruneCite}{Prune!60!Red}
\usepackage{mdframed}
\usepackage{multirow} %% Pour mettre un texte sur plusieurs rangées
\usepackage{multicol} %% Pour mettre un texte sur plusieurs colonnes
\usepackage{scrextend} %Forcer la 4eme  de couverture en page pair
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{colortbl}
\usepackage{array}
\usepackage{geometry}
\usepackage[language=english]{lipsum}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{polyglossia}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage[backend=biber,style=numeric,maxbibnames=99,doi=false,url=false,defernumbers=true]{biblatex}
\usepackage{enumitem}
\usepackage{hyperref}

\hypersetup{
  pdfauthor={Sergiu Ivanov},
  pdftitle={Habilitation thesis},
  pdfsubject={The full dossier for Sergiu Ivanov's habilation,
    including a detailed CV and the habilitation thesis.},
  pdfkeywords={
    habilitation,
    cv,
    research,
    teaching,
    natural computing,
    formal languages,
    theoretical biology
  },
  pdfproducer={lualatex},
  pdfcreator={lualatex},
  %
  colorlinks=true,
  urlcolor=PruneLink,
  linkcolor=PruneLink,
  anchorcolor=PruneLink,
  citecolor=PruneCite
}

\setmainfont{Linux Libertine O}
\setmathfont[Scale=MatchUppercase]{libertinusmath-regular.otf}
\setsansfont{Linux Biolinum O}

\setdefaultlanguage{english}
\setotherlanguages{french}


\titleformat{\chapter}[frame]
{\itshape\color{Prune}}
{\filright
  \normalsize
  \enspace Chapter \thechapter\enspace}
{10mm}
{\fontsize{35}{20}\selectfont\normalfont\bfseries\filright\hspace{1ex}}
\titleformat{\section}{\Large\normalfont\bfseries\color{Prune}}{\thesection \hspace{1ex}}{1ex}{}
\titleformat{\subsection}{\large\normalfont\bfseries\color{Prune}}{\thesubsection \hspace{1ex}}{1ex}{}
\titleformat{\subsubsection}{\normalsize\normalfont\bfseries\color{Prune}}{}{1ex}{}

\newcommand{\changelocaltocdepth}[1]{%
  \addtocontents{toc}{\protect\setcounter{tocdepth}{#1}}%
  \setcounter{tocdepth}{#1}%
}

\graphicspath{{pics/}}
\usetikzlibrary{calc}

\newif\ifentiredoc
\entiredoctrue % Use this if you want to compile the entire document.
%\entiredocfalse % Use this if you only want the CV.

\begin{document}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
  \markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\fancyhead[LE,RO]{\textcolor{Prune}{\textsl{\rightmark}}}
\fancyhead[LO,RE]{\textcolor{Prune}{\textsl{\leftmark}}}
\renewcommand{\headrule}{{\color{Prune}\hrule}}

\ifentiredoc

\newgeometry{left=6cm,bottom=2cm,top=1cm,right=1cm}
\setlength{\headheight}{14.89998pt}
\input{title-page}

\newgeometry{top=1.5cm, bottom=1.25cm, left=2cm, right=2cm}
\setlength{\headheight}{14.89998pt}
\input{abstracts}

\fi

\newgeometry{top=2cm, bottom=2cm, left=2cm, right=2cm}
\setlength{\headheight}{14.89998pt}

\ifentiredoc
\tableofcontents

\changelocaltocdepth{0}

\fi

\input{cv}

\ifentiredoc

\changelocaltocdepth{2}

\fi
\end{document}

%%% Local Variables:
%%% TeX-engine: luatex
%%% End:
