]> AND Private Git Repository - ThesisAhmed.git/blob - spimbasephdthesis.sty
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
corrections
[ThesisAhmed.git] / spimbasephdthesis.sty
1 % Document class for the PhD thesis
2 %
3 % Copyright (c) 2012-14 Stephane GALLAND <galland@arakhne.org>
4
5 % This program is free library; you can redistribute it and/or modify
6 % it under the terms of the GNU Lesser General Public License as
7 % published by the Free Software Foundation; either version 3 of the
8 % License, or any later version.
9 %
10 % This library is distributed in the hope that it will be useful, but
11 % WITHOUT ANY WARRANTY; without even the implied warranty of
12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 % Lesser General Public License for more details.
14 %
15 % You should have received a copy of the GNU Lesser General Public
16 % License along with this library; see the file COPYING.  If not,
17 % write to the Free Software Foundation, Inc., 59 Temple Place - Suite
18 % 330, Boston, MA 02111-1307, USA.
19
20 %%--------------------
21 %% Declare the LaTeX class
22 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
23 \ProvidesPackage{spimbasephdthesis}[2015/09/01]
24
25 \RequirePackage{lettrine}
26
27 %%--------------------
28 %% Check for the correct version of tex-upmethodology
29 \@ifclasslater{UPMVERSION}{2014/07/09}{}{\@latex@error{You must install a version of tex-upmethodology greater or equal to 20140710}\@eha}
30
31 %%--------------------
32 %% Underlining if the author's name (in bibliography)
33 \newcommand{\underlineifauthor}[2]{%
34         \ifdocumentauthor{#1}{\underline{#2}}{#2}%
35 }
36
37 %%--------------------
38 %% Utility functions
39 \gdef\edspim@phdthesis@class@firstword#1 #2\@nil{#1}
40 \gdef\edspim@phdthesis@class@nextwords#1 #2\@nil{#2}
41 \gdef\edspim@phdthesis@class@firstcolumn#1,#2\@nil{#1}
42 \gdef\edspim@phdthesis@class@nextcolumns#1,#2\@nil{#2}
43 \gdef\edspim@phdthesis@class@makejury{}
44 \gdef\edspim@phdthesis@class@addjury#1#2{%
45         \addjury%
46                 {\expandafter\edspim@phdthesis@class@firstword\edspim@phdthesis@class@firstcolumn#2\@nil\@nil}%
47                 {\expandafter\edspim@phdthesis@class@nextwords\edspim@phdthesis@class@firstcolumn#2\@nil\@nil}%
48                 {#1}%
49                 {\edspim@phdthesis@class@nextcolumns#2\@nil}%
50 }
51
52 %%--------------------
53 % Define the PhD thesis document
54 %\declarethesis[subtitle]{title}{defense date}{ID}
55 \newcommand{\declarethesis}[4][] {
56         \declaredocument{#2}{#1}{#4}%
57         \Set{defensedate}{#3}%
58         \initialversion{\makedate{11}{04}{2006}}{PhD Thesis}{\upmpublic}%
59 }
60
61 %%--------------------
62 % Add menber of the jury
63 %\addjury[email]{firstname}{lastname}{type}{position}
64 \newcommand{\upm@phdthesis@protectnl}[1]{%
65         \begingroup%
66                 \let\\\newline%
67                 \nohyphens{\Get{jurystyle}#1}%
68         \endgroup%
69 }
70 \gdef\upm@phdthesis@jurylist{}
71 \global\let\thejurytab\relax
72 \newcommand{\addjury}[5][]{%
73         \global\protected@edef\upm@phdthesis@jurylist{\upm@phdthesis@jurylist\protect\protect\Get{jurystyle}\protect\protect\upmmakename{#2}{#3}{~} & \protect\upm@phdthesis@protectnl{#4} & \protect\upm@phdthesis@protectnl{#5} \protect\\}%
74         \global\protected@edef\thejurytab{\protect\noindent\protect\begin{tabularx}{\Get{jurytabwidth}}{@{}llX@{}}\upm@phdthesis@jurylist\protect\end{tabularx}}%
75 }
76
77 %%--------------------
78 % Add affiliation
79 %\addlaboratory{lab description}
80 \newif\ifphdthesishaslaboratory
81 \global\phdthesishaslaboratoryfalse
82 \newif\ifphdthesishaslaboratorymulti
83 \global\phdthesishaslaboratorymultifalse
84 \gdef\thethesislaboratories{}
85 \newcommand{\addlaboratory}[1]{%
86         \ifphdthesishaslaboratory%
87                 \phdthesishaslaboratorymultitrue%
88                 \global\protected@edef\thethesislaboratories{\thethesislaboratories,\protect\\\protect{#1}}%
89         \else%
90                 \phdthesishaslaboratorytrue%
91                 \global\protected@edef\thethesislaboratories{\thethesislaboratories\protect{#1}}%
92         \fi%
93 }
94 %%--------------------
95 % Reset affiliation
96 %\resetlaboratories
97 \newcommand{\resetlaboratories}{%
98         \global\phdthesishaslaboratoryfalse%
99         \global\phdthesishaslaboratorymultifalse%
100         \gdef\thethesislaboratories{}%
101 }
102
103 %%--------------------
104 %% Add partner logo
105 %\addpartner[picture_options]{logo_picture}
106 \newif\ifpartnerlist
107 \global\partnerlistfalse
108 \gdef\thepartnerlist{}
109 \newcommand{\addpartner}[2][height=1cm]{%
110         \ifpartnerlist%
111                 \protected@xdef\thepartnerlist{\thepartnerlist\protect\hfill\protect\includegraphics[#1]{#2}}%
112         \else%
113                 \global\partnerlisttrue%
114                 \protected@xdef\thepartnerlist{\thepartnerlist\protect\includegraphics[height=1cm]{#2}}%
115         \fi%
116 }
117
118 %%--------------------
119 %% Reset the list of the partner logos
120 %\resetpartners
121 \newif\ifpartnerlist
122 \newcommand{\resetpartners}{%
123         \global\partnerlistfalse%
124         \gdef\thepartnerlist{}%
125 }
126
127 %%--------------------
128 % Change the color of the TOC
129 \let\upm@phdthesis@l@contentsline\contentsline
130 \renewcommand{\contentsline}[4]{%
131         %{subsection}{\numberline {1.1.2}Extension de la plateforme \textsc {JaSIM}\xspace et Application}{18}{subsection.1.1.2}
132         \ifthenelse
133                 {\equal{#1}{part}}
134                 {\upm@phdthesis@l@contentsline{#1}{\textcolor{parttitlecolor}{#2}}{\textcolor{parttitlecolor}{#3}}{#4}}%
135                 {\ifthenelse
136                         {\equal{#1}{chapter}}
137                         {\upm@phdthesis@l@contentsline{#1}{\textcolor{chaptertitlecolor}{#2}}{\textcolor{chaptertitlecolor}{#3}}{#4}}%
138                         {\upm@phdthesis@l@contentsline{#1}{#2}{#3}{#4}}}%
139 }
140
141 %%--------------------
142 % Set the abstract of the thesis
143 % \thesisabstract [lang]{text}
144 \newif\ifphdthesismainabstract
145 \phdthesismainabstractfalse
146 \newif\ifphdthesisminorabstract
147 \phdthesisminorabstractfalse
148 \gdef\phdthesismainabstract{}
149 \gdef\phdthesisminorabstract{}
150 \gdef\phdthesismainabstracttitle{R\'esum\'e~:}
151 \gdef\phdthesisminorabstracttitle{Abstract:}
152 \newcommand{\thesisabstract}[2][\upmcurrentlang]{%
153         \ifthenelse{\equal{\upmcurrentlang}{#1}}{%
154                 \global\phdthesismainabstracttrue%
155                 \gdef\phdthesismainabstract{#2}%
156                 \setdocabstract{#2}%
157                 \ifthenelse{\equal{english}{#1}}{%
158                         \gdef\phdthesismainabstracttitle{Abstract:}
159                 }{%
160                         \gdef\phdthesismainabstracttitle{R\'esum\'e~:}
161                 }%
162         }{%
163                 \global\phdthesisminorabstracttrue%
164                 \gdef\phdthesisminorabstract{#2}%
165                 \ifthenelse{\equal{english}{#1}}{%
166                         \gdef\phdthesisminorabstracttitle{Abstract:}
167                 }{%
168                         \gdef\phdthesisminorabstracttitle{R\'esum\'e~:}
169                 }%
170         }%
171 }
172
173 %%--------------------
174 % Set the keywords of the thesis
175 % \thesiskeywords [lang]{keywords}
176 \newif\ifphdthesismainkeywords
177 \phdthesismainkeywordsfalse
178 \newif\ifphdthesisminorkeywords
179 \phdthesisminorkeywordsfalse
180 \gdef\phdthesismainkeywords{}
181 \gdef\phdthesisminorkeywords{}
182 \gdef\phdthesismainkeywordstitle{}
183 \gdef\phdthesisminorkeywordstitle{}
184 \newcommand{\thesiskeywords}[2][\upmcurrentlang]{%
185         \ifthenelse{\equal{\upmcurrentlang}{#1}}{%
186                 \global\phdthesismainkeywordstrue%
187                 \gdef\phdthesismainkeywords{#2}%
188                 \ifthenelse{\equal{english}{#1}}{%
189                         \gdef\phdthesismainkeywordstitle{Keywords:}
190                 }{%
191                         \gdef\phdthesismainkeywordstitle{Mots-cl\'es~:}
192                 }%
193         }{%
194                 \global\phdthesisminorkeywordstrue%
195                 \gdef\phdthesisminorkeywords{#2}%
196                 \ifthenelse{\equal{english}{#1}}{%
197                         \gdef\phdthesisminorkeywordstitle{Keywords:}
198                 }{%
199                         \gdef\phdthesisminorkeywordstitle{Mots-cl\'es~:}
200                 }%
201         }%
202 }
203
204 %%--------------------
205 % Utility function that is looping on the character of a text
206 % \foreachchar {for first char}{for the rest of the chars}
207 \gdef\@endfe{}
208 \def\upm@foreachchar#1#2\@endfe{%
209         \def\thechar{#1}%
210         \upm@foreach@do%
211         \renewcommand{\onfirstchar}[1]{}%
212         \renewcommand{\onnextchar}[1]{##1}%
213         \ifthenelse{\equal{{#2}}{{\@endfe}}}{}{
214                 \expandafter\upm@foreachchar#2\@endfe%
215         }%
216 }
217
218 \newcommand{\foreachchar}[2]{%
219         \begingroup%
220         \newcommand{\upm@foreach@do}{#2}%
221         \newcommand{\onfirstchar}[1]{##1}%
222         \newcommand{\onnextchar}[1]{}%
223         {\expandafter\upm@foreachchar#1\@endfe\@endfe}%
224         \endgroup%
225 }
226
227 %%--------------------
228 % Build card with the PhD thesis reference ID inside.
229 % This ID is given by the SPIM doctoral school.
230 \newcommand{\thespimthesisdocrefcard}{%
231         \gdef\upm@spimthesis@reserveda{|}%
232         \gdef\upm@spimthesis@reservedb{}%
233         \foreachchar{\theupmdocref}{%
234                 \protected@xdef\upm@spimthesis@reserveda{|c\upm@spimthesis@reserveda}%
235                 \protected@xdef\upm@spimthesis@reservedb{\upm@spimthesis@reservedb \onnextchar{\protect&} \thechar}%
236         }%
237         \protected@xdef\upm@spimthesis@reserveda{%
238                 \protect\tabular[c]{\upm@spimthesis@reserveda}}%
239         N\ensuremath{^{\circ}}~\upm@spimthesis@reserveda%
240         \upm@spimthesis@reservedb \\ \hline\endtabular%
241 }
242
243 %%--------------------
244 %% Define emphazing macros
245 \renewcommand{\Emph}[1]{\textcolor{emphemphtextcolor}{\textbf{#1}}}
246 \renewcommand{\emph}[1]{\textcolor{emphtextcolor}{#1}}
247
248 %%--------------------
249 %% Macros for formating the bibliography
250 \newcommand{\phdthesisbibemph}[1]{\textit{#1}}
251 \newcommand{\phdthesisbibEmph}[1]{\textcolor{bibemphemphtextcolor}{\textbf{#1}}}
252 \newcommand{\phdthesisbibkeyemph}[1]{\textbf{#1}}
253
254 \ifthenelse{\equal{french}{\upmcurrentlang}}{
255         \gdef\phdthesisbiband{et\xspace}
256         \gdef\phdthesisbibetal{et~al.}
257         \gdef\phdthesisbibeditors{\'editeurs\xspace}
258         \gdef\phdthesisbibeditor{\'editeur\xspace}
259         \gdef\phdthesisbibvolume{volume\xspace}
260         \gdef\phdthesisbibVolume{Volume\xspace}
261         \gdef\phdthesisbibof{de\xspace}
262         \gdef\phdthesisbibvolumenumber{volume et num\'ero\xspace}
263         \gdef\phdthesisbibnumber{num\'ero\xspace}
264         \gdef\phdthesisbibNumber{Num\'ero\xspace}
265         \gdef\phdthesisbibin{dans\xspace}
266         \gdef\phdthesisbibIn{Dans\xspace}
267         \gdef\phdthesisbibedition{\'edition\xspace}
268         \gdef\phdthesisbibpages{pages\xspace}
269         \gdef\phdthesisbibpage{page\xspace}
270         \gdef\phdthesisbibchapter{chapitre\xspace}
271         \gdef\phdthesisbibtechnicalreport{Rapport technique\xspace}
272         \gdef\phdthesisbibJanuary{Janvier\xspace}
273         \gdef\phdthesisbibFebruary{F\'evrier\xspace}
274         \gdef\phdthesisbibMarch{Mars\xspace}
275         \gdef\phdthesisbibApril{Avril\xspace}
276         \gdef\phdthesisbibMay{Mai\xspace}
277         \gdef\phdthesisbibJune{Juin\xspace}
278         \gdef\phdthesisbibJuly{Juillet\xspace}
279         \gdef\phdthesisbibAugust{Ao\^ut\xspace}
280         \gdef\phdthesisbibSeptember{Septembre\xspace}
281         \gdef\phdthesisbibOctober{Octobre\xspace}
282         \gdef\phdthesisbibNovember{Novembre\xspace}
283         \gdef\phdthesisbibDecember{D\'ecembre\xspace}
284 }{%
285         \gdef\phdthesisbiband{et\xspace}
286         \gdef\phdthesisbibetal{et~al.}
287         \gdef\phdthesisbibeditors{editors\xspace}
288         \gdef\phdthesisbibeditor{editor\xspace}
289         \gdef\phdthesisbibvolume{volume\xspace}
290         \gdef\phdthesisbibVolume{Volume\xspace}
291         \gdef\phdthesisbibof{of\xspace}
292         \gdef\phdthesisbibvolumenumber{volume and number\xspace}
293         \gdef\phdthesisbibnumber{number\xspace}
294         \gdef\phdthesisbibNumber{Number\xspace}
295         \gdef\phdthesisbibin{in\xspace}
296         \gdef\phdthesisbibIn{In\xspace}
297         \gdef\phdthesisbibedition{edition\xspace}
298         \gdef\phdthesisbibpages{pages\xspace}
299         \gdef\phdthesisbibpage{page\xspace}
300         \gdef\phdthesisbibchapter{chapter\xspace}
301         \gdef\phdthesisbibtechnicalreport{Technical Report\xspace}
302         \gdef\phdthesisbibJanuary{January\xspace}
303         \gdef\phdthesisbibFebruary{February\xspace}
304         \gdef\phdthesisbibMarch{March\xspace}
305         \gdef\phdthesisbibApril{April\xspace}
306         \gdef\phdthesisbibMay{May\xspace}
307         \gdef\phdthesisbibJune{June\xspace}
308         \gdef\phdthesisbibJuly{July\xspace}
309         \gdef\phdthesisbibAugust{August\xspace}
310         \gdef\phdthesisbibSeptember{September\xspace}
311         \gdef\phdthesisbibOctober{October\xspace}
312         \gdef\phdthesisbibNovember{November\xspace}
313         \gdef\phdthesisbibDecember{December\xspace}
314 }
315
316 %%--------------------
317 %% Force the name of the bibliography and other sections for French
318 \AtBeginDocument{
319         \ifthenelse{\equal{\edspimphdthesisclasslanguage}{french}}{%
320                 \renewcommand{\refname}{Bibliographie}%
321                 \renewcommand{\listtablename}{Liste des tables}%
322                 \renewcommand{\contentsname}{Sommaire}%
323         }{}
324 }
325
326 %%--------------------
327 %% Format the keys in the bibliography section
328 \global\let\upm@phdthesis@old@biblabel\@biblabel
329 \gdef\@biblabel#1{\phdthesisbibkeyemph{\upm@phdthesis@old@biblabel{#1}}}
330
331
332 %%--------------------
333 % Lettrine
334
335 % The following macro put its parameter into a lettrine with the
336 % proper layout
337 \gdef\upm@phdthesis@MakeLettrine@lettrine#1{%
338         \lettrine[findent=.5mm,nindent=0pt]{\uppercase{#1}}{}%
339 }
340
341 % Macro that contains the string "the letter"
342 \gdef\upm@phdthesis@MakeLettrine@letterstr{\string t\string h\string e\space\string l\string e\string t\string t\string e\string r}
343
344 % Macro that contains the string "the character"
345 \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}
346
347 % Macro to search for the first letter in its second parameter
348 % and put it in a lettrine.
349 % First parameter: are the macros to ignore and put back before
350 %                  the lettrine. The value of this parameter will
351 %                  evolve during the recursive calls.
352 % Second parameter: TeX give the token following the macro in
353 %                   this parameter (because the macros is always
354 %                   invoked with only one explicit parameter).
355 \newcommand{\upm@phdthesis@MakeLettrine}[2]{%
356         % Detect the meaning of the second parameter.
357         \edef\upm@phdthesis@reserveda{\meaning#2}%
358         % Test if the meaning string contains "the letter"
359         \edef\upm@phdthesis@reservedb{\noexpand\in@{\upm@phdthesis@MakeLettrine@letterstr}{\upm@phdthesis@reserveda}}%
360         \upm@phdthesis@reservedb%
361         \ifin@%
362                 % The meaning indicates that the second parameter
363                 % is a letter. It may be put in the lettrine.
364                 % The macro \upm@phdthesis@reserveda is defined to avoid
365                 % to consume the tokens written in this recursive
366                 % macro. This temp macro is invoked at the end of
367                 % this recursive macro. In this way it will consume
368                 % the token that are available in the document core.
369                 \gdef\upm@phdthesis@reserveda{#1\upm@phdthesis@MakeLettrine@lettrine{#2}}%
370         \else%
371                 % Test if the meaning string contains "the character"
372                 \edef\upm@phdthesis@reservedb{\noexpand\in@{\upm@phdthesis@MakeLettrine@characterstr}{\upm@phdthesis@reserveda}}%
373                 \upm@phdthesis@reservedb%
374                 \ifin@%
375                         % The meaning indicates that the second parameter
376                         % is a character. It may be put in the lettrine.
377                         % The macro \upm@phdthesis@reserveda is defined to avoid
378                         % to consume the tokens written in this recursive
379                         % macro. This temp macro is invoked at the end of
380                         % this recursive macro. In this way it will consume
381                         % the token that are available in the document core.
382                         \gdef\upm@phdthesis@reserveda{#1\upm@phdthesis@MakeLettrine@lettrine{#2}}%
383                 \else%
384                         % The meaning indicates that the second parameter
385                         % is not a letter nor a character.
386                         % It may be put back before the lettrine without
387                         % change.
388                         % The macro \upm@phdthesis@reserveda is defined to avoid
389                         % to consume the tokens written in this recursive
390                         % macro. This temp macro is invoked at the end of
391                         % this recursive macro. In this way it will consume
392                         % the token that are available in the document core.
393                         \gdef\upm@phdthesis@reserveda{\upm@phdthesis@MakeLettrine{#1#2}}%
394                 \fi%
395         \fi%
396         \upm@phdthesis@reserveda%
397 }
398
399 %%--------------------
400 %% Macros for starting a chapter with a standard format
401
402 % The public interface of the macro that permits to put a lettrine
403 \newcommand{\chapterintrolettrine}[1]{%
404         \upm@phdthesis@MakeLettrine@lettrine#1%
405 }
406
407 % Output a minitoc with the standard formatting
408 \newcommand{\chapterintrominitoc}{%
409         \@ifundefined{minitoc}{}{%
410                 \begin{figure}[bt]%
411                 \minitoc%
412                 \end{figure}%
413         }%
414 }
415
416 % Add a lettrine and a minitoc at the next following \section
417 \global\long\def\chapterintrotosection#1\section{%
418         \chapterintrominitoc%
419         \ignorespaces\upm@phdthesis@MakeLettrine{}#1%
420         \expandafter\section}
421
422 % Add a lettrine and a minitoc at the next following \input
423 \global\long\def\chapterintrotoinput#1\input{%
424         \chapterintrominitoc%
425         \ignorespaces\upm@phdthesis@MakeLettrine{}#1%
426         \expandafter\input}
427
428 % Add a lettrine and a minitoc at the next following \include
429 \global\long\def\chapterintrotoinclude#1\include{%
430         \chapterintrominitoc%
431         \ignorespaces\upm@phdthesis@MakeLettrine{}#1%
432         \expandafter\include}
433
434 % No lettrine at the begining of the chapter
435 \global\long\def\upm@phdthesis@chapterintro@notoc{%
436         \ignorespaces\upm@phdthesis@MakeLettrine{}}
437
438 % Standard formating with looking forward for \section, \input, or \include
439 \gdef\chapterintro{\@ifstar\upm@phdthesis@chapterintro@notoc\chapterintrotosection}
440
441 %%--------------------
442 %% Add a small message on the backcover.
443 \Set{backcovermessage}{%
444         \begin{center}\tiny
445                 \ifthenelse{\equal{french}{\upmcurrentlang}}{
446                         Document r\'ealis\'e avec \LaTeX\ et : \\
447                         le style \LaTeX\ pour Th\`ese de Doctorat cr\'e\'e par S. Galland --- \url{http://www.multiagent.fr/ThesisStyle} \\
448                         la collection de paquets \texttt{tex-upmethodology} --- \url{http://www.arakhne.org/tex-upmethodology/}\\[.25cm]
449                 }{
450                         Document generated with \LaTeX\ and: \\
451                         the \LaTeX\ style for PhD Thesis created by S. Galland --- \url{http://www.multiagent.fr/ThesisStyle} \\
452                         the \texttt{tex-upmethodology} package suite --- \url{http://www.arakhne.org/tex-upmethodology/}\\[.25cm]
453                 }
454         \end{center}
455 }
456
457 \endinput