spimbasephdthesis.sty 31.7 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 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867
% Document class for the PhD thesis
%
% Copyright (c) 2012-25 Stephane GALLAND <galland@arakhne.org>
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.

%%--------------------
%% Declare the LaTeX class
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{spimbasephdthesis}[2025/06/01]

\RequirePackage{lettrine}
\RequirePackage[export]{adjustbox}

%%--------------------
%% Check for the correct version of tex-upmethodology
\@ifclasslater{UPMVERSION}{2025/04/20}{}{\@latex@error{You must install a version of tex-upmethodology greater or equal to 2025-03-14}\@eha}

%%--------------------
%% Change the default baseline
\renewcommand{\baselinestretch}{1.25} 

%%--------------------
%% Underlining if the author's name (in bibliography)
\newcommand{\underlineifauthor}[2]{%
	\ifdocumentauthor{#1}{\underline{#2}}{#2}%
}

%%--------------------
%% Colors dedicated to the PhD style
\colorlet{standardphdcolor}{black}

%%--------------------
%% Utility functions
\gdef\edspim@phdthesis@class@firstword#1 #2\@nil{#1}
\gdef\edspim@phdthesis@class@nextwords#1 #2\@nil{#2}
\gdef\edspim@phdthesis@class@firstcolumn#1,#2\@nil{#1}
\gdef\edspim@phdthesis@class@nextcolumns#1,#2\@nil{#2}
\gdef\edspim@phdthesis@class@makejury{}
\gdef\edspim@phdthesis@class@addjury#1#2{%
	\addjury%
		{\expandafter\edspim@phdthesis@class@firstword\edspim@phdthesis@class@firstcolumn#2\@nil\@nil}%
		{\expandafter\edspim@phdthesis@class@nextwords\edspim@phdthesis@class@firstcolumn#2\@nil\@nil}%
		{#1}%
		{\edspim@phdthesis@class@nextcolumns#2\@nil}%
}

%%--------------------
% Define the PhD thesis document
%\declarethesis[subtitle]{title}{defense date}{defense location}{ID}
\newcommand{\declarethesis}[5][] {
	\declaredocument{#2}{#1}{#5}%
	\Set{defensedate}{#3}%
	\Set{defenselocation}{#4}%
	\initialversion{\makedate{11}{04}{2006}}{PhD Thesis}{\upmpublic}%
}

%%--------------------
% Define the title in the minor language for PhD thesis document
%\declareminorthesistitle{title}
\newcommand{\declareminorthesistitle}[1] {
	\Set{minorlanguagethesistitle}{#1}%
}

%%--------------------
% Add member of the jury
%\addjury[email]{firstname}{lastname}{role}{position}
\newcommand{\upm@phdthesis@protectnl}[1]{%
	\begingroup%
		\let\\\newline%
		\nohyphens{\Get{jurystyle}#1}%
	\endgroup%
}
\gdef\upm@phdthesis@jurylist{}
\global\let\thejurytab\relax
\newcommand{\addjury}[5][]{%
	\upm@phdthesis@addjuryex{#1}{}{#2}{#3}{#4}{#5}%
}

%%--------------------
% Add member of the jury
%\addjuryex[email]{civility}{firstname}{lastname}{role}{position}
\newcommand{\addjuryex}[6][]{%
	\upm@phdthesis@addjuryex{#1}{#2~}{#3}{#4}{#5}{#6}%
}
\newcommand{\upm@phdthesis@addjuryex}[6]{%
	\global\protected@edef\upm@phdthesis@jurylist{\upm@phdthesis@jurylist\protect\protect\Get{jurystyle}\protect\upm@phdthesis@protectnl{#2}~\protect\protect\upmmakenamestar{#3}{#4}{~} & \protect\upm@phdthesis@protectnl{#6} & \protect\upm@phdthesis@protectnl{#5} \protect\\}%
	\global\protected@edef\thejurytab{\protect\noindent\protect\begin{tabularx}{\Get{jurytabwidth}}{@{}lXl@{}}\upm@phdthesis@jurylist\protect\end{tabularx}}%
}

%%--------------------
% Add affiliation
%\addlaboratory{lab description}
\newif\ifphdthesishaslaboratory
\global\phdthesishaslaboratoryfalse
\newif\ifphdthesishaslaboratorymulti
\global\phdthesishaslaboratorymultifalse
\gdef\thethesislaboratories{}
\newcommand{\addlaboratory}[1]{%
	\ifphdthesishaslaboratory%
		\phdthesishaslaboratorymultitrue%
		\global\protected@edef\thethesislaboratories{\thethesislaboratories,\protect\\\protect{#1}}%
	\else%
		\phdthesishaslaboratorytrue%
		\global\protected@edef\thethesislaboratories{\thethesislaboratories\protect{#1}}%
	\fi%
}
%%--------------------
% Set affiliation logo (only one logo is possible)
%\setlaboratorylogo{lab logo image}
\newif\iflaboratorylogo
\laboratorylogofalse
\let\thethesislaboratorylogo\relax
\newcommand{\setlaboratorylogo}[2][]{%
	\global\laboratorylogotrue%
	\gdef\thethesislaboratorylogo{\raisebox{-.5\height}{\includegraphics[max width=4cm,max height=1.5cm,keepaspectratio,#1]{#2}}}%
}
%%--------------------
% Reset affiliation
%\resetlaboratories
\newcommand{\resetlaboratories}{%
	\global\phdthesishaslaboratoryfalse%
	\global\phdthesishaslaboratorymultifalse%
	\gdef\thethesislaboratories{}%
	\global\laboratorylogofalse%
	\global\let\thethesislaboratorylogo\relax%
}

%%--------------------
%% Add partner logo
%\addpartner[picture_options]{logo_picture}
\newif\ifpartnerlist
\global\partnerlistfalse
\gdef\thepartnerlist{}
\newcommand{\upm@phdthesis@partner@raisedincludegraphics}[2][]{%
	\raisebox{-.5\height}{%
		\includegraphics[max width=4cm,max height=1.5cm,keepaspectratio,#1]{#2}%
	}%
}
\newcommand{\addpartner}[2][]{%
	\ifpartnerlist%
		\protected@xdef\thepartnerlist{\thepartnerlist%
			\protect\hspace{.2cm}%
			\protect\upm@phdthesis@partner@raisedincludegraphics[#1]{#2}%
		}%
	\else%
		\global\partnerlisttrue%
		\protected@xdef\thepartnerlist{\thepartnerlist%
			\protect\upm@phdthesis@partner@raisedincludegraphics[#1]{#2}%
		}%
	\fi%
}

%%--------------------
%% Reset the list of the partner logos
%\resetpartners
\newif\ifpartnerlist
\newcommand{\resetpartners}{%
	\global\partnerlistfalse%
	\gdef\thepartnerlist{}%
}

%%--------------------
% Change the color of the TOC
\let\upm@phdthesis@l@contentsline\contentsline
\renewcommand{\contentsline}[4]{%
	%{subsection}{\numberline {1.1.2}Extension de la plateforme \textsc {JaSIM}\xspace et Application}{18}{subsection.1.1.2}
	\ifthenelse
		{\equal{#1}{part}}
		{\upm@phdthesis@l@contentsline{#1}{\textcolor{parttitlecolor}{#2}}{\textcolor{parttitlecolor}{#3}}{#4}}%
		{\ifthenelse
			{\equal{#1}{chapter}}
			{\upm@phdthesis@l@contentsline{#1}{\textcolor{chaptertitlecolor}{#2}}{\textcolor{chaptertitlecolor}{#3}}{#4}}%
			{\upm@phdthesis@l@contentsline{#1}{#2}{#3}{#4}}}%
}

%%--------------------
% Set the abstract of the thesis
% \thesisabstract [lang]{text}
\newif\ifphdthesismainabstract
\phdthesismainabstractfalse
\newif\ifphdthesisminorabstract
\phdthesisminorabstractfalse
\gdef\phdthesismainabstract{}
\gdef\phdthesisminorabstract{}
\gdef\phdthesismaindocumenttitle{Titre\;:}
\gdef\phdthesismainabstracttitle{R\'esum\'e\;:}
\gdef\phdthesisminorabstracttitle{Abstract:}
\newcommand{\thesisabstract}[2][\upmcurrentlang]{%
	\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
		\global\phdthesismainabstracttrue%
		\gdef\phdthesismainabstract{#2}%
		\setdocabstract{#2}%
		\ifthenelse{\equal{english}{#1}}{%
			\gdef\phdthesismaindocumenttitle{Title:}
			\gdef\phdthesismainabstracttitle{Abstract:}
		}{%
			\gdef\phdthesismaindocumenttitle{Titre\;:}
			\gdef\phdthesismainabstracttitle{R\'esum\'e\;:}
		}%
	}{%
		\global\phdthesisminorabstracttrue%
		\gdef\phdthesisminorabstract{#2}%
		\ifthenelse{\equal{english}{#1}}{%
			\gdef\phdthesisminordocumenttitle{Title:}
			\gdef\phdthesisminorabstracttitle{Abstract:}
		}{%
			\gdef\phdthesisminordocumenttitle{Titre\;:}
			\gdef\phdthesisminorabstracttitle{R\'esum\'e\;:}
		}%
	}%
}

%%--------------------
% Set the keywords of the thesis
% \thesiskeywords [lang]{keywords}
\newif\ifphdthesismainkeywords
\phdthesismainkeywordsfalse
\newif\ifphdthesisminorkeywords
\phdthesisminorkeywordsfalse
\gdef\phdthesismainkeywords{}
\gdef\phdthesisminorkeywords{}
\gdef\phdthesismainkeywordstitle{}
\gdef\phdthesisminorkeywordstitle{}
\newcommand{\thesiskeywords}[2][\upmcurrentlang]{%
	\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
		\global\phdthesismainkeywordstrue%
		\gdef\phdthesismainkeywords{#2}%
		\ifthenelse{\equal{english}{#1}}{%
			\gdef\phdthesismainkeywordstitle{Keywords:}
		}{%
			\gdef\phdthesismainkeywordstitle{Mots-cl\'es\;:}
		}%
	}{%
		\global\phdthesisminorkeywordstrue%
		\gdef\phdthesisminorkeywords{#2}%
		\ifthenelse{\equal{english}{#1}}{%
			\gdef\phdthesisminorkeywordstitle{Keywords:}
		}{%
			\gdef\phdthesisminorkeywordstitle{Mots-cl\'es\;:}
		}%
	}%
}

%%--------------------
% Utility function that is looping on the character of a text
% \foreachchar {for first char}{for the rest of the chars}
\gdef\@endfe{}
\def\upm@foreachchar#1#2\@endfe{%
	\def\thechar{#1}%
	\upm@foreach@do%
	\renewcommand{\onfirstchar}[1]{}%
	\renewcommand{\onnextchar}[1]{##1}%
	\ifthenelse{\equal{{#2}}{{\@endfe}}}{}{
		\expandafter\upm@foreachchar#2\@endfe%
	}%
}

\newcommand{\foreachchar}[2]{%
	\begingroup%
	\newcommand{\upm@foreach@do}{#2}%
	\newcommand{\onfirstchar}[1]{##1}%
	\newcommand{\onnextchar}[1]{}%
	{\expandafter\upm@foreachchar#1\@endfe\@endfe}%
	\endgroup%
}

%%--------------------
% Build card with the PhD thesis reference ID inside.
% This ID is given by the SPIM doctoral school.
\newcommand{\thespimthesisdocrefcard}{%
	\gdef\upm@spimthesis@reserveda{|}%
	\gdef\upm@spimthesis@reservedb{}%
	\foreachchar{\theupmdocref}{%
		\protected@xdef\upm@spimthesis@reserveda{|c\upm@spimthesis@reserveda}%
		\protected@xdef\upm@spimthesis@reservedb{\upm@spimthesis@reservedb \onnextchar{\protect&} \thechar}%
	}%
	\protected@xdef\upm@spimthesis@reserveda{%
		\protect\tabular[c]{\upm@spimthesis@reserveda}}%
	N\ensuremath{^{\circ}}~\upm@spimthesis@reserveda%
	\upm@spimthesis@reservedb \\ \hline\endtabular%
}

%%--------------------
%% Define emphazing macros
\renewcommand{\Emph}[1]{\textcolor{emphemphtextcolor}{\textbf{#1}}}
\renewcommand{\emph}[1]{\textcolor{emphtextcolor}{#1}}

%%--------------------
%% Macros for formating the bibliography
\newcommand{\phdthesisbibemph}[1]{\textit{#1}}
\newcommand{\phdthesisbibEmph}[1]{\textcolor{bibemphemphtextcolor}{\textbf{#1}}}
\newcommand{\phdthesisbibkeyemph}[1]{\textbf{#1}}

\ifthenelse{\equal{french}{\upmcurrentlang}}{
	\gdef\phdthesisbibmasterthesis{Th\`ese de Master\xspace}
	\gdef\phdthesisbibphdthesis{Th\`ese de Doctorat\xspace}
	\gdef\phdthesisbibSee{Voir\xspace}
	\gdef\phdthesisbibAccessDate{Date d'acc\`es~:\xspace}
	\gdef\phdthesisbibevent{\'ev\'enement\xspace}
	\gdef\phdthesisbiband{et\xspace}
	\gdef\phdthesisbibetal{et~al.\xspace}
	\gdef\phdthesisbibeditors{\'editeurs\xspace}
	\gdef\phdthesisbibeditor{\'editeur\xspace}
	\gdef\phdthesisbibvolume{volume\xspace}
	\gdef\phdthesisbibVolume{Volume\xspace}
	\gdef\phdthesisbibof{de\xspace}
	\gdef\phdthesisbibvolumenumber{volume et num\'ero\xspace}
	\gdef\phdthesisbibnumber{num\'ero\xspace}
	\gdef\phdthesisbibNumber{Num\'ero\xspace}
	\gdef\phdthesisbibin{dans\xspace}
	\gdef\phdthesisbibIn{Dans\xspace}
	\gdef\phdthesisbibedition{\'edition\xspace}
	\gdef\phdthesisbibpages{pages\xspace}
	\gdef\phdthesisbibpage{page\xspace}
	\gdef\phdthesisbibchapter{chapitre\xspace}
	\gdef\phdthesisbibChapter{Chapitre\xspace}
	\gdef\phdthesisbibresearchreport{Rapport de Recherche\xspace}
	\gdef\phdthesisbibtechnicalreport{Rapport technique\xspace}
	\gdef\phdthesisbibJanuary{Janvier\xspace}
	\gdef\phdthesisbibFebruary{F\'evrier\xspace}
	\gdef\phdthesisbibMarch{Mars\xspace}
	\gdef\phdthesisbibApril{Avril\xspace}
	\gdef\phdthesisbibMay{Mai\xspace}
	\gdef\phdthesisbibJune{Juin\xspace}
	\gdef\phdthesisbibJuly{Juillet\xspace}
	\gdef\phdthesisbibAugust{Ao\^ut\xspace}
	\gdef\phdthesisbibSeptember{Septembre\xspace}
	\gdef\phdthesisbibOctober{Octobre\xspace}
	\gdef\phdthesisbibNovember{Novembre\xspace}
	\gdef\phdthesisbibDecember{D\'ecembre\xspace}
}{%
	\gdef\phdthesisbibmasterthesis{Master Thesis\xspace}
	\gdef\phdthesisbibphdthesis{PhD Thesis\xspace}
	\gdef\phdthesisbibSee{See\xspace}
	\gdef\phdthesisbibAccessDate{Access date:\xspace}
	\gdef\phdthesisbibevent{event\xspace}
	\gdef\phdthesisbiband{and\xspace}
	\gdef\phdthesisbibetal{et~al.\xspace}
	\gdef\phdthesisbibeditors{editors\xspace}
	\gdef\phdthesisbibeditor{editor\xspace}
	\gdef\phdthesisbibvolume{volume\xspace}
	\gdef\phdthesisbibVolume{Volume\xspace}
	\gdef\phdthesisbibof{of\xspace}
	\gdef\phdthesisbibvolumenumber{volume and number\xspace}
	\gdef\phdthesisbibnumber{number\xspace}
	\gdef\phdthesisbibNumber{Number\xspace}
	\gdef\phdthesisbibin{in\xspace}
	\gdef\phdthesisbibIn{In\xspace}
	\gdef\phdthesisbibedition{edition\xspace}
	\gdef\phdthesisbibpages{pages\xspace}
	\gdef\phdthesisbibpage{page\xspace}
	\gdef\phdthesisbibchapter{chapter\xspace}
	\gdef\phdthesisbibChapter{Chapter\xspace}
	\gdef\phdthesisbibresearchreport{Research Report\xspace}
	\gdef\phdthesisbibtechnicalreport{Technical Report\xspace}
	\gdef\phdthesisbibJanuary{January\xspace}
	\gdef\phdthesisbibFebruary{February\xspace}
	\gdef\phdthesisbibMarch{March\xspace}
	\gdef\phdthesisbibApril{April\xspace}
	\gdef\phdthesisbibMay{May\xspace}
	\gdef\phdthesisbibJune{June\xspace}
	\gdef\phdthesisbibJuly{July\xspace}
	\gdef\phdthesisbibAugust{August\xspace}
	\gdef\phdthesisbibSeptember{September\xspace}
	\gdef\phdthesisbibOctober{October\xspace}
	\gdef\phdthesisbibNovember{November\xspace}
	\gdef\phdthesisbibDecember{December\xspace}
}

%%--------------------
%% Force the name of the bibliography and other sections for French
\AtBeginDocument{
	\ifthenelse{\equal{\edspimphdthesisclasslanguage}{french}}{%
		\renewcommand{\refname}{Bibliographie}%
		\renewcommand{\listtablename}{Liste des tables}%
		\renewcommand{\contentsname}{Sommaire}%
	}{}
}

%%--------------------
%% Format the keys in the bibliography section
\global\let\upm@phdthesis@old@biblabel\@biblabel
\gdef\@biblabel#1{\phdthesisbibkeyemph{\upm@phdthesis@old@biblabel{#1}}}


%%--------------------
% Lettrine

% Color of the lettine
\colorlet{lettrinecolor}{standardphdcolor}

% The following macro put its parameter into a lettrine with the
% proper layout
\gdef\upm@phdthesis@MakeLettrine@lettrine#1{%
	\lettrine[findent=.5mm,nindent=0pt,lines=3,loversize=0.1]{\rmfamily\textcolor{lettrinecolor}{\uppercase{#1}}}{}%
}

% Macro that contains the string "the letter"
\gdef\upm@phdthesis@MakeLettrine@letterstr{\string t\string h\string e\space\string l\string e\string t\string t\string e\string r}

% Macro that contains the string "the character"
\gdef\upm@phdthesis@MakeLettrine@characterstr{\string t\string h\string e\space\string c\string h\string a\string r\string a\string c\string t\string e\string r}

% Macro to search for the first letter in its second parameter
% and put it in a lettrine.
% First parameter: are the macros to ignore and put back before
%                  the lettrine. The value of this parameter will
%                  evolve during the recursive calls.
% Second parameter: TeX give the token following the macro in
%                   this parameter (because the macros is always
%                   invoked with only one explicit parameter).
\newcommand{\upm@phdthesis@MakeLettrine}[2]{%
	% Detect the meaning of the second parameter.
	\edef\upm@phdthesis@reserveda{\meaning#2}%
	% Test if the meaning string contains "the letter"
	\edef\upm@phdthesis@reservedb{\noexpand\in@{\upm@phdthesis@MakeLettrine@letterstr}{\upm@phdthesis@reserveda}}%
	\upm@phdthesis@reservedb%
	\ifin@%
		% The meaning indicates that the second parameter
		% is a letter. It may be put in the lettrine.
		% The macro \upm@phdthesis@reserveda is defined to avoid
		% to consume the tokens written in this recursive
		% macro. This temp macro is invoked at the end of
		% this recursive macro. In this way it will consume
		% the token that are available in the document core.
		\gdef\upm@phdthesis@reserveda{#1\upm@phdthesis@MakeLettrine@lettrine{#2}}%
	\else%
		% Test if the meaning string contains "the character"
		\edef\upm@phdthesis@reservedb{\noexpand\in@{\upm@phdthesis@MakeLettrine@characterstr}{\upm@phdthesis@reserveda}}%
		\upm@phdthesis@reservedb%
		\ifin@%
			% The meaning indicates that the second parameter
			% is a character. It may be put in the lettrine.
			% The macro \upm@phdthesis@reserveda is defined to avoid
			% to consume the tokens written in this recursive
			% macro. This temp macro is invoked at the end of
			% this recursive macro. In this way it will consume
			% the token that are available in the document core.
			\gdef\upm@phdthesis@reserveda{#1\upm@phdthesis@MakeLettrine@lettrine{#2}}%
		\else%
			% The meaning indicates that the second parameter
			% is not a letter nor a character.
			% It may be put back before the lettrine without
			% change.
			% The macro \upm@phdthesis@reserveda is defined to avoid
			% to consume the tokens written in this recursive
			% macro. This temp macro is invoked at the end of
			% this recursive macro. In this way it will consume
			% the token that are available in the document core.
			\gdef\upm@phdthesis@reserveda{\upm@phdthesis@MakeLettrine{#1#2}}%
		\fi%
	\fi%
	\upm@phdthesis@reserveda%
}

%%--------------------
%% Macros for starting a chapter with a standard format

% The public interface of the macro that permits to put a lettrine
\newcommand{\chapterintrolettrine}[1]{%
	\upm@phdthesis@MakeLettrine@lettrine#1%
}

% Output a local etoc or a minitoc with the standard formatting
\newcommand{\chapterintrominitoc}{%
	\@ifundefined{minitoc}{%
		\@ifundefined{localtableofcontents}{%
		}{%
			\etocsettocstyle{\section*{\contentsname}}{}%
			\localtableofcontents%
		}%
	}{%
		\begin{figure}[bt]%
		\minitoc%
		\end{figure}%
	}%
}

% Add a lettrine and a minitoc at the next following \section
\global\long\def\chapterintrotosection#1\section{%
	\chapterintrominitoc%
	\ignorespaces\upm@phdthesis@MakeLettrine{}#1%
	\expandafter\section}

% Add a lettrine and a minitoc at the next following \input
\global\long\def\chapterintrotoinput#1\input{%
	\chapterintrominitoc%
	\ignorespaces\upm@phdthesis@MakeLettrine{}#1%
	\expandafter\input}

% Add a lettrine and a minitoc at the next following \include
\global\long\def\chapterintrotoinclude#1\include{%
	\chapterintrominitoc%
	\ignorespaces\upm@phdthesis@MakeLettrine{}#1%
	\expandafter\include}

% No lettrine at the begining of the chapter
\global\long\def\upm@phdthesis@chapterintro@notoc{%
	\ignorespaces\upm@phdthesis@MakeLettrine{}}

% Standard formating with looking forward for \section, \input, or \include
\gdef\chapterintro{\@ifstar\upm@phdthesis@chapterintro@notoc\chapterintrotosection}

%%--------------------
%% Add a small message on the backcover.
\Set{backcovermessage}{%
	\begin{center}\tiny
		\ifthenelse{\equal{french}{\upmcurrentlang}}{
			Document r\'ealis\'e avec \LaTeX\ et : \\
			le style \LaTeX\ pour Th\`ese de Doctorat cr\'e\'e par S. Galland --- \url{https://github.com/gallandarakhneorg/tex-templates} \\
			la collection de paquets \texttt{tex-upmethodology} --- \url{http://www.arakhne.org/tex-upmethodology/}\\[.25cm]
		}{
			Document generated with \LaTeX\ and: \\
			the \LaTeX\ style for PhD Thesis created by S. Galland --- \url{https://github.com/gallandarakhneorg/tex-templates
} \\
			the \texttt{tex-upmethodology} package suite --- \url{http://www.arakhne.org/tex-upmethodology/}\\[.25cm]
		}
	\end{center}
}

%%--------------------
%% Command for determing to prefix with "de" or "d'".
%\De{text}
\let\upm@phdthesis@firstchartok\relax
\newcommand{\upm@phdthesis@firstchar}[1]{\upm@phdthesis@firstcharaux#1\@nil}
\def\upm@phdthesis@firstcharaux#1#2\@nil{\gdef\upm@phdthesis@firstchartok{\detokenize{#1}}}
\newcommand{\De}[1]{%
	\protected@edef\upm@phdthesis@tmp{\protect\upm@phdthesis@firstchar{#1}}%
	\upm@phdthesis@tmp%
	\ifthenelse{%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{a}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{A}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{e}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{E}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{i}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{I}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{o}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{O}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{u}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{U}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{y}}\or%
		\equal{\upm@phdthesis@firstchartok}{\detokenize{Y}}%
	}{d'#1}{de #1}%
}

%%--------------------
%% Environment for showing up a research question of the PhD thesis.
%% The star version does not add the research question's counter in the title
%\begin{researchquestion}[title] description \end{researchdirection}
%\begin{researchquestion*}[title] description \end{researchdirection*}
\ifupmlang{french}{%
	\gdef\upm@phdthesis@researchquestion@label{Question de recherche}%
	\gdef\upm@phdthesis@researchquestion@slabel{QR}%
}{%
	\gdef\upm@phdthesis@researchquestion@label{Research Question}%
	\gdef\upm@phdthesis@researchquestion@slabel{RQ}%
}
\gdef\upm@phdthesis@researchquestion@format@title#1{\textbf{#1}}%

\newcounter{upm@phdthesis@researchquestion@count}
\setcounter{upm@phdthesis@researchquestion@count}{0}

\newenvironment{upm@phdthesis@researchquestion}[2]{%
	\global\addtocounter{upm@phdthesis@researchquestion@count}{1}%
	\begin{tcolorbox}[coltitle=researchquestiontitle, colback=researchquestionbackground!10, colframe=researchquestionbackground!40, title=\upm@phdthesis@researchquestion@format@title{\upm@phdthesis@researchquestion@label#1\Ifnotempty{#2}{ -- #2}}]%
	\renewcommand{\@currentlabel}{\upm@phdthesis@researchquestion@slabel\theupm@phdthesis@researchquestion@count}%

}{%
	\end{tcolorbox}%
}

\newenvironment{researchquestion}[1][\@empty]{%
	\begin{upm@phdthesis@researchquestion}{\xspace\theupm@phdthesis@researchquestion@count\xspace(\upm@phdthesis@researchquestion@slabel\theupm@phdthesis@researchquestion@count)}{#1}%
}{%
	\end{upm@phdthesis@researchquestion}%
}
\newenvironment{researchquestion*}[1][\@empty]{%
	\begin{upm@phdthesis@researchquestion}{}{#1}%
}{%
	\end{upm@phdthesis@researchquestion}%
}

%%--------------------
%% Environment for showing up an objective of the PhD thesis.
%% The star version does not add the contribution's counter in the title
%\begin{objective}[title] description \end{objective}
%\begin{objective*}[title] description \end{objective*}
\ifupmlang{french}{%
	\gdef\upm@phdthesis@objective@label{Objectif}%
}{%
	\gdef\upm@phdthesis@objective@label{Objective}%
}
\gdef\upm@phdthesis@objective@slabel{O}%
\gdef\upm@phdthesis@objective@format@title#1{\textbf{#1}}%

\newcounter{upm@phdthesis@objective@count}
\setcounter{upm@phdthesis@objective@count}{0}

\newenvironment{upm@phdthesis@objective}[2]{%
	\global\addtocounter{upm@phdthesis@objective@count}{1}%
	\begin{tcolorbox}[coltitle=objectivetitle, colback=objectivebackground!10, colframe=objectivebackground!40, title=\upm@phdthesis@objective@format@title{\upm@phdthesis@objective@label#1\Ifnotempty{#2}{ -- #2}}]%
	\renewcommand{\@currentlabel}{\upm@phdthesis@objective@slabel\theupm@phdthesis@objective@count}%

}{%
	\end{tcolorbox}%
}

\newenvironment{objective}[1][\@empty]{%
	\begin{upm@phdthesis@objective}{\xspace\theupm@phdthesis@objective@count\xspace(\upm@phdthesis@objective@slabel\theupm@phdthesis@objective@count)}{#1}%
}{%
	\end{upm@phdthesis@objective}%
}
\newenvironment{objective*}[1][\@empty]{%
	\begin{upm@phdthesis@objective}{}{#1}%
}{%
	\end{upm@phdthesis@objective}%
}

%%--------------------
%% Environment for showing up a contribution of the PhD thesis.
%% The star version does not add the contribution's counter in the title
%\begin{objective}[title] description \end{objective}
%\begin{objective*}[title] description \end{objective*}
\ifupmlang{french}{%
	\gdef\upm@phdthesis@contribution@label{Contribition}%
}{%
	\gdef\upm@phdthesis@contribution@label{Contribution}%
}
\gdef\upm@phdthesis@contribution@slabel{C}%
\gdef\upm@phdthesis@contribution@format@title#1{\textbf{#1}}%

\newcounter{upm@phdthesis@contribution@count}
\setcounter{upm@phdthesis@contribution@count}{0}

\newenvironment{upm@phdthesis@contribution}[2]{%
	\global\addtocounter{upm@phdthesis@contribution@count}{1}%
	\begin{tcolorbox}[coltitle=contributiontitle, colback=contributionbackground!10, colframe=contributionbackground!40, title=\upm@phdthesis@contribution@format@title{\upm@phdthesis@contribution@label#1\Ifnotempty{#2}{ -- #2}}]%
	\renewcommand{\@currentlabel}{\upm@phdthesis@contribution@slabel\theupm@phdthesis@contribution@count}%

}{%
	\end{tcolorbox}%
}

\newenvironment{contribution}[1][\@empty]{%
	\begin{upm@phdthesis@contribution}{\xspace\theupm@phdthesis@contribution@count\xspace(\upm@phdthesis@contribution@slabel\theupm@phdthesis@contribution@count)}{#1}%
}{%
	\end{upm@phdthesis@contribution}%
}
\newenvironment{contribution*}[1][\@empty]{%
	\begin{upm@phdthesis@contribution}{}{#1}%
}{%
	\end{upm@phdthesis@contribution}%
}

%%--------------------
%% Default roles for the jury
\let\ifenglish\relax%
\newcommand{\rolePresidentM}{\ifenglish{President}{Pr\'esident}}%
\newcommand{\rolePresidentF}{\ifenglish{President}{Pr\'esidente}}%
\newcommand{\roleReviewerM}{\ifenglish{Reviewer}{Rapporteur}}%
\newcommand{\roleReviewerF}{\ifenglish{Reviewer}{Rapporteuse}}%
\newcommand{\roleExaminerM}{\ifenglish{Examiner}{Examinateur}}%
\newcommand{\roleExaminerF}{\ifenglish{Examiner}{Examinatrice}}%
\newcommand{\roleDirectorM}{\ifenglish{Director}{Directeur}}%
\newcommand{\roleDirectorF}{\ifenglish{Director}{Directrice}}%
\newcommand{\roleCodirectorM}{\ifenglish{Codirector}{Co-Directeur}}%
\newcommand{\roleCodirectorF}{\ifenglish{Codirector}{Co-Directrice}}%
\newcommand{\roleSupervisorM}{\ifenglish{Supervisor}{Encadrant}}%
\newcommand{\roleSupervisorF}{\ifenglish{Supervisor}{Encadrante}}%
\newcommand{\roleCosupervisorM}{\ifenglish{Co-Supervisor}{Co-Encadrant}}%
\newcommand{\roleCosupervisorF}{\ifenglish{Co-Supervisor}{Co-Encadrante}}%
\newcommand{\roleInviteeM}{\ifenglish{Invitee}{Invit\'e}}%
\newcommand{\roleInviteeF}{\ifenglish{Invitee}{Invit\'ee}}%

%%--------------------
% Labels for the front page
\SetLangDefault{english}{frontpagephdthesis}{DOCTORAL THESIS}
\SetLangDefault{french}{frontpagephdthesis}{TH\`ESE DE DOCTORAT}
\SetLangDefault{english}{frontpagejointphdthesis}{JOINT DOCTORAL THESIS}
\SetLangDefault{french}{frontpagejointphdthesis}{TH\`ESE DE DOCTORAT EN CO-TUTELLE}
\SetLangDefault{english}{frontpageuniversity}{OF}
\SetLangDefault{french}{frontpageuniversity}{DE L'\'ETABLISSEMENT}
\SetLangDefault{english}{frontpageuniversity2}{AND OF}
\SetLangDefault{french}{frontpageuniversity2}{ET DE L'\'ETABLISSEMENT}
\SetLangDefault{english}{frontpagedoctoralschool}{Doctoral School \#}
\SetLangDefault{french}{frontpagedoctoralschool}{\'Ecole doctorale n\textdegree}
\SetLangDefault{english}{frontpagedoctorof}{Doctor in\ }
\SetLangDefault{french}{frontpagedoctorof}{Doctorat \De}
\SetLangDefault{english}{frontpageby}{by}
\SetLangDefault{french}{frontpageby}{par}

\Set{doctoralschoolnumber}{37}
\SetLangDefault{english}{doctoralschoolname}{Physical Sciences for Engineering and Microtechnologies}
\SetLangDefault{french}{doctoralschoolname}{Sciences Physiques pour l'Ing\'enieur et Microtechniques}


%%--------------------
%% Default front page for the SPIM doctoral thesis
% #1: the language
% #2: university logo
\newcommand{\upmspimthesisstandardfrontpage}[2]{
	\ifthenelse{\equal{#1}{english}}{%
		\gdef\ifenglish##1##2{##1}%
	}{%
		\gdef\ifenglish##1##2{##2}%
	}%
	\pagestyle{empty}%
	\begin{picture}(0,0)%
	\put(-40,30){\parbox[t]{16.75cm}{%
		\raggedright\raisebox{-.5\height}{\includegraphics[max width=5cm,max height=2cm,keepaspectratio]{#2}}%
		\iflaboratorylogo%
			\hfill\thethesislaboratorylogo%
		\fi%
		\hfill\raisebox{-.5\height}{\includegraphics[max width=4cm,max height=1.5cm,keepaspectratio]{spim}}%
	}}
	\put(-40,-30){\parbox[t]{16.75cm}{%
		\ifpartnerlist%
			\raggedleft\thepartnerlist%
		\fi%
	}}
	\Ifelseundefined{jointuniversity}{%
		\put(-45,-70){\parbox[t][12cm][t]{17cm}{%
			% Reset the baseline
			\renewcommand{\baselinestretch}{1} 
			\begin{center}%
				{\bfseries\GetLang{#1}{frontpagephdthesis}} \\[.5cm]
				{\bfseries\GetLang{#1}{frontpageuniversity} \MakeUppercase{\GetLang{#1}{universityname}}} \\[1cm]

				{\large\GetLang{#1}{frontpagedoctoralschool}\Get{doctoralschoolnumber}} \\[.25cm]
				{\large\GetLang{#1}{doctoralschoolname}} \\[1cm]

				{\large\GetLang{#1}{frontpagedoctorof}{\GetLang{#1}{speciality}}} \\[1cm]

				{\large\GetLang{#1}{frontpageby}} \\[.5cm]

				{\Large\theauthorlist} \\[1.5cm]%

				\parbox{\linewidth}{\centering\Large%
					\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
						\nohyphens{\theupmproject}%
					}{%
						\nohyphens{\Get{minorlanguagethesistitle}}%
					}%
				}%
				\Ifnotempty\theupmdocname{\\[.25cm]\parbox{\linewidth}{\centering\large\nohyphens{\theupmdocname}}}%
			\end{center}%
		}}%
	}{%
		\put(-45,-60){\parbox[t][12cm][t]{17cm}{%
			% Reset the baseline
			\renewcommand{\baselinestretch}{1} 
			\begin{center}%
				{\bfseries\GetLang{#1}{frontpagejointphdthesis}} \\[.5cm]
				{\bfseries\GetLang{#1}{frontpageuniversity} \MakeUppercase{\GetLang{#1}{universityname}}} \\[.5cm]
				{\bfseries\GetLang{#1}{frontpageuniversity2} \MakeUppercase{\Get{jointuniversity}}} \\[1cm]

				{\large\GetLang{#1}{frontpagedoctoralschool}\Get{doctoralschoolnumber}} \\[.25cm]
				{\large\GetLang{#1}{doctoralschoolname}} \\[1cm]

				{\large\GetLang{#1}{frontpagedoctorof}{\GetLang{#1}{speciality}}} \\[1cm]

				{\large\GetLang{#1}{frontpageby}} \\[.5cm]

				{\Large\theauthorlist} \\[1.5cm]%

				\parbox{\linewidth}{\centering\Large%
					\ifthenelse{\equal{\upmcurrentlang}{#1}}{%
						\nohyphens{\theupmproject}%
					}{%
						\nohyphens{\Get{minorlanguagethesistitle}}%
					}%
				}%
				\Ifnotempty\theupmdocname{\\[.25cm]\parbox{\linewidth}{\centering\large\nohyphens{\theupmdocname}}}%
			\end{center}%
		}}%
	}
	\put(-45,-520){\mbox{\parbox[t]{17cm}{%
		% Reset the baseline
		\renewcommand{\baselinestretch}{2}%
		{\Get{defensemessagestyle}\GetLang{#1}{defensemessage}}\\%
		\thejurytab%
	}}}
	\put(-60,-710){%
		\mbox{\parbox[t]{17cm}{%
			\ifthenelse{\equal{\theupmdocref}{}}{}{%
				\thespimthesisdocrefcard%\hfill\mbox{}%
			}%
		}}%
	}
	\end{picture}%
	\ifthenelse{\equal{\upmcurrentlang}{english}}{%
		\gdef\ifenglish##1##2{##1}%
	}{%
		\gdef\ifenglish##1##2{##2}%
	}%
}

%%--------------------
%% Default back page for the SPIM doctoral thesis
% #1: university logo
% #2: id of the value of the university address
% #3: the shifting of the university logo
\newcommand{\upmspimthesisstandardbackpage}[3]{
	\pagestyle{empty}%
	\begin{picture}(0,0)%
	\put(-50,30){\includegraphics[width=100\unitlength]{\Get{doctoralschoollogo}}}%
	\put(-50,-710){%
		\begin{tabular}{@{}ll@{}}%
			\raisebox{-#3\height}{\includegraphics[height=1.1cm]{#1}} & \parbox[c]{10cm}{\scriptsize\Get{#2}}%
		\end{tabular}%
	}%
	\put(-45,-325){\parbox[c][23cm][t]{17cm}{%
		% Reset the baseline
		\renewcommand{\baselinestretch}{1} 
		\ifphdthesismainabstract%
			\begin{tabularx}{\linewidth}{|X|}%
			\hline%
			\normalsize\small\Get{primarytitlestyle}\textbf{\phdthesismaindocumenttitle} \nohyphens{\ignorespaces\theupmproject} \\
			\ifphdthesismainkeywords%
				\normalsize\small\Get{primarykeywordstyle}\textbf{\phdthesismainkeywordstitle} \nohyphens{\ignorespaces\phdthesismainkeywords} \\%
			\fi%
			\normalsize\small\Get{primaryabstractstyle}\textbf{\phdthesismainabstracttitle} \\%
			\vspace{-.8cm}%
			\begin{multicols}{2}%
				\normalsize\small\Get{primaryabstractstyle}\nohyphens{\ignorespaces\phdthesismainabstract}%
			\end{multicols}\\%
			\hline%
			\end{tabularx}%
			\ifphdthesisminorabstract%
				\par\vspace{1cm}%
			\fi%
		\fi%
		\ifphdthesisminorabstract%
			\begin{tabularx}{\linewidth}{|X|}%
			\hline
			\normalsize\small\Get{secondarytitlestyle}\textbf{\phdthesisminordocumenttitle} \nohyphens{\ignorespaces\Get{minorlanguagethesistitle}} \\
			\ifphdthesismainkeywords%
				\normalsize\small\Get{secondarykeywordstyle}\textbf{\phdthesisminorkeywordstitle} \nohyphens{\ignorespaces\phdthesisminorkeywords} \\%
			\fi%
			\normalsize\small\Get{secondaryabstractstyle}\textbf{\phdthesisminorabstracttitle} \\
			\vspace{-.8cm}%
			\begin{multicols}{2}%
				\normalsize\small\Get{secondaryabstractstyle}\nohyphens{\ignorespaces\phdthesisminorabstract}%
			\end{multicols}\\
			\hline
			\end{tabularx}%
		\fi%
	}}%
	\end{picture}%
}

\endinput