liathesis.cls 15.2 KB
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% liathesis class
%
% Mayeul Mathias 2018
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}


% class options
\RequirePackage{xkeyval}                        % options parsing
\RequirePackage{xstring}                        % string comparison

% option to select the main language of the document (allows french and english)
\global\def\@DocumentLang{}%
\DeclareOptionX{lang}{%
 \IfEqCase{#1}{%
  {french}{%
    \global\def\@DocumentLang{french}%
   }%
   {english}{%
    \global\def\@DocumentLang{english}%
   }%
 }[\ClassError{liathesis}{Invalid language (french and english supported): '#1'}]%
}

\global\def\@DocumentMode{}%
\DeclareOptionX{mode}{%
 \IfEqCase{#1}{%
  {draft}{%
    \global\def\@DocumentMode{draft}%
   }%
   {final}{%
    \global\def\@DocumentMode{final}%
   }%
 }[\ClassError{liathesis}{Invalid mode (draft and final supported): '#1'}]
}

\global\def\@DocumentFontSize{}%
\DeclareOptionX{size}{%
 \global\def\@DocumentFontSize{#1}%
}

\DeclareOptionX*{\ClassWarning{`\CurrentOption' ignored}} % warning on unknown options


\ExecuteOptionsX{                               % default options
 lang=french,size=12pt,mode=final%
}
\ProcessOptionsX{}\relax{}                      % parses options

% base class and encoding
\ProvidesClass{core/liathesis}[2019/10/01]
\LoadClass[
 a4paper, twoside,%
 \@DocumentFontSize%,
 %\@DocumentMode%
]{book}                                         % base class
\let\@DocumentFontSize\undefined

\RequirePackage[utf8]{inputenc}				    % use source file containing diacritics
\RequirePackage[T1]{fontenc}				    % select font encoding and allow hyphenation
\RequirePackage[%
 french, english,
 main=\@DocumentLang
]{babel}                                       % multi languages support
\RequirePackage{xspace}                        % recommanded with frenchb (spaces after \ier etc.)

% geometry and general page layout
\def\@GeometryShowFrame{false}
\IfStrEq{\@DocumentMode}{draft}{%
 \def\@GeometryShowFrame{true}%
 \RequirePackage{layout}
}{}
\RequirePackage[showframe=\@GeometryShowFrame]{geometry}
\let\@GeometryShowFrame\undefined

\RequirePackage{fancyhdr}                       % formatting of headers and footers
\RequirePackage{setspace}                       % control space between lines
\RequirePackage[autostyle=true]{csquotes}       % improves quotes rendering

\geometry{%                                     % default geometry
 a4paper, twoside,
 headheight=15mm,
 width=140mm,
 top=25mm,
 bottom=25mm,
 bindingoffset=6mm
}
\pagestyle{plain}                               % default page style

\RequirePackage[                                % Generates links in PDF file (recommended to be last loaded package)
 hypertexnames=true                              % Allows to reset counters without messing with hyperlinks
]{hyperref}
\RequirePackage{bookmark}                       % Improves performances for hyperref

% TODO: Replace with titletoc or etoc
\RequirePackage{minitoc}                        % allows to display a toc at each chapter
\mtcsetdepth{minitoc}{2}                        % displays up to subsections
\setlength{\mtcindent}{10pt}                    % allows longer titles

\renewcommand{\cleardoublepage}{%               % from fancyhdr (set clear pages empty)
 \clearpage%
 \if@twoside%
  \ifodd\c@page%
  \else%
   \hbox{}%
   \thispagestyle{empty}%
   \newpage%
   \if@twocolumn%
    \hbox{}%
    \newpage%
   \fi%
  \fi%
 \fi%
}

% Sectionning
%\RequirePackage{sectsty}

% Add part
\newcommand{\@ThesisPartNoStar}[1]{%
 \part{#1}%
}

\newcommand{\@ThesisPartStar}[1]{%
 \part*{%
  #1%
  %\phantomsection{}%
 }%
 \addcontentsline{toc}{part}{#1}%
}

% Add chapter (with or without toc)
\define@boolkey{CHAPTER}{toc}[true]{}
\newcommand{\@ThesisChapterNoStar}[2][toc=true]{%
 \setkeys{CHAPTER}{#1}%
 \chapter{#2}%
 \ifKV@CHAPTER@toc%
  \minitoc%
 \fi%
}

\newcommand{\@ThesisChapterStar}[1]{
 \chapter*{#1}
 \addcontentsline{toc}{chapter}{#1}
 \adjustmtc
}

\newcommand{\@ThesisSectionNoStar}[1]{\section{#1}}
\newcommand{\@ThesisSectionStar}[1]{
 \section*{#1}
 \addcontentsline{toc}{section}{#1}
 %\adjuststc
}

\newcommand{\@ThesisSubsectionNoStar}[1]{\subsection{#1}}
\newcommand{\@ThesisSubsectionStar}[1]{
 \subsection*{#1}
 \addcontentsline{toc}{subsection}{#1}
}

\newcommand{\AddPart}{\@ifstar\@ThesisPartStar\@ThesisPartNoStar}
\newcommand{\AddChapter}{\@ifstar\@ThesisChapterStar\@ThesisChapterNoStar}
\newcommand{\AddSection}{\@ifstar\@ThesisSectionStar\@ThesisSectionNoStar}
\newcommand{\AddSubsection}{\@ifstar\@ThesisSubsectionStar\@ThesisSubsectionNoStar}
\newcommand{\AddParagraph}[1]{\paragraph{#1} \hspace{0pt} \\}
%\newcommand{\AddParagraph}[1]{\paragraph{#1} \mbox{}}

% Appendices
\RequirePackage[toc,page,title]{appendix}

\renewcommand{\addappheadtotoc}{%
 \phantomsection{}%
 \addcontentsline{toc}{part}{\appendixtocname}%
}

%\newenvironment{Appendices}{%
%\appendix
%\part*{%
%\appendixpagename%
%\phantomsection{}%
%\addcontentsline{toc}{part}{\appendixpagename}%
%}
%\setcounter{chapter}{0}
%\def\thechapter{\Alph{chapter}}
%\renewcommand{\chaptername}{\appendixname}
%}{}

\newcommand{\BlankPage}{%                       % insert blank double page
 \begingroup
 \pagestyle{empty}
 \cleardoublepage
 \null
 \cleardoublepage
 \endgroup
}

% frontcover, backcover and page design
\RequirePackage{tikz}						    % for vector graphics
\usetikzlibrary{positioning} 				    % relative positioning
\usetikzlibrary{calc}                           % extends coordinate calculation
\RequirePackage[useregional]{datetime2}         % date display
%\RequirePackage{mathpazo}                       % Palatino font family (roman)
\RequirePackage{tabularx}                       % tabular spacing
%\RequirePackage{merriweather}

\global\def\@TheSubtitle{}
\newcommand{\subtitle}[1]{%
 \makeatletter%
 \global\def\@TheSubtitle{#1}%
 \makeatother%
}

\renewcommand{\date}[3]{%
 \makeatletter%
 \global\def\@date{\DTMdisplaydate{#1}{#2}{#3}{-1}}%
 \makeatother%
}

\newcommand{\@PrintTitle}{%
 \huge{\@title}%
 \par%
 \ifx\@TheSubtitle\empty%
 \else%
  \vspace{0.5cm}
  \textit{\Large{\@TheSubtitle}}
  \par%
 \fi%
}

% Jury compostion formatting
\define@choicekey*{JURY}{gender}{male,female}{%
 \newcommand{\@TheGender}{\csname gender#1name\endcsname}%
}
\newcommand{\Member}[5][]{%
 %\presetkeys{JURY}{gender=male}{}%
 \setkeys{JURY}{#1}%
 \@TheGender & #2 & #3, #4 & #5\\%
}
\global\def\@TheJury{}
\newcommand{\Jury}[1]{%
 \global\def\@TheJury{%
  \begin{tabularx}{\textwidth}{@{} l l X l @{}}%
   #1%
  \end{tabularx}%
 }%
}

% Abstracts
\global\def\@TheAbstractFr{}
\global\def\@TheAbstractEn{}
\newcommand{\Abstract}[2][\@DocumentLang]{%
 \IfEqCase{#1}{%
  {french}{%
    \global\def\@TheAbstractFr{#2}
   }%
   {english}{%
    \global\def\@TheAbstractEn{#2}
   }%
 }[\ClassError{liathesis}{Invalid language (french and english supported): '#1'}]
}

% Keywords
\global\def\@TheKeywordsFr{}
\global\def\@TheKeywordsEn{}
\newcommand{\Keywords}[2][\@DocumentLang]{%
 \IfEqCase{#1}{%
  {french}{%
    \global\def\@TheKeywordsFr{#2}
   }%
   {english}{%
    \global\def\@TheKeywordsEn{#2}
   }%
 }[\ClassError{liathesis}{Invalid language (french and english supported): '#1'}]
}

\global\def\@TheEndOfDocumentContents{}
\newenvironment{Thesis}[2]{
 \global\def\@TheEndOfDocumentContents{#2}
 \BeginOfDocument{#1}
}{
 \EndOfDocument{\@TheEndOfDocumentContents}
}

% Cover pages design
\newenvironment{@Cover}{%
 % \let\orignewcommand\newcommand%
 % \let\newcommand\renewcommand%
 % \makeatletter%
 % \input{bk10.clo}%
 % \merriweather
 % \makeatother
 % \let\newcommand\orignewcommand
 %\merriweather
 %\renewcommand{\huge}{\Large}%
 %\renewcommand{\large}{\normalsize}%
 %\renewcommand{\normalsize}{\scriptsize}%
 %\fontfamily{ppl}\selectfont
 \newgeometry{%
  noheadfoot,nomarginpar,%
  vmargin=0.5in,%
  hmargin=0.75in%
 }%
 \pagestyle{empty}%
 \begin{spacing}{1.25}%
  }{%
 \end{spacing}%
 \restoregeometry%
}

\newcommand{\@SetMainLayout}{				    % set the document layout with respect to the twoside option
 \fancyhead{}                                % clear all header fields
 \fancyhead[LE]{\nouppercase{\leftmark}}     % right on event pages
 \fancyhead[RO]{\nouppercase{\rightmark}}    % left on odd pages
 \fancyfoot{}                                % clear all footer fields
 \fancyfoot[CE,CO]{\thepage}
 \renewcommand{\headrulewidth}{0.4pt}
 \renewcommand{\footrulewidth}{0pt}
 
 \pagestyle{fancy}
 
 \IfStrEq{\@DocumentMode}{draft}{
  \layout
 }{}
}

% glossaries, appendices, bibliographic and references settings
\RequirePackage{glossaries-extra}               % Loads glossaries
\makeglossaries
\setabbreviationstyle{long-short}
\setabbreviationstyle[acronym]{long-short}

\def\@BibLatexStyle{alphabetic}%
% \def\@BibLatexStyle{authoryear}%
%\def\@BibLatexStyle{authoryear}%
%\IfStrEq{\@DocumentMode}{draft}{%
%    \def\@BibLatexStyle{draft}%
%}{}

\RequirePackage[
 backend=biber,
 maxcitenames=1,
 maxbibnames=99,
 bibstyle=\@BibLatexStyle,
 citestyle=authoryear
]{biblatex}		                    		    % uses biblatex and biber (instead of bibtex)
\let\@BibLatexStyle\undefined

%\RequirePackage[numbers]{natbib}		        % incompatible with biblatex
%\RequirePackage[numbers]{multibib}		        % incompatible with biblatex
\RequirePackage{doi}					        % displays DOIs in the bibliography
%\AtEveryCite{\restorecommand\mkbibnamefamily}	% avoid small caps in citations (French)
%\setlength\bibitemsep{0.9\itemsep}		% reduce space between bibliographic items

% Front cover


\input{firstpage.tex}


\newcommand{\@TitleFooter}{%
 \begin{tikzpicture}[every node/.style={inner sep=0,outer sep=0}]
  \node[anchor=north west] (logo_lia) at (0.1mm,0) {%
  	\fpbl
  } ;
  \node[anchor=north east, align=right] (text_lia) at (\textwidth - 0.1mm, 0) {
  	\fpbr
  	%
   %\normalsize{\textsl{\MakeUppercase{}}}% Anciennement "Laboratoire Informatique d'Avignon
   
  } ;
  \coordinate[draw=none, above=0.2cm of logo_lia.north west] (line_start) ;
  \coordinate[draw=none, above=0.2cm of text_lia.north east] (line_end) ;
  \draw (line_start) -- (line_end);
 \end{tikzpicture}%
}

\newcommand{\@FrontCover}{%
 \cleardoublepage%
 \begin{@Cover}
  \centering
  % header
  \@TitleHeader%
  \par
  \vspace{0.5cm}%
  \textbf{\huge{\MakeUppercase{\thesisname}}}%
  \par%
  \vspace{1cm}%
  \large{\thesisdefenselocation}%
  \par%
  \vspace{0.5cm}%
  \textbf{\normalsize{\MakeUppercase{\thesisspecialtyname}}}%
  \par%
  \vspace{0.5cm}%
  \large{%
   École Doctorale 536 \enquote{Agrosciences \& Sciences}\\%
   Laboratoire Informatique d'Avignon (EA 4128)%
  }%
  \par%
  \vspace{\fill}%
  \vspace{1cm}%
  \@PrintTitle%
  \vspace{1cm}%
  \normalsize{\thesisby}\\%
  \textbf{\large{\@author}}%
  \par%
  \vspace{\fill}%
  \vspace{0.5cm}%
  \begin{scriptsize}%
   \thesisdefensedate{\@date}\\%
   \vspace{0.5cm}%
   \@TheJury%
   \par%
  \end{scriptsize}%
  \vspace{0.5cm}%
  % footer
  \@TitleFooter%
 \end{@Cover}%
 \cleardoublepage%
}

% Back cover
\newcommand{\@BackCover}{%
 \cleardoublepage
 \null
 \thispagestyle{empty}
 \clearpage
 \begin{@Cover}
  \begin{center}%
   \includegraphics[height=1.5cm]{images/avignon_universite_horizontal.jpg}%
   \par%
   \vspace{2cm}%
   \@PrintTitle%
   \vspace{1cm}%
   \normalsize{\thesisby}\\%
   \textbf{\large{\@author}}%
   \par%
  \end{center}%
  \vspace{2cm}%
  \ifx\@TheAbstractFr\empty%
   \ClassWarning{liathesis}{Missing abstract in french}
  \else%
   \noindent
   \begin{otherlanguage}{french}
    \textbf{Résumé~:} \@TheAbstractFr%
   \end{otherlanguage}
   \par
  \fi%
  \medskip%
  \ifx\@TheKeywordsFr\empty%
   \ClassWarning{liathesis}{Missing keywords in french}
  \else%
   \noindent
   \begin{otherlanguage}{french}
    \textbf{Mots-clés~:} \@TheKeywordsFr%
   \end{otherlanguage}%
   \par
  \fi%
  \vspace{1cm}%
  \ifx\@TheAbstractEn\empty%
   \ClassWarning{liathesis}{Missing abstract in english}
  \else%
   \noindent
   \begin{otherlanguage}{english}
    \textbf{Abstract~:} \@TheAbstractEn%
   \end{otherlanguage}
   \par
  \fi%
  \medskip
  \ifx\@TheKeywordsEn\empty%
   \ClassWarning{liathesis}{Missing keywords in english}%
  \else%
   \noindent
   \begin{otherlanguage}{english}%
    \textbf{Keywords~:} \@TheKeywordsEn%
   \end{otherlanguage}%
   \par%
  \fi%
  \vspace{2cm}%
  \vspace{\fill}%
  \begin{center}%
   \includegraphics[height=1.5cm]{images/lia_complet.pdf}%
  \end{center}%
 \end{@Cover}
}

% Bibliography
\newcommand{\personalpublicationsname}{Personal publications}
%\AtDataInput{%                              % Cite all personnal publications
%    \ifkeyword{personal}%
%    {
%        \AtBeginDocument{
%            %\nocite{\thefield{entrykey}}
%        }
%    }%
%    {}%
%}
% Personal publications
\DeclareBibliographyCategory{personal}
\newcommand{\AddPersonalPublication}[1]{%
 \addtocategory{personal}{#1}%
 \nocite{#1}
}

% Begin of document (insert title page and table of contents)
\newcommand{\BeginOfDocument}[1]{%
 \dominitoc                                      % allows to use minitoc
 \dominilof                                      % allows to use minitof
 \dominilot                                      % allows to use minitot
 \pagestyle{plain}%
 \frontmatter%
 \@FrontCover%
 \BlankPage%
 \onehalfspacing%
 \setcounter{page}{1}%
 #1%
 \cleardoublepage%
 \begin{singlespace}%
  \pdfbookmark[chapter]{\contentsname}{toc}%
  \tableofcontents%
 \end{singlespace}%
 \cleardoublepage%
 \mainmatter%
 \@SetMainLayout%
}

% End of document (figures, tables and bibliography)
\newcommand{\EndOfDocument}[1]{
 #1%
 \backmatter%
 \begin{singlespace}%
  
  \cleardoublepage%
  \bookmarksetup{startatroot}%
  \printglossaries%
  
  \cleardoublepage%
  \listoffigures%
  \addcontentsline{toc}{chapter}{\listfigurename}%
  
  \cleardoublepage%
  \listoftables%
  \addcontentsline{toc}{chapter}{\listtablename}%
  
  \cleardoublepage%
  \printbibheading[heading=bibintoc]%
  \printbibliography[heading=subbibintoc, notcategory=personal]%
  \begin{refcontext}[sorting=ynt]%
   \printbibliography[heading=subbibintoc, title=\personalpublicationsname, category=personal]%
  \end{refcontext}%
  \BlankPage%
  \@BackCover%
 \end{singlespace}%
}

% miscellaneous
\RequirePackage{icomma}                         % treats the comma as a digit separator when required

% Translations
\addto\captionsfrench{\renewcommand{\contentsname}{Sommaire}}
\addto\captionsfrench{\renewcommand{\figurename}{Figure}}
\addto\captionsfrench{\renewcommand{\listfigurename}{Liste des figures}}
\addto\captionsfrench{\renewcommand{\listtablename}{Liste des tableaux}}

% Translations for minitoc (uses babel commands instead of mtcselectlanguage)
%\mtcselectlanguage{french}                     % prefer use the babel commands
\renewcommand{\ptctitle}{\contentsname}
\renewcommand{\plftitle}{\listfigurename}
\renewcommand{\plttitle}{\listtablename}
\renewcommand{\mtctitle}{\contentsname}
\renewcommand{\mlftitle}{\figurename}
\renewcommand{\mlttitle}{\tablename}
\renewcommand{\stctitle}{\contentsname}
\renewcommand{\slftitle}{\listoffigures}
\renewcommand{\slttitle}{\listoftables}

% Translations for appendices
\addto\captionsfrench{\renewcommand{\appendixname}{Annexe}}
\addto\captionsfrench{\renewcommand{\appendixtocname}{Annexes}}
\addto\captionsfrench{\renewcommand{\appendixpagename}{\color{cerulean}\Huge\bfseries\sffamily Annexes}}

% Translations for bibliography
\DefineBibliographyStrings{french}{%
 bibliography = {Bibliographie},
 references   = {Ouvrages de référence}
}
\addto\captionsfrench{\renewcommand{\personalpublicationsname}{Publications personnelles}}