]> AND Private Git Repository - these_kahina.git/blob - upmethodology-p-common.sty
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
suppression thesis.pdf
[these_kahina.git] / upmethodology-p-common.sty
1 % Copyright (c) 2009-13 Stephane GALLAND <galland@arakhne.org>
2
3 % This program is free library; you can redistribute it and/or modify
4 % it under the terms of the GNU Lesser General Public License as
5 % published by the Free Software Foundation; either version 3 of the
6 % License, or any later version.
7 %
8 % This library is distributed in the hope that it will be useful, but
9 % WITHOUT ANY WARRANTY; without even the implied warranty of
10 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 % Lesser General Public License for more details.
12 %
13 % You should have received a copy of the GNU Lesser General Public
14 % License along with this library; see the file COPYING.  If not,
15 % write to the Free Software Foundation, Inc., 59 Temple Place - Suite
16 % 330, Boston, MA 02111-1307, USA.
17 %
18
19 \global\edef\upm@package@private@doctype@ver{2014/03/03}
20
21 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
22 \ProvidesPackage{upmethodology-p-common}[\upm@package@private@doctype@ver]
23
24 \RequirePackage{ifthen}
25 \RequirePackage{xspace}
26 \RequirePackage{xcolor}
27 \RequirePackage{ifpdf}
28
29 %----------------------------------------
30 % UPMVERSION MACRO
31 %----------------------------------------
32 \input UPMVERSION.def
33 \def\upm@common@parseversion@to@tex#1#2#3#4#5#6#7#8#9\@nil{#1#2#3#4/#5#6/#7#8}
34 \def\upm@common@parseversion@major#1#2#3#4#5#6#7#8#9\@nil{#1#2#3#4#5#6#7#8}
35 \edef\ver@UPMVERSION@major{\expandafter\upm@common@parseversion@major\UPMVERSION-\relax\@nil}
36 \edef\ver@UPMVERSION{\expandafter\upm@common@parseversion@to@tex\UPMVERSION\@nil}
37 \expandafter\let\csname ver@UPMVERSION.sty\endcsname\ver@UPMVERSION
38 \expandafter\let\csname ver@UPMVERSION.cls\endcsname\ver@UPMVERSION
39
40 \gdef\UPMVERSIONTEST{\ver@UPMVERSION\\\ver@UPMVERSION@major}
41
42 %----------------------------------------
43 % ARAKHNE.ORG MACRO
44 %----------------------------------------
45 \providecommand{\arakhneorg}{{\begingroup%
46         {\usefont{T1}{pzc}{m}{it}\selectfont Arakhn\^e}%
47         {\usefont{T1}{phv}{bc}{sc}\selectfont\tiny.org}\endgroup}\xspace}
48
49 %----------------------------------------
50 % CURRENT LANGUAGE
51 %----------------------------------------
52 \def\upmcurrentlang{english}
53
54 %----------------------------------------
55 % TEST MACROS
56 %----------------------------------------
57 \long\def\Ifnotempty#1{\ifthenelse{\equal{#1}{\@empty}}{}}
58 \long\def\Ifempty#1#2{\ifthenelse{\equal{#1}{\@empty}}{#2}{}}
59 \long\def\Ifelseempty#1#2#3{\ifthenelse{\equal{#1}{\@empty}}{#2}{#3}}
60
61 %----------------------------------------
62 % TOC MACROS
63 %----------------------------------------
64 \newcommand{\newpageintoc}{\addtocontents{toc}{\protect\newpage}}
65
66 %----------------------------------------
67 % DOCUMENT TYPE
68 %----------------------------------------
69 \newif\ifupmbookformat
70 \newif\ifupmreportformat
71 \newif\ifupmarticleformat
72
73 \upmbookformatfalse
74 \upmreportformattrue
75 \upmarticleformatfalse
76
77 %----------------------------------------
78 % PDF COLORS
79 %----------------------------------------
80 \newcommand{\setpdfcolor}[1]{}
81
82 %----------------------------------------
83 % CREATE COMMAND WITH ID AS NAME
84 %----------------------------------------
85 \def\upm@protect#1{\upm@p@protect #1\relax}
86 \def\upm@p@protect#1#2\relax{%
87         \ifx\relax #1%
88                 \relax
89         \else%
90                 \string #1%
91                 \ifx\relax #2%
92                         \relax
93                 \else
94                         \upm@p@protect #2\relax%
95                 \fi
96         \fi}
97
98 \def\upm@namedef#1#2{%
99         \@namedef{\upm@protect{#1}}{#2}%
100 }
101
102 \def\upm@nameuse#1{%
103         \@nameuse{\upm@protect{#1}}%
104 }
105
106 \def\upm@nameundef#1{%
107         \expandafter\let\csname\upm@protect{#1}\endcsname\relax%
108 }
109
110 \def\upm@namelet@ext#1#2{%
111         \expandafter\expandafter\let\expandafter\upm@tmp\csname#2\endcsname%
112         \global\expandafter\let\csname#1\endcsname\upm@tmp%
113 }
114
115 \def\upm@ifdefinedname#1#2#3{%
116         \expandafter\ifx\csname\upm@protect{#1}\endcsname\relax%
117                 #3%
118         \else%
119                 #2%
120         \fi%
121 }
122
123 \newcommand{\upm@column@char}{\iflanguage{french}{ :}{:}}
124
125 %----------------------------------------
126 % GET THE REFERENCE ID WITHOUT \REF
127 %----------------------------------------
128 \gdef\upm@getref#1{%
129   \expandafter\ifx\csname r@#1\endcsname\relax
130     \nfss@text{\reset@font\bfseries ??}%
131   \else
132     \expandafter\expandafter\expandafter\@car\csname r@#1\endcsname\@nil
133   \fi
134 }
135
136 \gdef\upm@getpageref@filter#1#2#3#4#5{#2}
137
138 \gdef\upm@getpageref#1{%
139   \expandafter\ifx\csname r@#1\endcsname\relax
140     \nfss@text{\reset@font\bfseries ??}%
141   \else%
142     \protected@xdef\upm@p@tmp@tmp{\protect\upm@getpageref@filter\csname r@#1\endcsname}%
143     \upm@p@tmp@tmp%
144     \global\let\upm@p@tmp@tmp\relax%
145   \fi
146 }
147
148 %----------------------------------------
149 % INTERNAL COMMAND FOR TEXT SUPPER/SUB SCRIPT
150 %----------------------------------------
151
152 \let\upm@textsuperscript\textsuperscript
153
154 \def\upm@textsubscript#1{%
155   {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
156
157
158 %----------------------------------------
159 % MACRO THAT PERMITS TO LOOP ON A SEPARATOR
160 %----------------------------------------
161
162 \newif\ifupm@foreach@hasseparator
163 \newif\ifupm@foreach@oneseparator
164
165 \let\upm@foreach@end\relax
166
167 \def\upm@foreach@rec#1{%
168         {\upm@foreach@searchseparator#1\upm@foreach@end\@nil}%
169         \ifupm@foreach@hasseparator%
170                 \protected@xdef\upm@foreach@continue{\protect\upm@foreach@rec{\upm@foreach@rest}}%
171                 \upm@foreach@body%
172                 \upm@foreach@continue%
173         \else%
174                 \ifupm@foreach@oneseparator\else%
175                         \upm@foreach@lastbody%
176                 \fi%
177         \fi%
178 }
179
180 % Loop on parts of a text given a specific separator.
181 % In the bodies, the macros \upm@foreach@term is the current data.
182 % #1: is the separator to consider
183 % #2: is the data set
184 % #3: is the body to run for each loop, except the last.
185 % #4: is the body to run for the last loop.
186 \def\upm@foreach#1\in#2\do#3#4{%
187         \global\upm@foreach@oneseparatorfalse%
188         \gdef\upm@foreach@searchseparator##1#1##2\@nil{%
189                 \gdef\upm@foreach@term{##1}%
190                 \ifx\upm@foreach@end##2%
191                         \global\upm@foreach@hasseparatorfalse%
192                 \else%
193                         \gdef\upm@foreach@rest{##2}%
194                         \global\upm@foreach@hasseparatortrue%
195                         \global\upm@foreach@oneseparatortrue%
196                 \fi%
197         }%
198         \gdef\upm@foreach@body{#3}%
199         \gdef\upm@foreach@lastbody{#4}%
200         \upm@foreach@rec{#2#1}%
201 }
202
203 %----------------------------------------
204 % MACRO THAT PERMITS TO FIND A STRING
205 %----------------------------------------
206 \def\upm@ifin#1#2{\begingroup\edef\upm@tmp{\endgroup\noexpand\in@{#1}{#2}}\upm@tmp\ifin@}
207
208 %-----------------------------------------
209 % Option parameters
210 \newif\ifupm@common@optlist@needdefault
211 \gdef\upm@common@optlist@parseparams#1=#2\@nil{%
212         \ifthenelse{\equal{#2}{===}}{%
213                 \global\upm@common@optlist@needdefaulttrue%
214         }{%
215                 \global\upm@common@optlist@needdefaultfalse%
216         }%
217 }
218 \DeclareRobustCommand{\upm@common@optlist}[1]{%
219         {\upm@common@optlist@parseparams #1====\@nil}%
220 }
221 \newcommand{\upm@setkeys}[3]{%
222         \upm@common@optlist{#3}%
223         \ifupm@common@optlist@needdefault%
224                 \expandafter\setkeys{#1}{#2=#3}%
225         \else%
226                 \expandafter\setkeys{#1}{#3}%
227         \fi%
228 }
229
230 \endinput