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

Private GIT Repository
ajout fig
[LiCO.git] / algorithm2e.sty
1 %  algorithm2e.sty --- style file for algorithms\r
2 %                      almost everything can be customized by users. See the document for more explanations\r
3 %% Copyright 1996-2008 Christophe Fiorio\r
4 %\r
5 % This program may be distributed and/or modified under the\r
6 % conditions of the LaTeX Project Public License, either version 1.2\r
7 % of this license or (at your option) any later version.\r
8 % The latest version of this license is in\r
9 %   http://www.latex-project.org/lppl.txt\r
10 % and version 1.2 or later is part of all distributions of LaTeX \r
11 % version 1999/12/01 or later.\r
12 %\r
13 % This program consists of the files algorithm2e.sty and algorithm2e.tex and algorithm2e-compatibility.sty\r
14 %  \r
15 %  Report bugs and comments to:\r
16 %  - algorithm2e-announce@lirmm.fr  mailing list for announcement about releases^^J%\r
17 %  - algorithm2e-discussion@lirmm.fr mailing list for discussion about package^^J%\r
18 %  subscribe by emailing sympa@lirmm.fr with 'subscribe <list> <firstname name>'^^J%\r
19 %\r
20 %  $Id: algorithm2e.sty,v 4.1 2009/12/15 08:54:08 cfiorio Exp $\r
21 %\r
22 %  PACKAGES REQUIRED:\r
23 %\r
24 %  - float   (in contrib/supported/float)\r
25 %  - ifthen  (in base)\r
26 %  - xspace  (in packages/tools)\r
27 %  - relsize (in contrib/misc/relsize.sty)\r
28 %\r
29 %%%%%%%%%%%%%%%  Release 4.01\r
30 %\r
31 %   Package options: \r
32 %   ---------------\r
33 %   - oldcommands                      : to use old command names\r
34 %   - french, english, german, \r
35 %     portuguese, czech, italiano,\r
36 %     slovak                           : for the name of the algorithm and some keyword code\r
37 %   - onelanguage                      : to simply switch keyword from one language to another without changing\r
38 %                                        keyword commands\r
39 %   - boxed, boxruled, ruled, tworuled, \r
40 %     algoruled, plain                 : layout of the algorithm\r
41 %   - algo2e                           : environment is algorithm2e instead of algorithms and \listofalgorithmes\r
42 %                                        instead of \listofalgorithms\r
43 %   - slide                            : to use when making slides\r
44 %   - noline,lined,vlined              : how block are designed.\r
45 %   - shortend, longend, noend         : short or long end keyword as endif for e.g.\r
46 %   - linesnumbered                    : auto numbering of the algorithm's lines\r
47 %   - linesnumberedhidden              : to hide autonumbered lines (show number on a line with \ShowLn\r
48 %   - commentsnumbered, inoutnumbered  : to autonumber comments and inout keywords (by defaut not numbered)\r
49 %   - rightnl                          : to have line number on the right instead of on the left as default\r
50 %   - algonl                           : line numbers preceded by algo number\r
51 %   - scright, scleft                  : right or left justified side comments\r
52 %   - fillcomment, nofillcomment       : end mark of comment is flushed to the right so comments fill the line\r
53 %   - dotocloa                         : add an entry in the toc for list of algorithms (require tocbibind package)\r
54 %   - endfloat                         : add algoendfloat environment pushing algorithm so written to the end of document\r
55 %   - resetcount, noresetcount         : start value of line numbers.\r
56 %   - algopart,algochapter,algosection : algo numbering within part, chapter or section\r
57 %   - titlenumbered,titlenotnumbered   : numbering of title set by \Titleofalgo\r
58 %   - figure                           : algorithms are figures, numbered as figures, and put in the list of figures.\r
59 %   - procnumbered                     : procedure or function are numbered as algorithm\r
60 %   - nokwfunc                         : procedure or function name doens't become a command\r
61 %   - norelsize                        : don't use relsize package (useful if it breaks the compatibily)\r
62 %  \r
63 %   defaults are; english,plain,resetcount,titlenotnumbered\r
64 %\r
65 %%%%%%%%%%%%%%\r
66 %\r
67 %   Short summary  \r
68 %   -------------\r
69 %  \r
70 %   algorithm is an environment for writing algorithm in LaTeX2e.\r
71 %   Almost all is customizable. You can add keywords, change style, change the layout, ...\r
72 %   It provide macros that allow you to create differents sorts of key words, therefore a set of predefined key\r
73 %   word is gived.\r
74 %\r
75 %   IT should be used as follows\r
76 %\r
77 %   \begin{algorithm}\r
78 %       ...\r
79 %       ...\r
80 %   \end{algorithm}\r
81 %\r
82 %\r
83 %   IMPORTANT : each line MUST end with \;\r
84 %\r
85 %   Note that if you define macros outside algorithm environment they\r
86 %   are avaible in all the document and particulary you can use then\r
87 %   inside all algorithms without re-define them.\r
88 %  \r
89 %   an example:\r
90 %\r
91 %   \begin{algorithm}\r
92 %     \SetAlgoLined\r
93 %     \KwIn{this text}\r
94 %     \KwOut{how to write algorithm with \LaTeX2e }\r
95 %     \r
96 %     initialization\;\r
97 %     \While{not at end of this document}{\r
98 %       read current section\;\r
99 %       \eIf{understand}{\r
100 %         go to next section\;\r
101 %         current section becomes this one\;\r
102 %         }{\r
103 %         go back to the beginning of current section\;\r
104 %         }\r
105 %       }\r
106 %     \caption{How to write algorithm}\r
107 %   \end{algorithm}\r
108 %\r
109 %\r
110 %%%%%%%%%%%%%%         predefined keywords\r
111 %\r
112 %     \KwIn{input}\r
113 %     \KwOut{output}\r
114 %     \KwData{input}\r
115 %     \KwResult{output}\r
116 %     \KwTo                                       % a simple keyword\r
117 %     \KwFrom                                     % a simple keyword\r
118 %     \KwRet{[value]}\r
119 %     \Return{[value]}\r
120 %     \Begin{block inside}\r
121 %     \eIf{condition}{Then Block}{Else block}     % in blocks\r
122 %     \If{condition}{Then block}                  % in a block\r
123 %     \uIf{condition}{Then block}                 % in a block unended\r
124 %     \lIf{condition}{Else text}                  % on the same line\r
125 %     \Else{inside Else}                          % in a block\r
126 %     \lElse{Else text}                           % on the same line        \r
127 %     \uElse{Else text}                           % in a block unended\r
128 %     \ElseIf{inside Elseif}                      % in a block\r
129 %     \lElseIf{Elseif text}                       % on the same line        \r
130 %     \uElseIf{Elseif text}                       % in a block unended\r
131 %     \Switch{Condition}{Switch block}\r
132 %     \Case{a case}{case block}                   % in a block\r
133 %     \lCase{a case}{case text}                   % on the same line\r
134 %     \Other{otherwise block}                     % in a block\r
135 %     \lOther{otherwise block}                    % on the same line\r
136 %     \For{condition}{text loop}                  % in a block\r
137 %     \lFor{condition}{text}                      % on the same line\r
138 %     \ForEach{condition}{text loop}              % in a block\r
139 %     \lForEach{condition}{text}                  % on the same line\r
140 %     \ForPar{condition}{text loop}               % in a block\r
141 %     \lForPar{condition}{text}                   % on the same line\r
142 %     \While{condition}{text loop}                % in a block\r
143 %     \lWhile{condition}{text loop}               % on the same line\r
144 %     \Repeat{End condition}{text loop}           % in a block\r
145 %     \lRepeat{condition}{text}                   % on the same line\r
146 %\r
147 %%%%%%%%%%%%%%\r
148 %\r
149 %   History: \r
150 %\r
151 %   - december 14 2009 - revision 4.01\r
152 %                     * ADD : new command \SetKwHangingKw{Name}{text} (hanging indent with keyword): This creates a\r
153 %                             hanging indent much like \texttt{SetKwInput}, except that it removes the trailing `:'\r
154 %                             and does not reset numbering.\r
155 %\r
156 %   - november 17 2009  - revision 4.00 -\r
157 %\r
158 %                      * CHANGE : IMPORTANT : some commands have been renamed to have consistent naming (CamlCase\r
159 %                                 syntax) and old commands are no more available. If you doesn't want to change\r
160 %                                 your mind or use old latex files, you can use oldcommands option to enable old\r
161 %                                 commands back.\r
162 %                                 text. Here are these commands:\r
163 %                                 - \SetNoLine becomes \SetAlgoNoLine\r
164 %                                 - \SetVline  becomes \SetAlgoVlined\r
165 %                                 - \Setvlineskip  becomes \SetVlineSkip\r
166 %                                 - \SetLine   becomes \SetAlgoLined\r
167 %                                 - \dontprintsemicolon becomes \DontPrintSemicolon\r
168 %                                 - \printsemicolon becomes \PrintSemicolon\r
169 %                                 - \incmargin becomes \IncMargin\r
170 %                                 - \decmargin becomes \DecMargin\r
171 %                                 - \setnlskip becomes \SetNlSkip\r
172 %                                 - \Setnlskip becomes \SetNlSkip\r
173 %                                 - \setalcapskip becomes \SetAlCapSkip\r
174 %                                 - \setalcaphskip becomes \SetAlCapHSkip\r
175 %                                 - \nlSty becomes \NlSty\r
176 %                                 - \Setnlsty becomes \SetNlSty\r
177 %                                 - \linesnumbered becomes \LinesNumbered\r
178 %                                 - \linesnotnumbered becomes \LinesNotNumbered\r
179 %                                 - \linesnumberedhidden becomes \LinesNumberedHidden\r
180 %                                 - \showln becomes \ShowLn\r
181 %                                 - \showlnlabel becomes \ShowLnLabel\r
182 %                                 - \nocaptionofalgo becomes \NoCaptionOfAlgo\r
183 %                                 - \restorecaptionofalgo becomes \RestoreCaptionOfAlgo\r
184 %                                 - \restylealgo becomes \RestyleAlgo\r
185 %                                 - gIf macros and so on do no more exist\r
186 %                      * NEW: - Compatibily with other packages improven by changing name of internal\r
187 %                               macros. Algorithm2e can now be used with arabtex for example, if this last is\r
188 %                               loaded after algorithm2e package.\r
189 %                      * ADD: - OPTION endfloat: endfloat packages doesn't allow float environment inside other\r
190 %                               environment. So using it with figure option of algorithm2e makes error. This\r
191 %                               option enables a new environment algoendfloat to be used instead of algorithm\r
192 %                               environment that put algorithm at the end. algoendfloat environment make\r
193 %                               algorithm acting as endfloat figures. This option requires endfloat packages.\r
194 %                      * ADD: - OPTION norelsize: starting from this release (v4.00), algorithm2e package uses\r
195 %                               relsize package in order to get relative size for lines numbers; but it seems\r
196 %                               that some rare classes (such as inform1.cls) are not compatible with relsize; to\r
197 %                               have algorithm2e working, this option makes algorithm2e not to load relsize\r
198 %                               package and go back to previous definition by using \scriptsize font for lines\r
199 %                               numbers.\r
200 %                      * ADD: - OPTION onelanguage: allow, if using standard keywords listed below, to switch\r
201 %                               from one language to another without changing keywords by using appropriate\r
202 %                               language option :\r
203 %                               . KwIn, KwOut, KwData, KwResult\r
204 %                               . KwTo KwFrom\r
205 %                               . KwRet, Return\r
206 %                               . Begin\r
207 %                               . Repeat\r
208 %                               . If, ElseIf, Else\r
209 %                               . Switch, Case, Other\r
210 %                               . For, ForPar, ForEach, ForAll, While\r
211 %                               .\r
212 %                      * ADD: - OPTION rightnl: put lines numbers to the right of the algorithm instead of left.\r
213 %                      * ADD:   new commands \setRightLinesNumbers and \setLeftLinesNumbers which sets the lines\r
214 %                               numbers to the right or to the left of the algorithm.\r
215 %                      * ADD: - new kind of keywords : KwArray used to define arrays:\r
216 %                               \SetKwArray{Kw}{array} defines an array keywords Kw called array and printed in\r
217 %                               DataSty style when call with \Kw. It can be used with one argument which\r
218 %                               denotes the element index: \Kw{n} prints array[n] with array in DataSty and n in\r
219 %                               ArgSty.\r
220 %                      * ADD/FIX: rules of ruled, algoruled, tworuled styles used rules of different sizes! This\r
221 %                                 is now fixed. Moreover size of the rules is now controlled by a length and so\r
222 %                                 can be customized by the user.\r
223 %                                 \algoheightrule is the height of the rules and can be changed via \setlength\r
224 %                                 \algoheightruledefault is the default height of he rules (0.8pt)\r
225 %                                 \algotitleheightrule is the height of the rule that comes just after the\r
226 %                                 caption in ruled and algoruled style; it can be changed via \setlength\r
227 %                                 \algotitleheightruledefault is the default height of this rules (0.8pt)\r
228 %                                 Thanks to Philippe Dumas who reports the bug and make the suggestion.\r
229 %                      * ADD: - \SetAlgoCaptionSeparator which sets the separator between Algorithm 1 and the\r
230 %                               title. By default it's ':' and caption looks like "Algorithm 2: title" but now\r
231 %                               you can change it by using for example \SetAlgoCaptionSeparator{.} which will\r
232 %                               give "Algorithm 3. title"\r
233 %                      * ADD: - \SetAlgoLongEnd and \SetAlgoShortEnd and \SetAlgoNoEnd commands which act as\r
234 %                               corresponding package options\r
235 %                      * ADD: - OPTIONS italiano and slovak as new language (thanks to Roberto Posenato and\r
236 %                               Miroslav Binas) \r
237 %                      * CHANGE: - Fnt and Sty macro to have consistent use and naming (see below)\r
238 %                      * ADD: - \AlCapSty, \AlCapNameSty, \AlCapFnt, \AlCapNameFnt, \ProcSty, \ProcFnt,\r
239 %                               \ProcNameSty, \ProcNameFnt, \ProcArgSty, ProcArgFnt and corresponding "set macro" \r
240 %                               \SetAlCapSty, \SetAlCapNameSty, \SetAlCapFnt, \SetAlCapNameFnt, \SetProcSty,\r
241 %                               \SetProcFnt, \SetProcNameSty, \SetProcNameFnt, \SetProcArgSty, \SetProcArgFnt which\r
242 %                               control the way caption is printed. Sty macro use command taking one parameter as\r
243 %                               argument, Fnt macros use directly command. In Fact caption is printed as follow :\r
244 %                               \AlCapSty{\AlCapFnt Algorithm 1:}\AlCapNameSty{\AlCapNameFnt my algorithm}\r
245 %                               By default, \AlCapSty is textbf and \AlCapFnt is nothing. \AlCapNameSty keep text \r
246 %                               as it is, and \AlCapNameFnt do nothing also.\r
247 %                               You can redefine \AlCapFnt and \AlCapNameFnt by giving macro to \Set commands. For\r
248 %                               example, you can do \SetAlCapFnt{\large} to see Algorithm printed in \large font.\r
249 %                               You can redefine \AlCapSty, \AlCapFnt, \AlCapNameSty and \AlCapNameFnt with the\r
250 %                               corresponding \Set command. For the Sty commands, you have to give in parameter\r
251 %                               name of a macro (whithout \)  which takes one argument. For example,\r
252 %                               \SetAlCapFnt{textbf} defines the default behaviour. If you want to do more\r
253 %                               complicated thing, you should define your own macro and give it to \SetAlCapFnt or\r
254 %                               \SetAlCapNameFnt. Here are two examples:\r
255 %                               - \newcommand{\mycapsty}[1]{\tiny #1}\SetAlCapNameSty{mycapsty}\r
256 %                               - \newcommand{\mycapsty}[1]{\textsl{\small #1}}\SetAlCapNameSty{mycapsty}\r
257 %                               Or you can combine the two, for the last example you can also do:\r
258 %                               \SetAlCapNameSty{textsl}\SetAlCapNameFnt{\small}\r
259 %                               Thanks to Jan Stilhammer who gives me the idea of \AlCapNameFnt.\r
260 %                      * CHANGE \AlTitleFnt to match definition of all other Fnt macros and add a \AlTitleSty \r
261 %                               macro (see below) . Now you set \AlTitleFnt by calling \SetAlTitleFnt with \r
262 %                               directly a macro without parameter in argument:\r
263 %                               Example: \SetAlTitleFnt{\small} to set title in small font.\r
264 %                      * ADD: - \AlTitleSty and \SetAlTitleSty commands to set a style for title. These commands\r
265 %                               are defined from a macro taking the text in argument, as \textbf for example. \r
266 %                               To set the TitleSty you have to give name of the macro (without the '\') \r
267 %                               to \SetAlTitleSty. For example \SetAlTitleSty{textbf} to set \textbf style.\r
268 %                      * ADD: - new command \SetAlgorithmName{algorithmname}{list of algorithms name} which\r
269 %                               redefines name of the algorithms and the sentence list of algorithms. Second\r
270 %                               argument is the name that \autoref, from hyperref package, will use. Example:\r
271 %                               \SetAlgorithmName{Protocol}{List of protocols} if you prefer protocol than\r
272 %                               algorithm.\r
273 %                      * ADD: - new \SetAlgoRefName{QXY} which change the default ref (number of the algorithm) by\r
274 %                               the name given in parameter (QXY in the example). \r
275 %                      * ADD: - new command \SetAlgoRefRelativeSize{-2} which sets the output size of refs, defined\r
276 %                               by \SetAlgoRefName, used in list of algorithms.\r
277 %                      * ADD: - two dimensions to control the layout of caption in ruled, algoruled and boxruled\r
278 %                               algorithms:\r
279 %                               - interspacetitleruled (2pt by defaut) which controls the vertical space between\r
280 %                                 rules and title in ruled and algoruled algorithms.\r
281 %                               - interspaceboxruled (2\lineskip by default) which controls the vertical space\r
282 %                                 between rules and title in boxruled algorithms.\r
283 %                               These two dimensions can be changed by using \setlength command.\r
284 %                      * ADD: - With the fix (see below) of procedure and function environments, a new feature has\r
285 %                               been added: the name of the procedure or function set in caption is automatically\r
286 %                               defined as a KwFunction and so can be used as a macro. For example, if inside a\r
287 %                               procedure environment you set \caption{myproc()}, you can use \myproc macro in you\r
288 %                               main text. Beware that the macro is only defined after the \caption!\r
289 %                      * ADD: - OPTION nokwfunc to unable the new feature described above in function and\r
290 %                               procedure environment. Useful if you use name of procedure or function that cannot\r
291 %                               be a command name as a math display for example.\r
292 %                      * ADD: - \SetAlgoNlRelativeSize{number} command which sets the relative size of line\r
293 %                               numbers. By default, line numbers are two size smaller than algorithm text. Use\r
294 %                               this macro to change this behavior. For example, \SetAlgoNlRelativeSize{0} sets it\r
295 %                               to the same size, \SetAlgoNlRelativeSize{-1} to one size smaller and\r
296 %                               \SetAlgoNlRelativeSize{1} to one size bigger\r
297 %                      * ADD: - \SetAlgoProcName{aname} command which sets the name of Procedure printed by\r
298 %                               procedure environment (the environment prints Procedure by default). Second\r
299 %                               argument is the name that \autoref, from hyperref package, will use.\r
300 %                      * ADD: - \SetAlgoFuncName{aname} command which sets the name of Function printed by\r
301 %                               procedure environment (the environment prints Function by default). Second\r
302 %                               argument is the name that \autoref, from hyperref package, will use. \r
303 %                      * ADD: - \SetAlgoCaptionLayout{style} command which sets style of the caption; style must\r
304 %                               be the name of a macro taking one argument (the text of the caption). Examples\r
305 %                               below show how to use it:\r
306 %                               . \SetAlgoCaptionLayout{centerline} to have centered caption\r
307 %                               . \SetAlgoCaptionLayout{textbf} to have bold caption\r
308 %                               If you want to apply two styles in the same time, such as centered bold, you have\r
309 %                               to define you own macro and then use \SetAlgoCaptionLayout with its name.\r
310 %                      * ADD: - OPTION procnumbered: which makes the procedure and function to be numbered as\r
311 %                               algorithm\r
312 %                      * ADD: - OPTIONS tworuled and boxruled\r
313 %                               these are two new layouts: tworuled acts like ruled but doesn't put a line after\r
314 %                               caption ; boxruled surround algorithm by a box, puts caption above and add a line\r
315 %                               after caption.\r
316 %                      * REMOVE: - SetKwInParam has been deleted since not useful itself because of different\r
317 %                                macros which can do the same in a better and a more consistent way as\r
318 %                                SetKwFunction or SetKw.\r
319 %                      * FIX: - line number is now correctly vertically aligned with math display.\r
320 %                      * FIX: - references with hyperref. No more same identifier or missing name error. BUT now\r
321 %                               you must NOT use naturalnames option of hyperref packages if you do PdfLaTeX\r
322 %                      * FIX: - autoref with hyperref package (thanks to Jörg Sommer who notices the problem).\r
323 %                      * FIX: - titlenumbered was not working! fixed.\r
324 %                      * FIX: - Else(){} acted like uElse. Corrected.\r
325 %                      * FIX: - noend management: when a block was inside another and end of block was following\r
326 %                               each other, a blank line was added: it's now corrected.\r
327 %                      * FIX: - Function and Procedure environment was no more working as defined originally: the\r
328 %                               label was no more name of the procedure, it acts always as if procumbered option\r
329 %                               has been used.\r
330 %                      * FIX: - line numbers had a fixed size which can be bigger than algorithm text accordingly\r
331 %                               to \AlFnt set (see also new command \SetAlgoNlRelativeSize above)\r
332 %                      * FIX: - semicolon in comments when dontprintsemicolon is used.\r
333 %                      * FIX: - listofalgorithms adds a vertical space before first algo of a chapter as for\r
334 %                               listoffigures or listoftables\r
335 %                      * FIX: - listofalgorithms with twocolumns mode and some classes which don't allow onecolumn\r
336 %                               and so don't define \if@restonecol as prescribed in LaTeX (sig-alternate for\r
337 %                               example)\r
338 %                      * FIX: - algorithm2e now works with elsart cls and some more classes.\r
339 %                      * FIX: - blocks defined by SetKwBlock act now as other blocks (if for instance) and don't\r
340 %                               write end in vlined mode, instead they print a small horizontal line as required\r
341 %                               by the option.\r
342 %                      * FIX: - underfull hbox warning at each end of algorithm environment removed.\r
343 %\r
344 %                      * INTERNAL CHANGE: - short end keyword are deduce from long end keyword by keeping the\r
345 %                                           first one. Allows to avoid double definition.\r
346 %                      * INTERNAL CHANGE: - procedure, function and algorithm are now resolved by the same\r
347 %                               environment to avoid code duplication. \r
348 %\r
349 %   - October  04 2005  - revision 3.9 -\r
350 %                      * ADD: - \setalcaphskip command which sets the horizontal skip before Algorithm: in caption\r
351 %                               when used in ruled algorithm.\r
352 %                      * ADD: - \SetAlgoInsideSkip command which allows to add an extra vertical space before and\r
353 %                               after the core of the algorithm (ie: \SetAlgoInsideSkip{bigskip}) \r
354 %                      * CHANGE: - caption, when used with figure option, is no more controlled by algorithm2e\r
355 %                                  package and so follows the exact behaviour of figures. The drawback is that you\r
356 %                                  cannot change the typo with AlTitleFnt or CapFnt. The avantage is that if you\r
357 %                                  use caption package, it works.\r
358 %                      * FIX: - problem with numbering line and pdflatex\r
359 %                      * FIX: - error when algorithm2e package was used with beamer and listings together\r
360 %   - February 12 2005  - revision 3.8 -\r
361 %                      * FIX: - extra line with noend option.\r
362 %   - February 10 2005  - revision 3.7 -\r
363 %                      * ADD: - sidecomment: different macros allowing to put text right after code on the same\r
364 %                               line. They are defined in the same time comment macros are defined with a star\r
365 %                               after the macro name. By default comments are right justified but this can be\r
366 %                               change with appropriate option in the macro. Ex:\r
367 %                               . default: \tcc*{side comment}\r
368 %                               . same as previous: \tcc*[r]{side comment}\r
369 %                               . left justify: \tcc*[l]{side comment}\r
370 %                               . here: \tcc*[h]{side comment} don't put the end of line mark before\r
371 %                                       comment (; by default) and don't end the line.\r
372 %                               . flushed: \tcc*[f]{side comment} same as the precedent but right\r
373 %                                 justified\r
374 %                      * ADD: - OPTION scright (default): right justified side comments (side comments\r
375 %                               are flushed to the righr)\r
376 %                      * ADD: - OPTION scleft: left justified side comments (side comments are put right after the\r
377 %                               code line)\r
378 %                      * ADD: - \SetSideCommentLeft acts as scleft option\r
379 %                      * ADD: - \SetSideCommentRight acts as scright option\r
380 %                      * ADD: - block like macro side text: all macro defining a block allows now to put text right\r
381 %                               after key words by putting text into (). Done to be used with sidecomment macros,\r
382 %                               but all text can be used. \r
383 %                               Ex: \eIf(\tcc*[f]{then comment}){test}{then text}(else side text){else text}\r
384 %                      * ADD: - OPTION fillcomment (default): end mark of comment is flushed to the right so\r
385 %                               comments fill all the width of text.\r
386 %                      * ADD: - OPTION nofillcomment: end mark of comment is put right after the comment.\r
387 %                      * ADD: - \SetNoFillComment acts as nofillcomment option.\r
388 %                      * ADD: - \SetFillComment acts as fillcomment option.\r
389 %                      * ADD: - OPTION dotocloa: which adds an entry in the toc for the list of algorithms. This\r
390 %                               option load package tocbibind if not already done and so list of figures and list\r
391 %                               of tables are also added in the toc. If you want to control which ones of the lists\r
392 %                               will be added in the toc, please load package tocbibind before package algorithm\r
393 %                               and give it the options you want.\r
394 %                      * FIX: - vertical spacing for uif macro with noend option\r
395 %                      * FIX: - all the compatibility problems between caption and other packages\r
396 %                      * FIX: - typographical differences between list of algorithms and other lists  when in\r
397 %                               report or book \r
398 %\r
399 %   - January 24 2005  - revision 3.6 -\r
400 %                      * FIX: - vertical spacing and space characters at the beginning or end of comments.\r
401 %                               line numbers of comments not in the NlSty.\r
402 %                               Thanks to Arnaud Giersch for his comments and suggestions.\r
403 %                      * FIX: - Set*Sty macro: the styles defined was not protected and was modified by surrounding\r
404 %                               context. For example KwTo in a \For{}{} was in bold AND italic instead of just in\r
405 %                               bold.\r
406 %                      * FIX: - line number misplacement after \Indp\r
407 %\r
408 %   - January 21 2005  - revision 3.5 -\r
409 %                      * ADD: - hidden numbering of the lines. Lines are auto-numbered but numbers are shown only\r
410 %                               on lines you specify:\r
411 %                               * linesnumberedhidden option or \LinesNumberedHidden macro activate this\r
412 %                                 functionnality.\r
413 %                               * \ShowLn and \ShowLnLabel{lab} macros make the number visible on the\r
414 %                               line. \ShowLnLabel{lab} allows to set a label for this line. \r
415 %                               Thanks to Samson de Jager who makes this suggestion and provides the macros.\r
416 %                      * ADD: - \AlCapFnt and \SetAlCapFnt which allow to have a different font for\r
417 %                               caption. Works like \AlFnt and \SetAlFnt and by default is the same.\r
418 %                      * ADD: - \AlCapSkip skip length. This vertical space is added before caption in plain ou\r
419 %                               boxed mode. It allows to change distance between text and caption.\r
420 %                      * FIX: - caption compatible with IEEEtran class. \r
421 %                      * FIX: - some vertical spacing error with \uIf macros (Thanks to Arnaud Giersch)\r
422 %                      * FIX: - Procedure and Function: lines are also numbered like algorithms\r
423 %                      * FIX: - CommentSty was not used for Comments\r
424 %\r
425 %   - January 10 2005  - revision 3.4 -\r
426 %                      * FIX: - caption compatible with new release of Beamer class. \r
427 %\r
428 %   - June 16 2004     - revision 3.3 - \r
429 %                      * FIX: - Hyperlink references of Hyperref package works now if compiled with pdflatex \r
430 %                               and [naturalnames] option of hyperref package is used.\r
431 %                      * FIX: - algorithm[H] had problem in an list environment - corrected\r
432 %                      * FIX: - interline was not so regular in nested blocks - corrected\r
433 %                      * ADD  - \SetVlineSkip macro which sets the vertical skip after the little horizontal \r
434 %                               rule which closes a block in Vlined mode. By default 0.8ex\r
435 %\r
436 %   - June 11 2004     - revision 3.2 - AUTO NUMBERING LINES !!!\r
437 %                      * ADD: auto numbering of the lines (the so asked and so long awaiting feature)\r
438 %                             this feature is managed by 3 options and 3 commands:\r
439 %                             - linesnumbered option: lines of the algo are numbered except for comments and\r
440 %                               input/output (KwInput and KwInOut)\r
441 %                             - commentsnumbered option: makes comments be numbered\r
442 %                             - inoutnumbered option: makes data input/output be numbered\r
443 %                             - \nllabel{lab} labels the line so you can cite with \ref{lab}\r
444 %                             - \LinesNumbered make the following algorithms having auto-numbered lines\r
445 %                             - \linesnotnumbered make the following algorithms having no auto-numbered lines\r
446 %                      * Change: algo2e option renames listofalgorithms in listofalgorithmes\r
447 %                      * FIX: new solution for compatibility with color package, more robust and not tricky.\r
448 %                             Many thanks to David Carlisle for his advices\r
449 %\r
450 %   - June 09 2004     - revision 3.1 -\r
451 %                      * Change: \SetKwSwitch command defines an additionnal macro \uCase and \Case prints end\r
452 %                      * Change: now macros SetKw* do a renewcommand if the keyword is already defined. So you can\r
453 %                                redefine default definition at your own convenience or change your definition\r
454 %                                without introducing a new macro and changing your text.\r
455 %                      * ADD: new macro \SetKwIF which do \SetKwIf and\r
456 %                             \SetKwIfElseIf.The following default definition has been added:\r
457 %                             \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif}\r
458 %                             and so you get the macros;\r
459 %                             \If \eIf \lIf \uIf \ElseIf \uElseIf \lElseIf \Else \uElse \lElse\r
460 %                      * ADD: new macro \SetAlgoSkip which allow to fix the vertical skip before and after the\r
461 %                             algorithms. Default is smallskip, do \SetAlgoSkip{} if you don't want an extra space\r
462 %                             or \SetAlgoSkip{medskip} or \SetAlgoSkip{bigskip} if you want bigger space.\r
463 %                      * ADD: macro \SetKwIf defines in addition a new macro \uElse  (depending on wat name you\r
464 %                             have given in #2 arg).\r
465 %                      * ADD: macro \SetKwIfElseIf defines in addition a new macro \uElse and \ugElseIf (depending\r
466 %                             on what name you have given in #2 and #3 arg).\r
467 %                      * Change: baseline of algorithm is now top, so two algorithms can be put side by side.\r
468 %                      * FIX: Compatibility with color package solved. The problem was due to a redefinition of\r
469 %                             standard macros by color package. This solves compatibility problem with other\r
470 %                             packages as pstcol or colortbl. (notified by Dirk Fressmann, Antti Tarvainen and Koby\r
471 %                             Crammer)\r
472 %                      * Fix: extra little shift to the right with boxed style algorithm removed (notified by\r
473 %                             P. Tanovski)\r
474 %                      * Fix: algoln option was buggy (notified bye Jiaying Shen)\r
475 %                      * Fix: german and portuges option didn't work due to bad typo (notified by Martin Sievers,\r
476 %                             Thorsten Vitt and Jeronimo Pellegrini)\r
477 %                      \r
478 %   - February 13 2004 - revision 3.0 -\r
479 %                      * Major revision which makes the package independent from float.sty, so now\r
480 %                        - algorithm* works better, in particular can be used in multicols environments\r
481 %                        - (known bug corrected)\r
482 %                          [H] works now for all sort of environment but is handled differently for classic\r
483 %                          environment and star environment (algorithm, figure, procedure and function). For star\r
484 %                          environment, H acts like for classical figure environment, so it doesn't stay here\r
485 %                          absolutely.\r
486 %                        - (known bug corrected)\r
487 %                          you can use now floatflt package with algorithm package and even with figure\r
488 %                          option. Beware that if you want to put an algorithm inside a floatingfigure, it cannot\r
489 %                          be floating, so [H] is required and then figure option should not be used, since\r
490 %                          standard figure[H] are still floating with LaTeX.\r
491 %                      * boxruled: a new style added. Possible now since no style no more defined by the float\r
492 %                        package.\r
493 %                      * nocaptionofalgo: dosen't print Algorithm #: in the caption for algorithm in ruled or\r
494 %                        algoruled style.\r
495 %                        note: this is just documentation of a macro which was already in the package.\r
496 %   - December 14 2003 - revision 2.52 -\r
497 %                      * output message shorter\r
498 %                      * french keyword macro \PourTous was missing for longend option, it has been added.\r
499 %                      * TitleofAlgo prints Function or Procedure in corresponding environments.\r
500 %\r
501 %   - October 27 2003  - revision 2.51 - Revision submitted to CTAN archive\r
502 %                      * correction of a minor which make caption in procedure\r
503 %                        and function to be blanck with pdfscreen package\r
504 %                        (thanks to Joel Gossens for the notification)\r
505 %                      * add two internal definition to avoid some errors when\r
506 %                        used with Hyperref package (Hyperref package need to\r
507 %                        define new counter macro from existing ones, and\r
508 %                        don't do it for algorithm2e package, so we do it)\r
509 %\r
510 %   - October 17 2003  - revision 2.50 - first revision for CTAN archive\r
511 %                      * add \AlFnt and \SetAlFnt{font} macros: \AlFnt is used at the beginning of the caption and\r
512 %                        the body of algorithm in order to define the fonts used for typesetting algorithms. You\r
513 %                        can use it elsewhere you want to typeset text as algorithm. For example you can do\r
514 %                        \SetAlFnt{\small\sf} to have algorithms typeset in small sf font. Default is nothing so\r
515 %                        algorithm is typeset as the text of the document.\r
516 %                      * add \AlTitleFnt{text} and \SetAlTitleFnt{font} macros: The {Algorithm: } in the caption is\r
517 %                        typeset with \AlTitleFnt{Algorithm:}. You can use it to have text typeset as {Algorithm:}\r
518 %                        of captions. Default is textbf.  Default can be redefined by \SetAlTitleFnt{font}, for\r
519 %                        example you can do \SetAlTitleFnt{emph}\r
520 %                      * add CommentSty typo for text comment.  \r
521 %                      * add some compatibility with hyperref package (still an error on multiply defined refs but\r
522 %                        pdf correctly generated)\r
523 %                      * flush text to left in order to have correct indentation even with class as amsart which\r
524 %                        center all figures\r
525 %                      * add german, portugues and czech options for title of algorithms and typo.\r
526 %                      * add portuguese translation of predefined keywords * add czech translation of some\r
527 %                        predefined keywords\r
528 %\r
529 %   - December 23 2002 - revision 2.40\r
530 %                      * add some french keyword missing\r
531 %                      * add function* and procedure* environment like algorithme* environment: print in one column\r
532 %                        even if twocolumn option is specified for the document.\r
533 %                      * add a new macro \SetKwComment to define macro which writes comments in the text. First\r
534 %                        argument is the name of the macro, second is the text put before the comment, third is the\r
535 %                        text put at the end of the comment.Default are \tcc and \tcp\r
536 %                      * add new options to change the way algo are numbered:\r
537 %                        [algopart] algo are numbered within part (counter must exist)\r
538 %                        [algochapter] algo are numbered within chapter\r
539 %                        [algosection] algo are numbered within section\r
540 %\r
541 %   - March 27 2002   - revision 2.39\r
542 %                      * Gilles Geeraerts: added the \SetKwIfElseIf to manage\r
543 %                        if (c)\r
544 %                             i;\r
545 %                        else if (c)\r
546 %                             i;\r
547 %                        ...\r
548 %                        else\r
549 %                             i;\r
550 %                        end\r
551 %                      * Also added \gIf \gElseIf \gElse.\r
552 %\r
553 %   - January 02 2001 - revision 2.38\r
554 %                      * bugs related to the caption in procedure and function\r
555 %                        environment are corrected.\r
556 %                      * bug related to option noend (extra vertical space added\r
557 %                        after block command as If or For) is corrected.\r
558 %                      * czech option language added (thanks to Libor Bus: l.bus@sh.cvut.cz).\r
559 %  \r
560 %   - October 16 2000 - revision 2.37\r
561 %                      * option algo2e added: change the name of environment\r
562 %                        algorithm into algorithm2e. So allow to use the package\r
563 %                        with some journal style which already define an algorithm\r
564 %                        environment.\r
565 %  \r
566 %   - September 13 2000 - revision 2.36\r
567 %                      * option slide added: require package color\r
568 %                      * Hack for slide class in order to have correct\r
569 %                        margins\r
570 %  \r
571 %   - November 25 1999 - revision 2.35\r
572 %                      * revision number match RCS number\r
573 %                      * Thanks to David A. Bader, a new option is added:\r
574 %                        noend: no end keywords are printed.\r
575 %  \r
576 %   - November 19 1999 - revision 2.32\r
577 %                      * minor bug on longend option corrected.\r
578 %  \r
579 %   - August 26 1999 - revision 2.31\r
580 %                      * add an option : figure\r
581 %                        this option makes algorithms be figure and so are numbered\r
582 %                        as figures, have Figure as caption and are put in \r
583 %                        the \listoffigures\r
584 %  \r
585 %   - January 21 1999 - revision 2.3 beta\r
586 %                    add 2 new environments: procedure and function.\r
587 %                    These environments works like algorithm environment but:\r
588 %                    - the ruled (or algoruled) style is imperative.\r
589 %                    - the caption now writes Procedure name....\r
590 %                    - the syntax of the \caption command is restricted as\r
591 %                      follow: you MUST put a name followed by 2 braces like\r
592 %                      this ``()''. You can put arguments inside the braces and\r
593 %                      text after. If no argument is given, the braces will be\r
594 %                      removed in the title. \r
595 %                    - label now puts the name (the text before the braces in the\r
596 %                      caption) of the procedure or function as reference (not\r
597 %                      the number like a classic algorithm environment).\r
598 %                    There are also two new styles : ProcNameSty and\r
599 %                    ProcArgSty. These style are by default the same as FuncSty\r
600 %                    and ArgSty but are used in the caption of a procedure or a\r
601 %                    function.\r
602 %                    \r
603 %   - November 28 1996 - revision 2.22\r
604 %                    add a new macro \SetKwInParam{arg1}{arg2}{arg3}:\r
605 %                    it defines a macro \arg1{name}{arg} which prints name in keyword\r
606 %                    style followed byt arg surrounded by arg2 and arg3. The main\r
607 %                    application is to a function working as \SetKwInput to be used\r
608 %                    in the head of the algorithm. For example\r
609 %                    \SetKwInParam{Func}{(}{)} allows\r
610 %                    \Func{functionname}{list of arguments} which prints:\r
611 %                    \KwSty{functioname(}list of arguments\KwSty{)}\r
612 %       \r
613 %\r
614 %   - November 27 1996 - revision 2.21 :\r
615 %                    minor bug in length of InOut boxes fixed.\r
616 %                    add algorithm* environment.\r
617 %\r
618 %   - July 12 1996 - revision 2.2 : \SetArg and \SetKwArg macros removed.\r
619 %                        \r
620 %                    \SetArg has been removed since it never has been\r
621 %                    documented.\r
622 %                    \SetKwArg has been removed since \SetKw can now\r
623 %                    take an argument in order to be consistent with\r
624 %                    \SetKwData and \SetKwFunction macros.\r
625 %\r
626 %   - July 04 1996 - revision 2.1 : still more LaTeX2e! Minor compatibility break\r
627 %\r
628 %                    Macros use now \newcommand instead of \def, use of \setlength, \r
629 %                    \newsavebox, ... and other LaTeX2e specific stuff.\r
630 %                    The compatibility break:\r
631 %                    - \SetData becomes \SetKwData to be more consistent. So the old \r
632 %                      \SetKwData becomes \SetKwInput\r
633 %                    - old macros \titleofalgo, \Freetitleofalgo and \freetitleofalgo\r
634 %                      from LaTeX209 version which did print a warning message and call \r
635 %                      \Titleofalgo in version 2.0 are now removed!\r
636 %\r
637 %   - March 13 1996 - revision 2.0: first official major revision.\r
638 %   \r
639 %\r
640 %%%%%%%%%%%%%%\r
641 %\r
642 %   Known bugs: \r
643 %   -----------\r
644 %   - no more known bugs... all are corrected!\r
645 %\r
646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
647 %\r
648 % for more complete informations you can see algorithm2e.tex\r
649 %\r
650 %\r
651 %%%%%%%%%%%%%%%%%%%%%%%% Identification Part %%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
652 %\r
653 \NeedsTeXFormat{LaTeX2e}[1994/12/01]\r
654 %\r
655 \ProvidesPackage{algorithm2e}[2008/00/00 v3.10 algorithms environments]\r
656 %\r
657 %\r
658 %%%%%%%%%%%%%%%%%%%%%%%%%%% Initial Code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
659 %\r
660 \@makeother\*% some package redefined it as a letter (as color.sty)\r
661 \def\@firstword#1 #2\@nil{#1}% an useful fonction\r
662 %\r
663 % definition of commands which can be redefined in options of the package.\r
664 %\r
665 \newcounter{AlgoLine}%\r
666 \setcounter{AlgoLine}{0}%\r
667 %\r
668 \newcommand{\algocf@algocfref}{\relax}%\r
669 \newcommand{\listalgorithmcfname}{}%\r
670 \newcommand{\algorithmcfname}{}%\r
671 \@ifundefined{algorithmautorefname}{\newcommand{\algorithmautorefname}{algorithm}}{\renewcommand{\algorithmautorefname}{algorithm}}%\r
672 \newcommand{\algorithmcflinename}{}%\r
673 \newcommand{\algocf@typo}{}%\r
674 \newcommand{\@algocf@procname}{}\newcommand{\procedureautorefname}{}%\r
675 \newcommand{\SetAlgoProcName}[2]{\renewcommand{\@algocf@procname}{#1}\renewcommand{\procedureautorefname}{#2}}%\r
676 \newcommand{\@algocf@funcname}{}\newcommand{\functionautorefname}{}%\r
677 \newcommand{\SetAlgoFuncName}[2]{\renewcommand{\@algocf@funcname}{#1}\renewcommand{\functionautorefname}{#2}}%\r
678 \newcommand{\@algocf@titleofalgoname}{\algorithmcfname}%\r
679 \newcommand{\@algocf@algotitleofalgo}{%\r
680   \renewcommand{\@algocf@titleofalgoname}{\algorithmcfname}}%\r
681 \newcommand{\@algocf@proctitleofalgo}{%\r
682   \renewcommand{\@algocf@titleofalgoname}{\algocf@procname}}%\r
683 %\r
684 \newcommand{\algocf@style}{plain}%\r
685 \newcommand{\@ResetCounterIfNeeded}{}%\r
686 \newcommand{\@titleprefix}{}%\r
687 %\r
688 \newcommand{\algocf@numbering}[1]{\newcommand{\algocf@within}{#1}}%\r
689 %\r
690 \newcommand{\defaultsmacros@algo}{\algocf@defaults@shortend}%\r
691 %\r
692 \newcommand{\algocf@list}{loa}%\r
693 \newcommand{\algocf@float}{algocf}%\r
694 %\r
695 \newcommand{\algocf@envname}{algorithm}%\r
696 \newcommand{\algocf@listofalgorithms}{listofalgorithms}%\r
697 %\r
698 %\r
699 %% redefine chapter so that it adds a vspace in the loa as the original does for lof and lot\r
700 \let\algocf@original@chapter=\chapter%\r
701 \def\chapter{\expandafter\addtocontents{loa}{\protect\addvspace{10\p@}}\algocf@original@chapter}%\r
702 %\r
703 %% if@restonecol is defined in article and book but some other classes don't define it and we need it, so we do\r
704 \ifx\if@restonecol\relax\else\newif\if@restonecol\fi%\r
705 %\r
706 %\r
707 %%%%%%%%%%%%%%%%%%%%%% Declaration of Options %%%%%%%%%%%%%%%%%%%%%%%%%%%\r
708 %\r
709 \RequirePackage{ifthen}%\r
710 %\r
711 \newboolean{algocf@nokwfunc}\setboolean{algocf@nokwfunc}{false}%\r
712 \DeclareOption{nokwfunc}{%\r
713   \setboolean{algocf@nokwfunc}{true}%\r
714 }%\r
715 %\r
716 \newboolean{algocf@oldcommands}\setboolean{algocf@oldcommands}{false}%\r
717 \DeclareOption{oldcommands}{%\r
718   \setboolean{algocf@oldcommands}{true}%\r
719 }%\r
720 %\r
721 \newboolean{algocf@leftlinenumber}\setboolean{algocf@leftlinenumber}{true}%\r
722 \newcommand{\setLeftLinesNumbers}{\setboolean{algocf@leftlinenumber}{true}}%\r
723 \newcommand{\setRightLinesNumbers}{\setboolean{algocf@leftlinenumber}{false}}%\r
724 \DeclareOption{rightnl}{%\r
725   \setRightLinesNumbers%\r
726 }%\r
727 %\r
728 \newboolean{algocf@endfloat}\setboolean{algocf@endfloat}{false}%\r
729 \DeclareOption{endfloat}{%\r
730   \setboolean{algocf@endfloat}{true}%\r
731   \newcounter{postalgo}\setcounter{postalgo}{0}%\r
732 }%\r
733 %\r
734 \newboolean{algocf@procnumbered}\setboolean{algocf@procnumbered}{false}%\r
735 \DeclareOption{procnumbered}{%\r
736   \setboolean{algocf@procnumbered}{true}%\r
737 }%\r
738 %\r
739 \DeclareOption{algo2e}{%\r
740   \renewcommand{\algocf@envname}{algorithm2e}%\r
741   \renewcommand{\algocf@listofalgorithms}{listofalgorithmes}%\r
742 }%\r
743 %\r
744 \newboolean{algocf@slide}\setboolean{algocf@slide}{false}%\r
745 \DeclareOption{slide}{%\r
746   \setboolean{algocf@slide}{true}%\r
747 }%\r
748 %\r
749 \DeclareOption{figure}{%\r
750 \renewcommand{\algocf@list}{lof}%\r
751 \renewcommand{\algocf@float}{figure}%\r
752 }%\r
753 %\r
754 \newboolean{algocf@optonelanguage}\setboolean{algocf@optonelanguage}{false}%\r
755 \DeclareOption{onelanguage}{\setboolean{algocf@optonelanguage}{true}}%\r
756 %\r
757 \newcommand{\algocf@languagechoosen}{english}%\r
758 %\r
759 \DeclareOption{english}{%\r
760 \renewcommand{\listalgorithmcfname}{List of Algorithms}%\r
761 \renewcommand{\algorithmcfname}{Algorithm}%\r
762 \renewcommand{\algorithmautorefname}{algorithm}%\r
763 \renewcommand{\algorithmcflinename}{line}%\r
764 \renewcommand{\algocf@typo}{}%\r
765 \renewcommand{\@algocf@procname}{Procedure}%\r
766 \renewcommand{\@algocf@funcname}{Function}%\r
767 \renewcommand{\procedureautorefname}{procedure}%\r
768 \renewcommand{\functionautorefname}{function}%\r
769 \renewcommand{\algocf@languagechoosen}{english}%\r
770 }%\r
771 %\r
772 \DeclareOption{french}{%\r
773 \renewcommand{\listalgorithmcfname}{Liste des Algorithmes}%\r
774 \renewcommand{\algorithmcfname}{Algorithme}%\r
775 \renewcommand{\algorithmautorefname}{algorithme}%\r
776 \renewcommand{\algorithmcflinename}{ligne}%\r
777 \renewcommand{\algocf@typo}{\ }%\r
778 \renewcommand{\@algocf@procname}{Procédure}%\r
779 \renewcommand{\@algocf@funcname}{Fonction}%\r
780 \renewcommand{\procedureautorefname}{procédure}%\r
781 \renewcommand{\functionautorefname}{fonction}%\r
782 \renewcommand{\algocf@languagechoosen}{french}%\r
783 }%\r
784 %\r
785 \DeclareOption{czech}{%\r
786 \renewcommand{\listalgorithmcfname}{Seznam algoritm\v{u}}%\r
787 \renewcommand{\algorithmcfname}{Algoritmus}%\r
788 \renewcommand{\algorithmautorefname}{\algorithmcfname}%\r
789 \renewcommand{\algorithmcflinename}{Radek}%\r
790 \renewcommand{\algocf@typo}{}%\r
791 \renewcommand{\@algocf@procname}{Procedura}%\r
792 \renewcommand{\@algocf@funcname}{Funkce}%\r
793 \renewcommand{\procedureautorefname}{\@algocf@procname}%\r
794 \renewcommand{\functionautorefname}{\@algocf@funcname}%\r
795 \renewcommand{\algocf@languagechoosen}{czech}%\r
796 }%\r
797 %\r
798 \DeclareOption{german}{%\r
799 \renewcommand{\listalgorithmcfname}{Liste der Algorithmen}%\r
800 \renewcommand{\algorithmcfname}{Algorithmus}%\r
801 \renewcommand{\algorithmautorefname}{\algorithmcfname}%\r
802 \renewcommand{\algorithmcflinename}{Zeile}%\r
803 \renewcommand{\algocf@typo}{\ }%\r
804 \renewcommand{\@algocf@procname}{Prozedur}%\r
805 \renewcommand{\@algocf@funcname}{Funktion}%\r
806 \renewcommand{\procedureautorefname}{\@algocf@procname}%\r
807 \renewcommand{\functionautorefname}{\@algocf@funcname}%\r
808 \renewcommand{\algocf@languagechoosen}{german}%\r
809 }%\r
810 %\r
811 \DeclareOption{portuguese}{%\r
812 \renewcommand{\listalgorithmcfname}{Lista de Algoritmos}%\r
813 \renewcommand{\algorithmcfname}{Algoritmo}%\r
814 \renewcommand{\algorithmautorefname}{algoritmo}%\r
815 \renewcommand{\algorithmcflinename}{linha}%\r
816 \renewcommand{\algocf@typo}{}%\r
817 \renewcommand{\@algocf@procname}{Procedimento}%\r
818 \renewcommand{\@algocf@funcname}{Fun\c{c}\~{a}o}%\r
819 \renewcommand{\procedureautorefname}{procedimento}%\r
820 \renewcommand{\functionautorefname}{fun\c{c}\~{a}o}%\r
821 \renewcommand{\algocf@languagechoosen}{portuguese}%\r
822 }%\r
823 %\r
824 \DeclareOption{italiano}{%\r
825 \renewcommand{\listalgorithmcfname}{Elenco degli algoritmi}%\r
826 \renewcommand{\algorithmcfname}{Algoritmo}%\r
827 \renewcommand{\algorithmautorefname}{algoritmo}%\r
828 \renewcommand{\algorithmcflinename}{riga}%\r
829 \renewcommand{\algocf@typo}{}%\r
830 \renewcommand{\@algocf@procname}{Procedura}%\r
831 \renewcommand{\@algocf@funcname}{Funzione}%\r
832 \renewcommand{\procedureautorefname}{procedura}%\r
833 \renewcommand{\functionautorefname}{funzione}%\r
834 \renewcommand{\algocf@languagechoosen}{italiano}%\r
835 }%\r
836 \DeclareOption{slovak}{%\r
837 \renewcommand{\listalgorithmcfname}{Zoznam algoritmov}%\r
838 \renewcommand{\algorithmcfname}{Algoritmus}%\r
839 \renewcommand{\algorithmautorefname}{\algorithmcfname}%\r
840 \renewcommand{\algorithmcflinename}{Radek}%\r
841 \renewcommand{\algocf@typo}{}%\r
842 \renewcommand{\@algocf@procname}{Proced\'{u}ra}%\r
843 \renewcommand{\@algocf@funcname}{Funkcia}%\r
844 \renewcommand{\procedureautorefname}{\@algocf@procname}%\r
845 \renewcommand{\functionautorefname}{\@algocf@funcname}%\r
846 \renewcommand{\algocf@languagechoosen}{slovak}%\r
847 }%\r
848 %\r
849 % OPTIONs plain, boxed, ruled, algoruled & boxruled\r
850 %\r
851 \newcommand{\algocf@style@plain}{\renewcommand{\algocf@style}{plain}}%\r
852 \newcommand{\algocf@style@boxed}{\renewcommand{\algocf@style}{boxed}}%\r
853 \newcommand{\algocf@style@ruled}{\renewcommand{\algocf@style}{ruled}}%\r
854 \newcommand{\algocf@style@algoruled}{\renewcommand{\algocf@style}{algoruled}}%\r
855 \newcommand{\algocf@style@boxruled}{\renewcommand{\algocf@style}{boxruled}}%\r
856 \newcommand{\algocf@style@tworuled}{\renewcommand{\algocf@style}{tworuled}}%\r
857 \newcommand{\RestyleAlgo}[1]{\csname algocf@style@#1\endcsname}%\r
858 \DeclareOption{plain}{\algocf@style@plain}%\r
859 \DeclareOption{boxed}{\algocf@style@boxed}%\r
860 \DeclareOption{ruled}{\algocf@style@ruled}%\r
861 \DeclareOption{algoruled}{\algocf@style@algoruled}%\r
862 \DeclareOption{boxruled}{\algocf@style@boxruled}%\r
863 \DeclareOption{tworuled}{\algocf@style@tworuled}%\r
864 %\r
865 % OPTIONs algopart,algochapter & algosection\r
866 %\r
867 \DeclareOption{algopart}{\algocf@numbering{part}}%       %algo part numbered\r
868 \DeclareOption{algochapter}{\algocf@numbering{chapter}}% %algo chapter numbered\r
869 \DeclareOption{algosection}{\algocf@numbering{section}}% %algo section numbered\r
870 %\r
871 % OPTIONs resetcount & noresetcount\r
872 %\r
873 \DeclareOption{resetcount}{\renewcommand{\@ResetCounterIfNeeded}{\setcounter{AlgoLine}{0}}}%\r
874 \DeclareOption{noresetcount}{\renewcommand{\@ResetCounterIfNeeded}{}}%\r
875 %\r
876 % OPTION linesnumbered\r
877 %\r
878 \newboolean{algocf@linesnumbered}\setboolean{algocf@linesnumbered}{false}%\r
879 \newcommand{\algocf@linesnumbered}{\relax}%\r
880 \DeclareOption{linesnumbered}{%\r
881   \setboolean{algocf@linesnumbered}{true}%\r
882   \renewcommand{\algocf@linesnumbered}{\everypar={\nl}}%\r
883 }%\r
884 %\r
885 % OPTION linesnumberedhidden\r
886 %\r
887 \DeclareOption{linesnumberedhidden}{%\r
888   \setboolean{algocf@linesnumbered}{true}%\r
889   \renewcommand{\algocf@linesnumbered}{\everypar{\stepcounter{AlgoLine}}}%\r
890 }%\r
891 %\r
892 % OPTION commentsnumbered inoutnumbered\r
893 %\r
894 \newboolean{algocf@commentsnumbered}\setboolean{algocf@commentsnumbered}{false}%\r
895 \DeclareOption{commentsnumbered}{\setboolean{algocf@commentsnumbered}{true}}%\r
896 \newboolean{algocf@inoutnumbered}\setboolean{algocf@inoutnumbered}{false}%\r
897 \DeclareOption{inoutnumbered}{\setboolean{algocf@inoutnumbered}{true}}%\r
898 %\r
899 % OPTIONs titlenumbered & titlenotnumbered\r
900 %\r
901 \DeclareOption{titlenumbered}{%\r
902   \renewcommand{\@titleprefix}{%\r
903     \refstepcounter{\algocf@float}%\r
904     \AlTitleSty{\AlTitleFnt\@algocf@titleofalgoname\ \expandafter\csname the\algocf@float\endcsname\algocf@typo: }%\r
905   }%\r
906 }%\r
907 %\r
908 \DeclareOption{titlenotnumbered}{\renewcommand{\@titleprefix}{%\r
909     \AlTitleSty{\AlTitleFnt\@algocf@titleofalgoname\algocf@typo: }}%\r
910 }%\r
911 %\r
912 % OPTIONs algonl\r
913 % line numbered with the counter of the algorithm\r
914 %\r
915 \DeclareOption{algonl}{\renewcommand{\theAlgoLine}{\expandafter\csname the\algocf@float\endcsname.\arabic{AlgoLine}}}%\r
916 %\r
917 % OPTIONs lined, vlined & noline\r
918 %\r
919 \DeclareOption{lined}{\AtBeginDocument{\SetAlgoLined}}%   \SetAlgoLined\r
920 \DeclareOption{vlined}{\AtBeginDocument{\SetAlgoVlined}}% \SetAlgoVlined\r
921 \DeclareOption{noline}{\AtBeginDocument{\SetAlgoNoLine}}%\SetAlgoNoLine (default)\r
922 %\r
923 % OPTIONs longend, shotend & noend\r
924 %\r
925 \DeclareOption{longend}{\AtBeginDocument{\SetAlgoLongEnd}}%  \SetAlgoLongEnd\r
926 \DeclareOption{shortend}{\AtBeginDocument{\SetAlgoShortEnd}}%\SetAlgoShortEnd\r
927 \DeclareOption{noend}{\AtBeginDocument{\SetAlgoNoEnd}}%      \SetAlgoNoEnd\r
928 %\r
929 % OPTION dotoc\r
930 %\r
931 \newboolean{algocf@dotocloa}\setboolean{algocf@dotocloa}{false}%\r
932 \DeclareOption{dotocloa}{%\r
933   \setboolean{algocf@dotocloa}{true}%\r
934 }\r
935 %\r
936 % OPTION comments\r
937 %\r
938 \newboolean{algocf@optfillcomment}\setboolean{algocf@optfillcomment}{true}%\r
939 \DeclareOption{nofillcomment}{%\r
940   \setboolean{algocf@optfillcomment}{false}%\r
941 }%\r
942 \DeclareOption{fillcomment}{%\r
943   \setboolean{algocf@optfillcomment}{true}%\r
944 }%\r
945 %\r
946 % OPTION sidecommments\r
947 %\r
948 \newboolean{algocf@scleft}\setboolean{algocf@scleft}{false}%\r
949 \DeclareOption{scleft}{%\r
950   \setboolean{algocf@scleft}{true}%\r
951 }%\r
952 \DeclareOption{sright}{% default\r
953   \setboolean{algocf@scleft}{false}%\r
954 }%\r
955 %\r
956 % OPTION norelsize\r
957 %\r
958 \newboolean{algocf@norelsize}\setboolean{algocf@norelsize}{false}%\r
959 \DeclareOption{norelsize}{%\r
960   \setboolean{algocf@norelsize}{true}%\r
961 }%\r
962 %\r
963 %\r
964 %%%%%%%%%%%%%%%%%%%%%%% Execution of Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
965 %\r
966 \ExecuteOptions{english,plain,resetcount,titlenotnumbered,lined,shortend}%\r
967 %\r
968 \ProcessOptions%\r
969 %\r
970 \@algocf@algotitleofalgo% fix name for \TitleOfAlgo to \algorithmcfname by default\r
971 %\r
972 %%%%%%%%%%%%%%%%%%%%%%%%%% Package Loading %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
973 %\r
974 %\r
975 \RequirePackage{xspace}%\r
976 %\r
977 \ifthenelse{\boolean{algocf@endfloat}}{%\r
978   \RequirePackage{endfloat}%\r
979 }{\relax}%\r
980 %\r
981 \ifthenelse{\boolean{algocf@norelsize}}{%\r
982   \newcommand{\relsize}[1]{\scriptsize}%\r
983 }{%\r
984   \RequirePackage{relsize}%\r
985 }%\r
986 %\r
987 \ifthenelse{\boolean{algocf@slide}}{\RequirePackage{color}}{}%\r
988 %\r
989 \r
990 \AtEndOfPackage{%\r
991   \ifthenelse{\boolean{algocf@dotocloa}}{%\r
992     \renewcommand{\listofalgorithmes}{\tocfile{\listalgorithmcfname}{loa}}%\r
993   }{\relax}%\r
994 }%\r
995 %\r
996 % if loa in toc required, load tocbibind package if not already done.\r
997 \ifthenelse{\boolean{algocf@dotocloa}}{%\r
998   \ifx\@tocextra\undefined%\r
999   \RequirePackage{tocbibind}%\r
1000   \fi%\r
1001 }%\r
1002 %\r
1003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Main Part %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1004 %\r
1005 \newcommand{\algocf@name}{algorithm2e}%\r
1006 \newcommand{\algocf@date}{december 14 2009}%\r
1007 \newcommand{\algocf@version}{Release 4.01}%\r
1008 \newcommand{\algocf@id}{\algocf@version\space -- \algocf@date\space --}%\r
1009 \typeout{********************************************************^^JPackage `\algocf@name'\space\algocf@id^^J%\r
1010          - algorithm2e-announce@lirmm.fr  mailing list for announcement about releases^^J%\r
1011          - algorithm2e-discussion@lirmm.fr mailing list for discussion about package^^J%\r
1012          subscribe by emailing sympa@lirmm.fr with 'subscribe <list> <firstname name>'^^J%\r
1013          - Author: Christophe Fiorio (fiorio@lirmm.fr)^^J********************************************************}%\r
1014 %%\r
1015 %%\r
1016 %%\r
1017 %%\r
1018 %%\r
1019 %%\r
1020 %%%% hyperref compatibility tricks: Hyperref package defines H counters from\r
1021    % standard counters (i.e \theHpage from \thepage) and check some particular\r
1022    % counters of some packages, unfortunately it doesn't do the same for\r
1023    % algorithm2e package but act as Hcounter was defined. To avoid errors we\r
1024    % defined \theHalgocf ourself\r
1025 %%%%\r
1026 %\r
1027 \@ifundefined{theHalgocf}{\def\theHalgocf{\thealgocf}}{}%\r
1028 \@ifundefined{theHAlgoLine}{\def\theHAlgoLine{\theAlgoLine}}{}%\r
1029 \@ifundefined{theHalgocfproc}{\def\theHalgocfproc{0}}{}%\r
1030 \@ifundefined{theHalgocffunc}{\def\theHalgocffunc{0}}{}%\r
1031 \@ifundefined{toclevel@algocf}{\def\toclevel@algocf{0}}{}%\r
1032 %\r
1033 % autoref from hyperref needs an autorefname, so we give it.\r
1034 \def\AlgoLineautorefname{\algorithmcflinename}%\r
1035 \def\algocfautorefname{\algorithmautorefname}%\r
1036 \def\algocfprocautorefname{\procedureautorefname}%\r
1037 \def\algocffuncautorefname{\functionautorefname}%\r
1038 %%\r
1039 %%\r
1040 %%\r
1041 \newcommand{\@defaultskiptotal}{0.5em}%\r
1042 \newskip\skiptotal\skiptotal=0.5em%\r
1043 \newskip\skiplinenumber\skiplinenumber=\hsize\advance\skiplinenumber by-\skiptotal%\r
1044 \newskip\skiprule%\r
1045 \newskip\skiphlne%\r
1046 \newskip\skiptext%\r
1047 \newskip\skiplength%\r
1048 \newskip\algomargin%\r
1049 \newskip\skipalgocfslide\skipalgocfslide=1em%\r
1050 \newdimen\algowidth%\r
1051 \newdimen\inoutsize%\r
1052 \newdimen\inoutline%\r
1053 \newdimen\interspacetitleruled\setlength{\interspacetitleruled}{2pt}%\r
1054 \newdimen\interspacealgoruled\setlength{\interspacealgoruled}{2pt}%\r
1055 \newdimen\interspacetitleboxruled\setlength{\interspacetitleboxruled}{2\lineskip}%\r
1056 %\r
1057 \newcommand{\@algoskip}{\smallskip}%\r
1058 \newcommand{\SetAlgoSkip}[1]{\renewcommand{\@algoskip}{\csname#1\endcsname}}%\r
1059 \newcommand{\@algoinsideskip}{\relax}%\r
1060 \newcommand{\SetAlgoInsideSkip}[1]{\renewcommand{\@algoinsideskip}{\csname#1\endcsname}}%\r
1061 %\r
1062 \newsavebox{\algocf@inoutbox}%\r
1063 \newsavebox{\algocf@inputbox}%\r
1064 %%\r
1065 %%\r
1066 \newcommand{\arg@e}{}%\r
1067 \newcommand{\arg@space}{\ }%\r
1068 \newcommand{\BlankLine}{\vskip 1ex}%\r
1069 %%\r
1070 \newcommand{\vespace}{1ex}%\r
1071 \newcommand{\SetInd}[2]{%\r
1072 \skiprule=#1%\r
1073 \skiptext=#2%\r
1074 \skiplength=\skiptext\advance\skiplength by \skiprule\advance\skiplength by 0.4pt}%\r
1075 \SetInd{0.5em}{1em}\r
1076 \algomargin=\leftskip\advance\algomargin by \parindent%\r
1077 \newcommand{\IncMargin}[1]{\advance\algomargin by #1}%\r
1078 \newcommand{\DecMargin}[1]{\advance\algomargin by -#1}%\r
1079 \newcommand{\SetNlSkip}[1]{%\r
1080   \renewcommand{\@defaultskiptotal}{#1}%\r
1081   \setlength{\skiptotal}{#1}}%\r
1082 %%\r
1083 \newskip\AlCapSkip\AlCapSkip=0ex%\r
1084 \newskip\AlCapHSkip\AlCapSkip=0ex%\r
1085 \newcommand{\SetAlCapSkip}[1]{\setlength{\AlCapSkip}{#1}}%\r
1086 \newcommand{\SetAlCapHSkip}[1]{\setlength{\AlCapHSkip}{#1}}%\r
1087 \SetAlCapHSkip{.5\algomargin}%\r
1088 %%\r
1089 %%\r
1090 \newcommand{\Indentp}[1]{\advance\leftskip by #1}%\r
1091 \newcommand{\Indp}{\advance\leftskip by 1em}%\r
1092 \newcommand{\Indpp}{\advance\leftskip by 0.5em}%\r
1093 \newcommand{\Indm}{\advance\leftskip by -1em}%\r
1094 \newcommand{\Indmm}{\advance\leftskip by -0.5em}%\r
1095 %%\r
1096 %%\r
1097 %% Line Numbering\r
1098 %%\r
1099 %%\r
1100 % number line style\r
1101 \newcommand{\algocf@nlrelsize}{-2}\newcommand{\SetAlgoNlRelativeSize}[1]{\renewcommand{\algocf@nlrelsize}{#1}}%\r
1102 \newcommand{\NlSty}[1]{\textnormal{\textbf{\relsize{\algocf@nlrelsize}#1}}}% default definition\r
1103 \newcommand{\SetNlSty}[3]{\renewcommand{\NlSty}[1]{\textnormal{\csname#1\endcsname{\relsize{\algocf@nlrelsize}#2##1#3}}}}%\r
1104 %\r
1105 % nl definitions\r
1106 %\r
1107 \newsavebox{\algocf@nlbox}%\r
1108 \newcommand{\algocf@printnl}[1]{%\r
1109   \ifthenelse{\boolean{algocf@leftlinenumber}}{%\r
1110     \skiplinenumber=\skiptotal\advance\skiplinenumber by\leftskip%\r
1111     \strut\raisebox{0pt}{\llap{\NlSty{#1}\kern\skiplinenumber}}\ignorespaces%\r
1112   }{%\r
1113     \sbox\algocf@nlbox{\NlSty{#1}}%\r
1114     \skiplinenumber=\hsize\advance\skiplinenumber by-\leftskip\advance\skiplinenumber by-\skiptext%\r
1115     \advance\skiplinenumber by\algomargin\advance\skiplinenumber by.3em\advance\skiplinenumber by-\wd\algocf@nlbox%\r
1116     \strut\raisebox{0pt}{\rlap{\kern\skiplinenumber\NlSty{#1\ignorespaces}}}\ignorespaces%\r
1117   }%\r
1118 }%\r
1119 \newcommand{\algocf@nl@sethref}[1]{%\r
1120   \renewcommand{\theHAlgoLine}{\thealgocfproc.#1}%\r
1121   \hyper@refstepcounter{AlgoLine}\gdef\@currentlabel{#1}%\r
1122 }%\r
1123 \newcommand{\nl}{%\r
1124   \@ifundefined{hyper@refstepcounter}{% if not hyperref then do a simple refstepcounter\r
1125     \refstepcounter{AlgoLine}%\r
1126   }{% else if hyperref, do the anchor so 2 lines in two differents algorithms cannot have the same href\r
1127     \stepcounter{AlgoLine}\algocf@nl@sethref{\theAlgoLine}%\r
1128   }% now we can do the line numbering\r
1129   \algocf@printnl{\theAlgoLine}%\r
1130 }%\r
1131 %\r
1132 \newcommand{\nllabel}[1]{\label{#1}}%\r
1133 %\r
1134 \newcommand{\enl}{%\r
1135   \@ifundefined{hyper@refstepcounte}{% if not hyperref then do a simple refstepcounter\r
1136     \refstepcounter{AlgoLine}%\r
1137   }{% else if hyperref, do the anchor so 2 lines in two differents algorithms cannot have the same href\r
1138     \stepcounter{AlgoLine}\algocf@nl@sethref{\theAlgoLine}%\r
1139   }% now we can do the line numbering\r
1140   \skiplinenumber=\hsize\advance\skiplinenumber by-\leftskip%\r
1141   \strut\raisebox{0pt}{\rlap{\kern\skiplinenumber\strut\NlSty{\theAlgoLine}}}\ignorespaces%\r
1142 }\r
1143 %% nlset\r
1144 \newcommand{\nlset}[1]{%\r
1145   \@ifundefined{hyper@refstepcounter}{\protected@edef\@currentlabel{#1}}{\algocf@nl@sethref{#1}}\algocf@printnl{#1}%\r
1146 }%\r
1147 %\r
1148 %% lnl definitions\r
1149 \newcommand{\lnl}[1]{\nl\label{#1}}%\r
1150 %\r
1151 %% lnlset\r
1152 \newcommand{\lnlset}[2]{\nlset{#2}\label{#1}}%\r
1153 %\r
1154 % set char put at end of each line\r
1155 %\r
1156 \newcommand{\algocf@endline}{\string;}\r
1157 \newcommand{\SetEndCharOfAlgoLine}[1]{\renewcommand{\algocf@endline}{#1}}\r
1158 %\r
1159 % end of line definition\r
1160 %\r
1161 \newcommand{\@endalgocfline}{\algocf@endline}% default definition: printsemicolon\r
1162 \newcommand{\DontPrintSemicolon}{\renewcommand{\@endalgocfline}{\relax}}%\r
1163 \newcommand{\PrintSemicolon}{\renewcommand{\@endalgocfline}{\algocf@endline}}%\r
1164 \newcommand{\@endalgoln}{\@endalgocfline\hfill\strut\par}%\r
1165 %\r
1166 % line numbering\r
1167 %\r
1168 \newcommand{\LinesNumbered}{\setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\everypar={\nl}}}%\r
1169 \newcommand{\LinesNotNumbered}{%\r
1170   \setboolean{algocf@linesnumbered}{false}%\r
1171   \renewcommand{\algocf@linesnumbered}{\relax}%\r
1172 }%\r
1173 %\r
1174 \newcommand{\LinesNumberedHidden}{%\r
1175   \setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\everypar{\stepcounter{AlgoLine}}}}%\r
1176 \newcommand{\ShowLn}{\nlset{\theAlgoLine}\ignorespaces}% display the line number on this line (without labelling)\r
1177 \newcommand{\ShowLnLabel}[1]{\lnlset{#1}{\theAlgoLine}\ignorespaces}% display the line number and label this line\r
1178 %\r
1179 %%\r
1180 %\r
1181 %%\r
1182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1183 %\r
1184 % Styling text commands\r
1185 %\r
1186 \newcommand{\AlFnt}{\relax}% default definition\r
1187 \newcommand{\SetAlFnt}[1]{\renewcommand{\AlFnt}{#1}}%\r
1188 \newcommand{\AlTitleFnt}{\relax}% default definition\r
1189 \newcommand{\SetAlTitleFnt}[1]{\renewcommand{\AlTitleFnt}{#1}}%\r
1190 %\r
1191 \newcommand{\AlCapFnt}{\relax}% default definition\r
1192 \newcommand{\SetAlCapFnt}[1]{\renewcommand{\AlCapFnt}{#1}}%\r
1193 \newcommand{\AlCapNameFnt}{\relax}% default definition\r
1194 \newcommand{\SetAlCapNameFnt}[1]{\renewcommand{\AlCapNameFnt}{#1}}%\r
1195 %\r
1196 \newcommand{\ProcFnt}{\relax}% default definition\r
1197 \newcommand{\SetProcFnt}[1]{\renewcommand{\ProcFnt}{#1}}%\r
1198 \newcommand{\ProcNameFnt}{\relax}% default definition\r
1199 \newcommand{\SetProcNameFnt}[1]{\renewcommand{\ProcNameFnt}{#1}}%\r
1200 \newcommand{\ProcArgFnt}{\relax}% default definition\r
1201 \newcommand{\SetProcArgFnt}[1]{\renewcommand{\ProcArgFnt}{#1}}%\r
1202 %\r
1203 \newcommand{\AlTitleSty}[1]{\textbf{#1}\unskip}% default definition\r
1204 \newcommand{\SetAlTitleSty}[1]{\renewcommand{\AlTitleSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1205 \newcommand{\AlCapSty}[1]{\textnormal{\textbf{#1}}\unskip}% default definition\r
1206 \newcommand{\SetAlCapSty}[1]{\renewcommand{\AlCapSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1207 \newcommand{\AlCapNameSty}[1]{\textnormal{#1}\unskip}% default definition\r
1208 \newcommand{\SetAlCapNameSty}[1]{\renewcommand{\AlCapNameSty}[1]{\textnormal{\csname #1\endcsname{##1}}\unskip}}%\r
1209 %\r
1210 \newcommand{\ProcSty}[1]{\AlCapSty{#1}}%\r
1211 \newcommand{\SetProcSty}[1]{\renewcommand{\ProcSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1212 \newcommand{\ProcNameSty}[1]{\AlCapNameSty{#1}}%\r
1213 \newcommand{\SetProcNameSty}[1]{\renewcommand{\ProcNameSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1214 \newcommand{\ProcArgSty}[1]{\AlCapNameSty{#1}}%\r
1215 \newcommand{\SetProcArgSty}[1]{\renewcommand{\ProcArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1216 %\r
1217 \newcommand{\KwSty}[1]{\textnormal{\textbf{#1}}\unskip}% default definition\r
1218 \newcommand{\SetKwSty}[1]{\renewcommand{\KwSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1219 \newcommand{\ArgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetArgSty{emph}\r
1220 \newcommand{\SetArgSty}[1]{\renewcommand{\ArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1221 \newcommand{\FuncSty}[1]{\textnormal{\texttt{#1}}\unskip}%\SetFuncSty{texttt}\r
1222 \newcommand{\SetFuncSty}[1]{\renewcommand{\FuncSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1223 \newcommand{\DataSty}[1]{\textnormal{\textsf{#1}}\unskip}%%\SetDataSty{textsf}\r
1224 \newcommand{\SetDataSty}[1]{\renewcommand{\DataSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1225 \newcommand{\CommentSty}[1]{\textnormal{\texttt{#1}}\unskip}%%\SetDataSty{texttt}\r
1226 \newcommand{\SetCommentSty}[1]{\renewcommand{\CommentSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}%\r
1227 \newcommand{\TitleSty}[1]{#1\unskip}%\SetTitleSty{}{}\r
1228 \newcommand{\SetTitleSty}[2]{\renewcommand{\TitleSty}[1]{%\r
1229 \csname#1\endcsname{\csname#2\endcsname##1}}\unskip}%\r
1230 %\r
1231 %%\r
1232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1233 %\r
1234 % Block basic commands\r
1235 %\r
1236 \newcommand{\algocf@push}[1]{\advance\skiptotal by #1\moveright #1}%\r
1237 \newcommand{\algocf@pop}[1]{\advance\skiptotal by -#1}%\r
1238 \newcommand{\algocf@addskiptotal}{\advance\skiptotal by 0.4pt\advance\hsize by -0.4pt}% 0.4 pt=width of \vrule\r
1239 \newcommand{\algocf@subskiptotal}{\advance\skiptotal by -0.4pt\advance\hsize by 0.4pt}% 0.4 pt=width of \vrule\r
1240 %\r
1241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1242 %%\r
1243 %% group of instructions definition\r
1244 %\r
1245 \skiphlne=.8ex%\r
1246 \newcommand{\SetVlineSkip}[1]{\skiphlne=#1}%\r
1247 %\r
1248 %% block with a vertical line end by a little horizontal line\r
1249 \newcommand{\algocf@Vline}[1]{%     no vskip in between boxes but a strut to separate them, \r
1250   \strut\par\nointerlineskip% then interblock space stay the same whatever is inside it\r
1251   \algocf@push{\skiprule}%        move to the right before the vertical rule\r
1252   \hbox{\vrule%\r
1253     \vtop{\algocf@push{\skiptext}%move the right after the rule\r
1254       \vtop{\algocf@addskiptotal\advance\hsize by -\skiplength #1}\Hlne}}\vskip\skiphlne% inside the block\r
1255   \algocf@pop{\skiprule}%\algocf@subskiptotal% restore indentation\r
1256   \nointerlineskip}% no vskip after\r
1257 %\r
1258 %% block with a vertical line\r
1259 \newcommand{\algocf@Vsline}[1]{%    no vskip in between boxes but a strut to separate them, \r
1260   \strut\par\nointerlineskip% then interblock space stay the same whatever is inside it\r
1261   \algocf@push{\skiprule}%        move to the right before the vertical rule\r
1262   \hbox{\vrule%               the vertical rule\r
1263     \vtop{\algocf@push{\skiptext}%move the right after the rule\r
1264       \vtop{\algocf@addskiptotal\advance\hsize by -\skiplength #1}}}% inside the block\r
1265   \algocf@pop{\skiprule}}% restore indentation\r
1266 %\r
1267 \newcommand{\algocf@Hlne}{\hrule height 0.4pt depth 0pt width .5em}%\r
1268 %\r
1269 %% block without line\r
1270 \newcommand{\algocf@Noline}[1]{%    no vskip in between boxes but a strut to separate them, \r
1271   \strut\par\nointerlineskip% then interblock space stay the same whatever is inside it\r
1272   \algocf@push{\skiprule}%\r
1273   \hbox{%\r
1274     \vtop{\algocf@push{\skiptext}%\r
1275       \vtop{\advance\hsize by -\skiplength #1}}}% inside the block\r
1276   \algocf@pop{\skiprule}%\r
1277   % \nointerlineskip% no vskip after\r
1278 }%\r
1279 %\r
1280 %% default=NoLine\r
1281 %\r
1282 \newcommand{\algocf@group}[1]{\algocf@Noline{##1}}% group: set of instruction depending from another (ex: then part of the If)\r
1283 \newcommand{\algocf@@block}[2]{\algocf@Noline{##1}\KwSty{##2}\par}% block: group with a end keyword.\r
1284 \newcommand{\algocf@block}[2]{\algocf@@block{#1}{#2}}% command that will be used and redefined accordingly to noend option\r
1285 \newcommand{\algocf@setBlock}{%\r
1286   \ifthenelse{\boolean{algocf@optnoend}}{%     if no end option\r
1287     \renewcommand{\algocf@block}[2]{\algocf@group{##1}}%     block will be a group\r
1288   }{%                                          else\r
1289     \renewcommand{\algocf@block}[2]{\algocf@@block{##1}{##2}}% block stays a block\r
1290   }%\r
1291 }%\r
1292 %\r
1293 \newcommand{\Hlne}{}% little hrizontal line ending a block in vline mode\r
1294 %\r
1295 \newcommand{\@algocf@endoption}[1]{#1}%\r
1296 \newboolean{algocf@optnoend}\setboolean{algocf@optnoend}{false}%\r
1297 %\r
1298 \newcommand{\SetAlgoLongEnd}{%%%%%%%%%%%%%%%%%%%%%%%%% Long End\r
1299   \setboolean{algocf@optnoend}{false}%\r
1300   \renewcommand{\@algocf@endoption}[1]{##1}%\r
1301   \algocf@setBlock}%\r
1302 %\r
1303 \newcommand{\SetAlgoShortEnd}{%%%%%%%%%%%%%%%%%%%%%%%% ShortEnd\r
1304   \setboolean{algocf@optnoend}{false}%\r
1305   \renewcommand{\@algocf@endoption}[1]{\@firstword##1 \@nil}%\r
1306   \algocf@setBlock}%\r
1307 %\r
1308 \newcommand{\SetAlgoNoEnd}{%%%%%%%%%%%%%%%%%%%%%%%%%%% NoEnd\r
1309   \setboolean{algocf@optnoend}{true}%\r
1310   \renewcommand{\@algocf@endoption}[1]{}%\r
1311   \algocf@setBlock}%\r
1312 %\r
1313 \newcommand{\SetAlgoNoLine}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Noline\r
1314 \renewcommand{\algocf@@block}[2]{\algocf@Noline{##1}\KwSty{##2}\strut\par}%\r
1315 \renewcommand{\algocf@group}[1]{\algocf@Noline{##1}}%\r
1316 \renewcommand{\Hlne}{}}%\r
1317 %\r
1318 \newcommand{\SetAlgoVlined}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Vline\r
1319 \renewcommand{\algocf@@block}[2]{\algocf@Vline{##1}}%\r
1320 \renewcommand{\algocf@group}[1]{\algocf@Vsline{##1}\ifthenelse{\boolean{algocf@optnoend}}{\relax}{\strut\ignorespaces}}%\r
1321 \renewcommand{\Hlne}{\algocf@Hlne}}%\r
1322 %\r
1323 \newcommand{\SetAlgoLined}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Line\r
1324 \renewcommand{\algocf@@block}[2]{\strut\algocf@Vsline{##1}\KwSty{##2}\strut\par}% no skip after a block so garantie at least a line\r
1325 \renewcommand{\algocf@group}[1]{\algocf@Vsline{##1}\ifthenelse{\boolean{algocf@optnoend}}{\relax}{\strut\ignorespaces}}%\r
1326 \renewcommand{\Hlne}{}}%\r
1327 %\r
1328 \newcommand{\SetNothing}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Noline\r
1329 \renewcommand{\algocf@@block}[2]{\algocf@Noline{##1}\par}%\r
1330 %\long\r
1331 \renewcommand{\algocf@group}[1]{\algocf@Noline{##1}}%\r
1332 \renewcommand{\Hlne}{}}%\r
1333 %\r
1334 %%\r
1335 %%\r
1336 %\r
1337 %\r
1338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1339 %\r
1340 % ``Input :'''s like command \r
1341 %\r
1342 %%%\r
1343 % text staying at the right of the longer keyword of KwInOut commands \r
1344 % (text of KwInOut commands are all vertically aligned)\r
1345 %\r
1346 \newcommand{\algocf@newinout}{\par\parindent=\wd\algocf@inoutbox}% to put right indentation after a \\ in the KwInOut\r
1347 \newcommand{\SetKwInOut}[2]{%\r
1348   \sbox\algocf@inoutbox{\KwSty{#2}\algocf@typo:}%\r
1349   \expandafter\ifx\csname InOutSizeDefined\endcsname\relax% if first time used\r
1350     \newcommand\InOutSizeDefined{}\setlength{\inoutsize}{\wd\algocf@inoutbox}%\r
1351   \else% else keep the larger dimension\r
1352     \ifdim\wd\algocf@inoutbox>\inoutsize\setlength{\inoutsize}{\wd\algocf@inoutbox}\fi%\r
1353   \fi% the dimension of the box is now defined.\r
1354   \@ifundefined{#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1355   \expandafter\algocf@mkcmd\csname#1\endcsname[1]{%\r
1356     \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\everypar={\relax}}%\r
1357     {\let\\\algocf@newinout\hangindent=\wd\algocf@inoutbox\hangafter=1\parbox[t]{\inoutsize}{\KwSty{#2}\algocf@typo\hfill:}~##1\par}%\r
1358     \algocf@linesnumbered% reset the numbering of the lines\r
1359   }}%\r
1360 %\r
1361 %% allow to ajust the skip size of InOut\r
1362 %%\r
1363 \newcommand{\ResetInOut}[1]{%\r
1364   \sbox\algocf@inoutbox{\hbox{\KwSty{#1}\algocf@typo:\ }}%\r
1365   \setlength{\inoutsize}{\wd\algocf@inoutbox}%\r
1366   }%\r
1367 %\r
1368\r
1369 %%%\r
1370 % text staying at the right of the keyword.\r
1371 %\r
1372 \newcommand{\algocf@newinput}{\par\parindent=\wd\algocf@inputbox}% to put right indentation after a \\ in the KwInput\r
1373 \newcommand{\SetKwInput}[2]{%\r
1374   \@ifundefined{#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1375   \expandafter\algocf@mkcmd\csname#1\endcsname[1]{%\r
1376     \sbox\algocf@inputbox{\hbox{\KwSty{#2}\algocf@typo: }}%\r
1377     \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\everypar={\relax}}%\r
1378     {\let\\\algocf@newinput\hangindent=\wd\algocf@inputbox\hangafter=1\unhbox\algocf@inputbox##1\par}%\r
1379     \algocf@linesnumbered% reset the numbering of the lines\r
1380   }}%\r
1381 \newcommand{\SetKwData}[2]{%\r
1382   \@ifundefined{#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1383   \expandafter\algocf@mkcmd\csname @#1\endcsname[1]{\DataSty{#2(}\ArgSty{##1}\DataSty{)}}%\r
1384   \expandafter\algocf@mkcmd\csname#1\endcsname{%\r
1385     \@ifnextchar\bgroup{\csname @#1\endcsname}{\DataSty{#2}\xspace}}%\r
1386   }%\r
1387 %\r
1388 %\r
1389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1390 % tallent:\r
1391 %\r
1392 % Add following macros:\r
1393 %   \SetKwHangingKw:  [kw] ------------   <= hanging determined by [kw]\r
1394 %                          ------------\r
1395 % Should act like a combination of \SetKwInput and \SetKw.\r
1396 % Based on \SetKwInput:\r
1397 %   - remove ':' at end of keyword\r
1398 %   - do not reset numbering\r
1399 %   - use separate savebox\r
1400 \newsavebox{\algocf@hangingbox}\r
1401 \newcommand{\algocf@newhanging}{\par\parindent=\wd\algocf@hangingbox}% to put right indentation after a \\ in the KwInput\r
1402 \newcommand{\SetKwHangingKw}[2]{%\r
1403   \@ifundefined{#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1404   \expandafter\algocf@mkcmd\csname#1\endcsname[1]{%\r
1405     \sbox\algocf@hangingbox{\hbox{\KwSty{#2}\algocf@typo\ }}%\r
1406     {\let\\\algocf@newhanging\hangindent=\wd\algocf@hangingbox\hangafter=1\unhbox\algocf@hangingbox##1\;}%\r
1407   }%\r
1408 }%\r
1409 %\r
1410 %\r
1411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1412 %\r
1413 % Comments macros\r
1414 %\r
1415 %%%%\r
1416 % comment in the text, first argument is the name of the macro, second is\r
1417 % the text put before the comment, third is the text put at the end of the\r
1418 % comment.\r
1419 %\r
1420 % first side comment justification\r
1421 \newcommand{\SetSideCommentLeft}{\setboolean{algocf@scleft}{true}}%\r
1422 \newcommand{\SetSideCommentRight}{\setboolean{algocf@scleft}{false}}%\r
1423 \newcommand{\SetNoFillComment}{\setboolean{algocf@optfillcomment}{false}}%\r
1424 \newcommand{\SetFillComment}{\setboolean{algocf@optfillcomment}{true}}%\r
1425 %\r
1426 % next comment and side comment\r
1427 %\r
1428 \newcommand{\algocf@endmarkcomment}{\relax}%\r
1429 \newcommand{\algocf@fillcomment}{%\r
1430   \ifthenelse{\boolean{algocf@optfillcomment}}{\hfill}{\relax}}%\r
1431 %\r
1432 \newcommand{\algocf@startcomment}{%\r
1433   \hangindent=\wd\algocf@inputbox\hangafter=1\usebox\algocf@inputbox}%\r
1434 \newcommand{\algocf@endcomment}{\algocf@fillcomment\algocf@endmarkcomment\ignorespaces\par}%\r
1435 \newcommand{\algocf@endstartcomment}{\algocf@endcomment\algocf@startcomment\ignorespaces}%\r
1436 %\r
1437 \newboolean{algocf@sidecomment}%\r
1438 \newboolean{algocf@altsidecomment}\setboolean{algocf@altsidecomment}{false}%\r
1439 \newcommand{\algocf@scpar}{\ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\par}}%\r
1440 \newcommand{\algocf@sclfill}{\ifthenelse{\boolean{algocf@scleft}}{\algocf@fillcomment}{\relax}}%\r
1441 \newcommand{\algocf@scrfill}{\ifthenelse{\boolean{algocf@scleft}}{\relax}{\hfill}}%\r
1442 \newcommand{\algocf@startsidecomment}{\usebox\algocf@inputbox}%\r
1443 \newcommand{\algocf@endsidecomment}{\algocf@endmarkcomment\algocf@scpar}%\r
1444 \newcommand{\algocf@endstartsidecomment}{%\r
1445   \algocf@sclfill\algocf@endsidecomment%\r
1446   \algocf@scrfill\algocf@startsidecomment\ignorespaces}%\r
1447 %\r
1448 \newcommand{\SetKwComment}[3]{%\r
1449   % newcommand or renewcommand ?\r
1450   \@ifundefined{#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1451   %%% comment definition\r
1452   \expandafter\algocf@mkcmd\csname algocf@#1\endcsname[1]{%\r
1453     \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}%\r
1454     \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\everypar={\relax}}%\r
1455     {\renewcommand{\algocf@endmarkcomment}{#3}%\r
1456       \let\\\algocf@endstartcomment%\r
1457       \algocf@startcomment\CommentSty{%\r
1458         \strut\ignorespaces##1\strut\algocf@fillcomment#3}\par}%\r
1459     \algocf@linesnumbered% reset the numbering of the lines\r
1460   }%\r
1461   %%% side comment definitions\r
1462   % option or not?\r
1463   \expandafter\algocf@mkcmd\csname algocf@#1@star\endcsname{%\r
1464     \@ifnextchar [{\csname algocf@#1@staropt\endcsname}{\csname algocf@#1@sidecomment\endcsname}%\r
1465   }%\r
1466   % manage option\r
1467   \expandafter\def\csname algocf@#1@staropt\endcsname[##1]##2{%\r
1468     \ifthenelse{\boolean{algocf@scleft}}{\setboolean{algocf@sidecomment}{true}}{\setboolean{algocf@sidecomment}{false}}%\r
1469     \ifx##1h\setboolean{algocf@altsidecomment}{true}\SetSideCommentLeft\fi%\r
1470     \ifx##1f\setboolean{algocf@altsidecomment}{true}\SetSideCommentRight\fi%\r
1471     \ifx##1l\setboolean{algocf@altsidecomment}{false}\SetSideCommentLeft\fi%\r
1472     \ifx##1r\setboolean{algocf@altsidecomment}{false}\SetSideCommentRight\fi%\r
1473     \csname algocf@#1@sidecomment\endcsname{##2}% call sidecomment\r
1474     \ifthenelse{\boolean{algocf@sidecomment}}{\setboolean{algocf@scleft}{true}}{\setboolean{algocf@scleft}{false}}%\r
1475     \setboolean{algocf@altsidecomment}{false}%\r
1476   }%\r
1477   % side comment\r
1478   \expandafter\algocf@mkcmd\csname algocf@#1@sidecomment\endcsname[1]{%\r
1479     \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}%\r
1480     \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\everypar={\relax}}%\r
1481     {%\r
1482       \renewcommand{\algocf@endmarkcomment}{#3}%\r
1483       \let\\\algocf@endstartsidecomment%\r
1484       % here is the comment\r
1485       %\ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\algocf@endline\ }%\r
1486       \ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\@endalgocfline\ }%\r
1487       \algocf@scrfill\algocf@startsidecomment\CommentSty{%\r
1488         \strut\ignorespaces##1\strut\algocf@sclfill#3}\algocf@scpar%\r
1489     }%\r
1490     \algocf@linesnumbered% reset the numbering of the lines\r
1491   }\r
1492   \expandafter\algocf@mkcmd\csname#1\endcsname{\@ifstar{\csname algocf@#1@star\endcsname}{\csname algocf@#1\endcsname}}%\r
1493 }%\r
1494 %\r
1495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1496 %\r
1497 % Kw\r
1498 %\r
1499 \newcommand{\SetKw}[2]{%\r
1500   \@ifundefined{#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1501   \expandafter\algocf@mkcmd\csname @#1\endcsname[1]{\KwSty{#2} \ArgSty{##1}}%\r
1502   \expandafter\algocf@mkcmd\csname#1\endcsname{%\r
1503     \@ifnextchar\bgroup{\csname @#1\endcsname}{\KwSty{#2}\xspace}}%\r
1504   }%\r
1505 %\r
1506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1507 %\r
1508 % KwFunction\r
1509 %\r
1510 \newcommand{\SetKwFunction}[2]{%\r
1511 %%% use of gdef since newcommand doesn't manage to define the macro when SetKwFunction is used in \algocf@caption@proc\r
1512   \expandafter\gdef\csname @#1\endcsname##1{\FuncSty{#2(}\ArgSty{##1}\FuncSty{)}}%\r
1513   \expandafter\gdef\csname#1\endcsname{%\r
1514     \@ifnextchar\bgroup{\csname @#1\endcsname}{\FuncSty{#2}\xspace}}%\r
1515 }%\r
1516 %\r
1517 %\r
1518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1519 %\r
1520 % KwTab\r
1521 %\r
1522 \newcommand{\SetKwArray}[2]{%\r
1523 %%% use of gdef since newcommand doesn't manage to define the macro when SetKwFunction is used in \algocf@caption@proc\r
1524   \expandafter\gdef\csname @#1\endcsname##1{\DataSty{#2[}\ArgSty{##1}\DataSty{]}}%\r
1525   \expandafter\gdef\csname#1\endcsname{%\r
1526     \@ifnextchar\bgroup{\csname @#1\endcsname}{\DataSty{#2}\xspace}}%\r
1527 }%\r
1528 %\r
1529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1530 %\r
1531 % KwBlock\r
1532 %\r
1533 \newcommand{\SetKwBlock}[3]{%\r
1534 \@ifundefined{algocf@#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1535 % side text or not? \r
1536 \expandafter\def\csname#1\endcsname{%Begin\r
1537   \@ifnextchar({\csname algocf@#1opt\endcsname}{\csname algocf@#1\endcsname}}%\r
1538 % with side text\r
1539 \expandafter\def\csname algocf@#1opt\endcsname(##1)##2{% \Begin(){}\r
1540   \KwSty{#2} ##1\algocf@block{##2}{\@algocf@endoption{#3}}%\r
1541   \@ifnextchar({\csname algocf@#1end\endcsname}{\par}}%\r
1542 % without side text at the beginning\r
1543 \expandafter\algocf@mkcmd\csname algocf@#1\endcsname[1]{% \Begin{}\r
1544   \KwSty{#2}\algocf@block{##1}{\@algocf@endoption{#3}}\@ifnextchar({\csname algocf@#1end\endcsname}{\par}}%\r
1545 % side text at the end\r
1546 \expandafter\def\csname algocf@#1end\endcsname(##1){% \Begin{}\r
1547   \ ##1\par}%\r
1548 }%\r
1549 %\r
1550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1551 %\r
1552 % For Switch\r
1553 %\r
1554 \newcommand{\SetKwSwitch}[8]{% #1=\Switch #2=\Case #3=\Other #4=swicth #5=case #6=do #7=otherwise #8=endsw\r
1555 %%%% Switch\r
1556 \@ifundefined{algocf@#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1557 % side text or not? \r
1558 \expandafter\def\csname#1\endcsname{%Switch\r
1559   \@ifnextchar({\csname algocf@#1opt\endcsname}{\csname algocf@#1\endcsname}}%\r
1560 % with side text\r
1561 \expandafter\def\csname algocf@#1opt\endcsname(##1)##2##3{% \Switch(){}{}\r
1562   \KwSty{#4} \ArgSty{##2} \KwSty{#5} ##1\algocf@block{##3}{\@algocf@endoption{#8}}}%\r
1563 % without side text\r
1564 \expandafter\algocf@mkcmd\csname algocf@#1\endcsname[2]{% \Switch{}{}\r
1565   \KwSty{#4} \ArgSty{##1} \KwSty{#5}\algocf@block{##2}{\@algocf@endoption{#8}}}%\r
1566 % side text at the end\r
1567 \expandafter\def\csname algocf@#1end\endcsname(##1){% \Switch{}{}()\r
1568 }%\r
1569 %\r
1570 %%%% Case\r
1571 \@ifundefined{algocf@#2}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1572 % side text or not?\r
1573 \expandafter\def\csname#2\endcsname{%Case\r
1574   \@ifnextchar({\csname algocf@#2opt\endcsname}{\csname algocf@#2\endcsname}}%\r
1575 \expandafter\def\csname u#2\endcsname{%uCase\r
1576   \@ifnextchar({\csname algocf@u#2opt\endcsname}{\csname algocf@u#2\endcsname}}%\r
1577 \expandafter\def\csname l#2\endcsname{%lCase\r
1578   \@ifnextchar({\csname algocf@l#2opt\endcsname}{\csname algocf@l#2\endcsname}}%\r
1579 % with side text\r
1580 \expandafter\def\csname algocf@#2opt\endcsname(##1)##2##3{% \Case(){}{}\r
1581   \KwSty{#6} \ArgSty{##2} ##1\algocf@block{##3}{\@algocf@endoption{#8}}}%\r
1582 \expandafter\def\csname algocf@u#2opt\endcsname(##1)##2##3{% \uCase(){}{}\r
1583   \KwSty{#6} \ArgSty{##2} ##1\algocf@group{##3}}%\r
1584 \expandafter\def\csname algocf@l#2opt\endcsname(##1)##2##3{% \lCase(){}{}\r
1585   \KwSty{#6} \ArgSty{##2} ##3\algocf@endline\ ##1\par}%\r
1586 % without side text\r
1587 \expandafter\algocf@mkcmd\csname algocf@#2\endcsname[2]{% \Case{}{}\r
1588   \KwSty{#6} \ArgSty{##1}\algocf@block{##2}{\@algocf@endoption{#8}}}%\r
1589 \expandafter\algocf@mkcmd\csname algocf@u#2\endcsname[2]{% \uCase{}{}\r
1590   \KwSty{#6} \ArgSty{##1}\algocf@group{##2}}%\r
1591 \expandafter\algocf@mkcmd\csname algocf@l#2\endcsname[2]{% \lCase{}{}\r
1592   \KwSty{#6} \ArgSty{##1} ##2}%\r
1593 %%%% Other\r
1594 \@ifundefined{algocf@#3}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1595 % side text or not?\r
1596 \expandafter\def\csname#3\endcsname{%Other\r
1597   \@ifnextchar({\csname algocf@#3opt\endcsname}{\csname algocf@#3\endcsname}}%\r
1598 \expandafter\def\csname l#3\endcsname{%Other\r
1599   \@ifnextchar({\csname algocf@l#3opt\endcsname}{\csname algocf@l#3\endcsname}}%\r
1600 % with side text\r
1601 \expandafter\def\csname algocf@#3opt\endcsname(##1)##2{% \Other(){}{}\r
1602   \KwSty{#7} ##1\algocf@block{##2}{\@algocf@endoption{#8}}}%\r
1603 \expandafter\def\csname algocf@l#3opt\endcsname(##1)##2{% \Other(){}{}\r
1604   \KwSty{#7} ##2\algocf@endline\ ##1\par}%\r
1605 % without side text\r
1606 \expandafter\algocf@mkcmd\csname algocf@#3\endcsname[1]{% default\r
1607   \KwSty{#7}\algocf@block{##1}{\@algocf@endoption{#8}}}%\r
1608 \expandafter\algocf@mkcmd\csname algocf@l#3\endcsname[1]{% ldefault\r
1609   \KwSty{#7} ##1}%\r
1610 }%\r
1611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1612 %\r
1613 % If macros\r
1614 %\r
1615 \newcommand{\SetKwIF}[8]{% #1=\If #2=\ElseIf #3=\Else #4=if #5=then #6=elseif si #7=else #8=endif\r
1616\r
1617 % common text\r
1618 \@ifundefined{#1@ifthen}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1619 \expandafter\algocf@mkcmd\csname #1@ifthen\endcsname[1]{%\r
1620   \KwSty{#4} \ArgSty{##1} \KwSty{#5}}%\r
1621 \expandafter\algocf@mkcmd\csname #1@endif\endcsname[1]{\algocf@block{##1}{\@algocf@endoption{#8}}}%\r
1622 \expandafter\algocf@mkcmd\csname #1@noend\endcsname[1]{\algocf@group{##1}}%\r
1623 \expandafter\algocf@mkcmd\csname #1@else\endcsname[1]{\algocf@group{##1}\KwSty{#7}}%\r
1624 \@ifundefined{#2@elseif}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1625 \expandafter\algocf@mkcmd\csname #2@elseif\endcsname[1]{%\r
1626   \KwSty{#6} \ArgSty{##1} \KwSty{#5}}%\r
1627 \@ifundefined{#3@else}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1628 \expandafter\algocf@mkcmd\csname #3@else\endcsname{\KwSty{#7}}%\r
1629 %%%% If then { } endif\r
1630 %\r
1631 \@ifundefined{algocf@#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1632 % side text or not?\r
1633 \expandafter\def\csname#1\endcsname{%\r
1634   \@ifnextchar({\csname algocf@#1opt\endcsname}{\csname algocf@#1\endcsname}}%\r
1635 % with side text\r
1636 \expandafter\def\csname algocf@#1opt\endcsname(##1)##2##3{% \If(){}{}\r
1637   \csname #1@ifthen\endcsname{##2} ##1\csname #1@endif\endcsname{##3}}%\r
1638 % without side text\r
1639 \expandafter\algocf@mkcmd\csname algocf@#1\endcsname[2]{% \If{}{}\r
1640   \csname #1@ifthen\endcsname{##1}\csname #1@endif\endcsname{##2}}%\r
1641 %\r
1642 %%%% If then {} else {} endif\r
1643 %\r
1644 % side text or not?\r
1645 \expandafter\def\csname e#1\endcsname{%\r
1646   \@ifnextchar({\csname algocf@e#1thenopt\endcsname}{\csname algocf@e#1then\endcsname}}%\r
1647 % with side text after if\r
1648 \expandafter\def\csname algocf@e#1thenopt\endcsname(##1)##2##3{% \eIf()\r
1649   \csname #1@ifthen\endcsname{##2} ##1\csname #1@else\endcsname{##3}%\r
1650   \csname algocf@e#1thenelse\endcsname}%\r
1651 % without side text after if\r
1652 \expandafter\def\csname algocf@e#1then\endcsname##1##2{% \eIf()\r
1653   \csname #1@ifthen\endcsname{##1}\csname #1@else\endcsname{##2}%\r
1654   \csname algocf@e#1thenelse\endcsname}%\r
1655 % side text after else or not ?\r
1656 \expandafter\def\csname algocf@e#1thenelse\endcsname{%\r
1657   \@ifnextchar({\csname algocf@e#1elseopt\endcsname}{\csname algocf@e#1else\endcsname}}%\r
1658 % else with a side text\r
1659 \expandafter\def\csname algocf@e#1elseopt\endcsname(##1)##2{% \r
1660   ##1\csname #1@endif\endcsname{##2}}%\r
1661 % else without side text\r
1662 \expandafter\algocf@mkcmd\csname algocf@e#1else\endcsname[1]{%\r
1663   \csname #1@endif\endcsname{##1}}%\r
1664 %\r
1665 %%%% If then \r
1666 %\r
1667 % side text or not?\r
1668 \expandafter\def\csname l#1\endcsname{% lif\r
1669   \@ifnextchar({\csname algocf@l#1opt\endcsname}{\csname algocf@l#1\endcsname}}%\r
1670 \expandafter\def\csname u#1\endcsname{% uif\r
1671   \@ifnextchar({\csname algocf@u#1opt\endcsname}{\csname algocf@u#1\endcsname}}%\r
1672 % with side text\r
1673 \expandafter\def\csname algocf@l#1opt\endcsname(##1)##2##3{% \lIf(){}{}\r
1674   \csname #1@ifthen\endcsname{##2} ##3\algocf@endline\ ##1\par}%\r
1675 \expandafter\def\csname algocf@u#1opt\endcsname(##1)##2##3{% \uIf(){}{}\r
1676   \csname #1@ifthen\endcsname{##2} ##1\csname#1@noend\endcsname{##3}}%\r
1677 % without side text\r
1678 \expandafter\algocf@mkcmd\csname algocf@l#1\endcsname[2]{% \lIf{}{}\r
1679   \csname #1@ifthen\endcsname{##1} ##2}%\r
1680 \expandafter\algocf@mkcmd\csname algocf@u#1\endcsname[2]{% \uIf{}{}\r
1681   \csname #1@ifthen\endcsname{##1}\csname#1@noend\endcsname{##2}}%\r
1682 %\r
1683 %%%% ElseIf {} endif\r
1684 %\r
1685 \@ifundefined{algocf@#2}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1686 % side text or not?\r
1687 \expandafter\def\csname#2\endcsname{% ElseIf\r
1688   \@ifnextchar({\csname algocf@#2opt\endcsname}{\csname algocf@#2\endcsname}}%\r
1689 % with side text\r
1690 \expandafter\def\csname algocf@#2opt\endcsname(##1)##2##3{% \ElseIf(){}{}\r
1691   \csname #2@elseif\endcsname{##2} ##1\csname #1@endif\endcsname{##3}}%\r
1692 % without side text\r
1693 \expandafter\algocf@mkcmd\csname algocf@#2\endcsname[2]{% \ElseIf{}{}\r
1694   \csname #2@elseif\endcsname{##1}\csname #1@endif\endcsname{##2}}%\r
1695 %\r
1696 %%%% ElseIf\r
1697 %\r
1698 % side text or not?\r
1699 \expandafter\def\csname l#2\endcsname{% lElseIf\r
1700   \@ifnextchar({\csname algocf@l#2opt\endcsname}{\csname algocf@l#2\endcsname}}%\r
1701 \expandafter\def\csname u#2\endcsname{% uElseIf\r
1702   \@ifnextchar({\csname algocf@u#2opt\endcsname}{\csname algocf@u#2\endcsname}}%\r
1703 % with side text\r
1704 \expandafter\def\csname algocf@l#2opt\endcsname(##1)##2##3{% \lElseIf(){}{}\r
1705   \csname #2@elseif\endcsname{##2} ##3\algocf@endline\ ##1\par}%\r
1706 \expandafter\def\csname algocf@u#2opt\endcsname(##1)##2##3{% \uElseIf(){}{}\r
1707   \csname #2@elseif\endcsname{##2} ##1\csname #1@noend\endcsname{##3}}%\r
1708 % without side text\r
1709 \expandafter\algocf@mkcmd\csname algocf@l#2\endcsname[2]{% \lElseIf{}{}\r
1710   \csname #2@elseif\endcsname{##1} ##2}%\r
1711 \expandafter\algocf@mkcmd\csname algocf@u#2\endcsname[2]{% \uElseIf{}{}\r
1712   \csname #2@elseif\endcsname{##1}\csname #1@noend\endcsname{##2}}%\r
1713 %\r
1714 %%%% Else {} endif\r
1715 %\r
1716 \@ifundefined{algocf@#3}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1717 % side text or not?\r
1718 \expandafter\def\csname#3\endcsname{% Else\r
1719   \@ifnextchar({\csname algocf@#3opt\endcsname}{\csname algocf@#3\endcsname}}%\r
1720 % with side text\r
1721 \expandafter\def\csname algocf@#3opt\endcsname(##1)##2{% \Else(){}\r
1722   \csname #3@else\endcsname\ ##1\csname #1@endif\endcsname{##2}}%\r
1723 % without side text\r
1724 \expandafter\algocf@mkcmd\csname algocf@#3\endcsname[1]{% \Else{}\r
1725   \csname #3@else\endcsname\csname #1@endif\endcsname{##1}}%\r
1726 %\r
1727 %%%% Else \r
1728 %\r
1729 % side text or not?\r
1730 \expandafter\def\csname l#3\endcsname{% lElse\r
1731   \@ifnextchar({\csname algocf@l#3opt\endcsname}{\csname algocf@l#3\endcsname}}%\r
1732 \expandafter\def\csname u#3\endcsname{% uElse\r
1733   \@ifnextchar({\csname algocf@u#3opt\endcsname}{\csname algocf@u#3\endcsname}}%\r
1734 % with side text\r
1735 \expandafter\def\csname algocf@l#3opt\endcsname(##1)##2{% \lElse(){}\r
1736   \csname #3@else\endcsname\ ##2\algocf@endline\ ##1\par}%\r
1737 \expandafter\def\csname algocf@u#3opt\endcsname(##1)##2{% \uElse(){}\r
1738   \csname #3@else\endcsname\ ##1\csname #1@noend\endcsname{##2}}%\r
1739 % without side text\r
1740 \expandafter\algocf@mkcmd\csname algocf@l#3\endcsname[1]{% \lElse{}\r
1741   \csname #3@else\endcsname\ ##1}%\r
1742 \expandafter\algocf@mkcmd\csname algocf@u#3\endcsname[1]{% \uElse{}\r
1743   \csname #3@else\endcsname\csname #1@noend\endcsname{##1}}%\r
1744 }%\r
1745 %\r
1746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1747 %\r
1748 % For macros\r
1749 %\r
1750 \newcommand{\SetKwFor}[4]{%\r
1751 \@ifundefined{algocf@#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1752 % side text or not? \r
1753 \expandafter\def\csname#1\endcsname{%For\r
1754   \@ifnextchar({\csname algocf@#1opt\endcsname}{\csname algocf@#1\endcsname}}%\r
1755 \expandafter\def\csname l#1\endcsname{%For\r
1756   \@ifnextchar({\csname algocf@l#1opt\endcsname}{\csname algocf@l#1\endcsname}}%\r
1757 % with side text\r
1758 \expandafter\def\csname algocf@#1opt\endcsname(##1)##2##3{% \For(){}{}\r
1759   \KwSty{#2} \ArgSty{##2} \KwSty{#3} ##1\algocf@block{##3}{\@algocf@endoption{#4}}}%\r
1760 \expandafter\def\csname algocf@l#1opt\endcsname(##1)##2##3{% \lFor(){}{}\r
1761   \KwSty{#2} \ArgSty{##2} \KwSty{#3} ##3\algocf@endline\ ##1\par}%\r
1762 % without side text\r
1763 \expandafter\algocf@mkcmd\csname algocf@#1\endcsname[2]{% \For{}{}\r
1764   \KwSty{#2} \ArgSty{##1} \KwSty{#3}\algocf@block{##2}{\@algocf@endoption{#4}}}%\r
1765 \expandafter\algocf@mkcmd\csname algocf@l#1\endcsname[2]{% \lFor{}{}\r
1766   \KwSty{#2} \ArgSty{##1} \KwSty{#3} ##2}%\r
1767 }%\r
1768 %\r
1769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1770 %\r
1771 % Repeat macros\r
1772 %\r
1773 \newcommand{\SetKwRepeat}[3]{%\r
1774 \@ifundefined{algocf@#1}{\let\algocf@mkcmd=\newcommand}{\let\algocf@mkcmd=\renewcommand}%\r
1775 % side text or not?\r
1776 \expandafter\def\csname#1\endcsname{% Repeat\r
1777   \@ifnextchar({\csname algocf@#1opt\endcsname}{\csname algocf@#1\endcsname}}%\r
1778 \expandafter\def\csname l#1\endcsname{% lRepeat\r
1779   \@ifnextchar({\csname algocf@l#1opt\endcsname}{\csname algocf@l#1\endcsname}}%\r
1780 % with side text\r
1781 \expandafter\def\csname algocf@#1opt\endcsname(##1)##2##3{% \Repeat(){}{}\r
1782   \KwSty{#2} ##1\algocf@group{##3}\KwSty{#3} \ArgSty{##2}%\r
1783   \@ifnextchar({\csname algocf@#1optopt\endcsname}{\@endalgoln}%\r
1784 }%\r
1785 \expandafter\def\csname algocf@#1optopt\endcsname(##1){% \Repeat(){}{}()\r
1786   ##1\@endalgoln}%\r
1787 \expandafter\def\csname algocf@l#1opt\endcsname(##1)##2##3{% \lRepeat(){}{}\r
1788   \KwSty{#2} ##3 \KwSty{#3} \ArgSty{##2}\algocf@endline\ ##1\par}%\r
1789 % without side text\r
1790 \expandafter\algocf@mkcmd\csname algocf@#1\endcsname[2]{% \Repeat{}{}\r
1791   \KwSty{#2}\algocf@group{##2}\KwSty{#3} \ArgSty{##1}%\r
1792   \@ifnextchar({\csname algocf@#1optopt\endcsname}{\@endalgoln}%\r
1793 }%\r
1794 \expandafter\algocf@mkcmd\csname algocf@l#1\endcsname[2]{% \lRepeat{}{}\r
1795   \KwSty{#2} ##2 \KwSty{#3} \ArgSty{##1}}%\r
1796 }%\r
1797 %\r
1798\r
1799 %\r
1800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1801 %%%%%%%%%%%%%%%%%%%%        Environments definitions     %%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
1803 %\r
1804 %%\r
1805 %% Caption management\r
1806 %%\r
1807 % for the following macros:\r
1808 % #1 is given by caption and is equal to fnum@algocf\r
1809 % #2 is the text given in argument by the user in the \caption macro\r
1810 %\r
1811 %%%%% text of caption\r
1812 \newcommand{\algocf@captionlayout}[1]{#1}%\r
1813 \newcommand{\SetAlgoCaptionLayout}[1]{%\r
1814   \renewcommand{\algocf@captionlayout}[1]{\csname #1\endcsname{##1}}}%\r
1815 \newcommand{\algocf@capseparator}{:}%\r
1816 \newcommand{\SetAlgoCaptionSeparator}[1]{\renewcommand{\algocf@capseparator}{#1}}%\r
1817 \newcommand{\algocf@captiontext}[2]{%\r
1818   \algocf@captionlayout{\AlCapSty{\AlCapFnt #1\algocf@typo\algocf@capseparator}\nobreakspace%\r
1819     \AlCapNameSty{\AlCapNameFnt{}#2}}}% text of caption\r
1820 %\r
1821 %%%%% default caption of algorithm: used if no specific style caption is defined\r
1822 \newcommand{\algocf@makecaption}[2]{%\r
1823   \addtolength{\hsize}{\algomargin}%\r
1824   \sbox\@tempboxa{\algocf@captiontext{#1}{#2}}%\r
1825   \ifdim\wd\@tempboxa >\hsize%     % if caption is longer than a line\r
1826     \hskip .5\algomargin%\r
1827     \parbox[t]{\hsize}{\algocf@captiontext{#1}{#2}}% then caption is not centered\r
1828   \else%\r
1829     \global\@minipagefalse%\r
1830     \hbox to\hsize{\hfil\box\@tempboxa\hfil}% else caption is centered\r
1831   \fi%\r
1832   \addtolength{\hsize}{-\algomargin}%\r
1833 }%\r
1834 %\r
1835 \newsavebox\algocf@capbox%\r
1836 \newcommand{\algocf@makecaption@plain}[2]{%\r
1837   \global\sbox\algocf@capbox{\algocf@makecaption{#1}{#2}}}%\r
1838 \newcommand{\algocf@makecaption@boxed}[2]{%\r
1839   \addtolength{\hsize}{-\algomargin}%\r
1840   \global\sbox\algocf@capbox{\algocf@makecaption{#1}{#2}}%\r
1841   \addtolength{\hsize}{\algomargin}%\r
1842  }%\r
1843 %\r
1844 \newcommand{\algocf@makecaption@tworuled}[2]{\algocf@makecaption@ruled{#1}{#2}}%\r
1845 \newcommand{\algocf@makecaption@algoruled}[2]{\algocf@makecaption@ruled{#1}{#2}}%\r
1846 \newcommand{\algocf@makecaption@boxruled}[2]{\algocf@makecaption@ruled{#1}{#2}}%\r
1847 \newcommand{\algocf@makecaption@ruled}[2]{%\r
1848   \global\sbox\algocf@capbox{\hskip\AlCapHSkip% .5\algomargin%\r
1849     \parbox[t]{\hsize}{\algocf@captiontext{#1}{#2}}}% then caption is not centered\r
1850 }%\r
1851 %\r
1852 \newlength{\algoheightruledefault}\setlength{\algoheightruledefault}{0.8pt}%\r
1853 \newlength{\algoheightrule}\setlength{\algoheightrule}{\algoheightruledefault}%\r
1854 \newlength{\algotitleheightruledefault}\setlength{\algotitleheightruledefault}{0.8pt}%\r
1855 \newlength{\algotitleheightrule}\setlength{\algotitleheightrule}{\algotitleheightruledefault}%\r
1856 \newcommand{\algocf@caption@plain}{\vskip\AlCapSkip\box\algocf@capbox}%\r
1857 \newcommand{\algocf@caption@boxed}{\vskip\AlCapSkip\box\algocf@capbox}%\r
1858 \newcommand{\algocf@caption@ruled}{\box\algocf@capbox\kern\interspacetitleruled\hrule  height\algotitleheightrule depth0pt\kern\interspacealgoruled}%\r
1859 \newcommand{\algocf@caption@tworuled}{\box\algocf@capbox\kern\interspacetitleruled}%\r
1860 \newcommand{\algocf@caption@algoruled}{\algocf@caption@ruled}%\r
1861 \newcommand{\algocf@caption@boxruled}{%\r
1862   \addtolength{\hsize}{-0.8pt}%\r
1863   \hbox to\hsize{%\r
1864     \vrule%\hskip-0.35pt%\r
1865     \vbox{%\r
1866       \hrule\vskip\interspacetitleboxruled%\r
1867       \hbox to\hsize{\unhbox\algocf@capbox\hfill}\vskip\interspacetitleboxruled%\r
1868     }% \r
1869     %\hskip-0.35pt%\r
1870     \vrule%\r
1871   }\nointerlineskip%\r
1872   \addtolength{\hsize}{0.8pt}%\r
1873 }%\r
1874 %\r
1875 %\r
1876 %%%% set caption for the environment\r
1877 \newcommand{\algocf@captionref}{%\r
1878   \renewcommand{\fnum@algocf}[1]{\AlCapSty{\AlCapFnt\algorithmcfname\nobreakspace\algocf@algocfref}}%\r
1879   \addtocounter{algocf}{-1}% \caption do a refstepcounter, so we restore the precedent value\r
1880   \let\old@thealgocf=\thealgocf\renewcommand{\thealgocf}{{\relsize{\algocf@refrelsize}\algocf@algocfref}}%\r
1881   \gdef\@currentlabel{\algocf@algocfref}% let the label use the new ref\r
1882 }%\r
1883 %\r
1884 % Unfortunatly, we also need our own caption to set some specific stuff for special references. But after these\r
1885 % settings, we call the original caption.\r
1886 %\r
1887 \long\def\algocf@caption@algo#1[#2]#3{%\r
1888   \ifthenelse{\equal{\algocf@algocfref}{\relax}}{}{\algocf@captionref}%\r
1889   \@ifundefined{hyper@refstepcounter}{\relax}{% if hyper@refstepcounter undefind, no hyperref, else...\r
1890     \ifthenelse{\equal{\algocf@algocfref}{\relax}}{\renewcommand{\theHalgocf}{\thealgocf}}{% take algocf as Href\r
1891       \renewcommand{\theHalgocf}{\algocf@algocfref}}%else if SetAlgoRefName done, take this name as ref.\r
1892     \hyper@refstepcounter{algocf}%set algocf as category of ref\r
1893   }%\r
1894   \algocf@latexcaption{#1}[#2]{#3}% call original caption\r
1895 }%\r
1896 %\r
1897 % beamer define is own caption overrinding latex caption!\r
1898 % as we need it, we have put here the original definition\r
1899 % to handle manual ref, unfortunately we have to add one line to handle algocf@algocfref\r
1900 \long\def\algocf@latexcaption#1[#2]#3{% original definition of caption\r
1901   \par%\r
1902   \addcontentsline{\csname ext@#1\endcsname}{#1}%\r
1903   {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%\r
1904   \begingroup%\r
1905   \@parboxrestore%\r
1906   \if@minipage%\r
1907     \@setminipage%\r
1908   \fi%\r
1909   \normalsize%\r
1910   \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par%\r
1911   \endgroup%\r
1912 }%\r
1913 %\r
1914 % \ifx\beamer@makecaption\undefined%\r
1915 % \else% beamer detected\r
1916 \ifx\@makecaption\undefined%\r
1917 \newcommand{\@makecaption}[2]{\relax}%\r
1918 \fi%\r
1919 %%\r
1920 \r
1921 %\r
1922 % more and more packages redefine \@caption instead of just \@makecaption which makes algorithm2e\r
1923 % caption not works since based on standard \@caption. So we force the definition of \@caption to be\r
1924 % the standard one (the one from LaTeX) inside algorithm environment.\r
1925 %\r
1926 % unfortunately, makecaption is called with \ignorespace #3 so \r
1927 % we can't do the @currentlabel definition inside \algocf@captionproctext\r
1928 \long\def\algocf@caption@proc#1[#2]#3{%\r
1929   \ifthenelse{\boolean{algocf@nokwfunc}}{\relax}{%\r
1930     \SetKwFunction{\algocf@captname#3@}{\algocf@captname#3@}%\r
1931   }%\r
1932   % we tell hyperref to use algocfproc as category and to take the appropriate ref.\r
1933   \ifthenelse{\boolean{algocf@func}}{\def\@proc@func{algocffunc}}{\def\@proc@func{algocfproc}}%\r
1934   \@ifundefined{hyper@refstepcounter}{\relax}{% if hyper@refstepcounter undefind, no hyperref, else...\r
1935     \ifthenelse{\boolean{algocf@procnumbered}}{% \r
1936       \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%if procnumbered, take \thealgocf as ref\r
1937     }{%\r
1938       \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%else take procedure or function name\r
1939     }%\r
1940     \hyper@refstepcounter{\@proc@func}%\r
1941   }%\r
1942   \ifthenelse{\boolean{algocf@procnumbered}}{\relax}{%\r
1943     \addtocounter{algocf}{-1}% \caption do a refstepcounter, so we restore the precedent value\r
1944     \gdef\@currentlabel{\algocf@captname#3@}% let the label be the name of the function, not the counter\r
1945   }%\r
1946   \ifthenelse{\equal{\algocf@captparam#2@}{\arg@e}}{% if no paramater, we remove the ()\r
1947     \algocf@latexcaption{#1}[\algocf@procname\nobreakspace\algocf@captname#2@]{#3}%\r
1948   }{%                                                 else we give the complete name\r
1949     \algocf@latexcaption{#1}[\algocf@procname\nobreakspace#2]{#3}%\r
1950   }%\r
1951 }%\r
1952 %%\r
1953 %%% setcaption\r
1954 \newcommand{\algocf@setcaption}{%\r
1955   \ifthenelse{\boolean{algocf@procenvironment}}{% if proc environment, caption text must be changed\r
1956     \let\algocf@oldcaptiontext=\algocf@captiontext%\r
1957     \renewcommand{\algocf@captiontext}[2]{%\r
1958       \algocf@captionproctext{##1}{##2}%\r
1959     }%\r
1960   }{}%\r
1961   \let\algocf@savecaption=\@caption%\r
1962   \ifthenelse{\boolean{algocf@procenvironment}}{\let\@caption=\algocf@caption@proc}{\let\@caption=\algocf@caption@algo}%\r
1963   \let\algocf@oldmakecaption=\@makecaption%\r
1964   \renewcommand{\@makecaption}[2]{%\r
1965     \expandafter\csname algocf@makecaption@\algocf@style\endcsname{##1}{##2}%\r
1966   }%\r
1967 }%\r
1968 %\r
1969 %%%%% reset caption\r
1970 %\r
1971 % since we have force the LaTeX caption for algorithm environment, we must go back to the caption\r
1972 % used in the text.\r
1973 \newcommand{\algocf@resetcaption}{%\r
1974   \ifthenelse{\boolean{algocf@procenvironment}}{% if proc environment\r
1975     \let\thealgocf=\old@thealgocf% restore normal counter printing\r
1976     \let\algocf@captiontext=\algocf@oldcaptiontext% restore normal caption text\r
1977   }{}%\r
1978   \let\@caption=\algocf@savecaption% now restore caption outside algo/proc/func environment\r
1979   \let\@makecaption=\algocf@oldmakecaption% and restore makecaption outside outside algo/proc/func environment\r
1980   \algocf@resetfnum%\r
1981 }%\r
1982 %\r
1983 %%%%% nocaptionofalgo and restorecaptionofalgo --\r
1984 \newcommand{\NoCaptionOfAlgo}{%\r
1985   \let\@old@algocf@captiontext=\algocf@captiontext%\r
1986   \renewcommand{\algocf@captiontext}[2]{\AlCapNameSty{\AlCapNameFnt{}##2}}%\r
1987 }%\r
1988 \newcommand{\RestoreCaptionOfAlgo}{%\r
1989   \let\algocf@captiontext=\@old@algocf@captiontext%\r
1990 }%\r
1991 %\r
1992 % ----------------------  algocf environment\r
1993 %\r
1994 \newcounter{algocfline}%                    % new counter to make lines numbers be internally \r
1995 \setcounter{algocfline}{0}%                 % different in different algorithms\r
1996 \newcounter{algocfproc}% counter to count all algo environment (proc, func), just used by hyperref to avoir "same\r
1997 \setcounter{algocfproc}{0}% identifier" error caused by algocf being set to '-' for procedure or function or not\r
1998   % changed if no caption is given.\r
1999 %\r
2000 \expandafter\ifx\csname algocf@within\endcsname\relax% if \algocf@within doesn't exist\r
2001 \newcounter{algocf}%                        % just define a new counter\r
2002 \renewcommand{\thealgocf}{\@arabic\c@algocf}% and the way it is printed\r
2003 \else%                                     else\r
2004 \newcounter{algocf}[\algocf@within]%        % counter is numbered within \algocf@within\r
2005 \renewcommand\thealgocf{\csname the\algocf@within\endcsname.\@arabic\c@algocf}%\r
2006 \fi%\r
2007 %\r
2008 \def\fps@algocf{htbp}%        % default\r
2009 \def\ftype@algocf{10}%        % float type\r
2010 \def\ext@algocf{\algocf@list} % loa by default, lof if figure option used\r
2011 \newcommand{\fnum@algocf}[1]{\AlCapSty{\AlCapFnt\algorithmcfname\nobreakspace\thealgocf}}%\r
2012 \newcommand{\algocf@resetfnum}{\renewcommand{\fnum@algocf}[1]{\AlCapSty{\AlCapFnt\algorithmcfname\nobreakspace\thealgocf}}}%\r
2013 \newenvironment{algocf}%      % float environment for algorithms\r
2014                {\@float{algocf}}%\r
2015                {\end@float}%\r
2016 \newenvironment{algocf*}%     % float* environment for algorithms\r
2017                {\@dblfloat{algocf}}%\r
2018                {\end@dblfloat}%\r
2019 %\r
2020 \def\algocf@seclistalgo{}%\r
2021 \ifx\l@chapter\undefined\let\algocf@seclistalgo=\section\else\let\algocf@seclistalgo=\chapter\fi%\r
2022 \@ifundefined{if@restonecol}{\newif\if@restonecol}\relax%\r
2023 \newcommand\listofalgocfs{%\r
2024      \ifx\algocf@seclistalgo\chapter%\r
2025       \if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi%\r
2026     \fi%\r
2027      \algocf@seclistalgo*{\listalgorithmcfname}%\r
2028        \@mkboth{\MakeUppercase\listalgorithmcfname}%\r
2029                {\MakeUppercase\listalgorithmcfname}%\r
2030      \@starttoc{loa}%\r
2031     \ifx\algocf@seclistalgo\chapter%\r
2032       \if@restonecol\twocolumn\fi%\r
2033     \fi%\r
2034 }\r
2035 %\r
2036 \newcommand*\l@algocf{\@dottedtocline{1}{1em}{2.3em}}% line of the list\r
2037 %\r
2038 % ----------------------  algorithm environment\r
2039 %\r
2040 %%%%%%%\r
2041 %%\r
2042 %% Algorithm environment definition\r
2043 %%\r
2044 %%%%%%%\r
2045 %%\r
2046 %\r
2047 \newsavebox\algocf@algoframe%\r
2048 \def\@algocf@pre@plain{\relax}%  action to be done before printing the algo.\r
2049 \def\@algocf@post@plain{\relax}% action to be done after printing the algo.\r
2050 \def\@algocf@capt@plain{bottom}% where the caption should be localized.\r
2051 \def\@algocf@pre@boxed{\noindent\begin{lrbox}{\algocf@algoframe}}\r
2052 \def\@algocf@post@boxed{\end{lrbox}\framebox[\hsize]{\box\algocf@algoframe}\par}%\r
2053 \def\@algocf@capt@boxed{under}%\r
2054 \def\@algocf@pre@ruled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}%\r
2055 \def\@algocf@post@ruled{\kern\interspacealgoruled\hrule height\algoheightrule\relax}%\r
2056 \def\@algocf@capt@ruled{top}%\r
2057 \def\@algocf@pre@algoruled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}%\r
2058 \def\@algocf@post@algoruled{\kern\interspacealgoruled\hrule height\algoheightrule \relax}%\r
2059 \def\@algocf@capt@algoruled{top}%\r
2060 \def\@algocf@pre@tworuled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}%\r
2061 \def\@algocf@post@tworuled{\kern\interspacealgoruled\hrule height\algoheightrule\relax}%\r
2062 \def\@algocf@capt@tworuled{top}%\r
2063 \def\@algocf@pre@boxruled{\noindent\begin{lrbox}{\algocf@algoframe}}%\r
2064 \def\@algocf@post@boxruled{\end{lrbox}\framebox[\hsize]{\box\algocf@algoframe}\par}%\r
2065 \def\@algocf@capt@boxruled{above}%\r
2066 %\r
2067 \newcommand{\noalgocaption}{\def\@algocf@capt@ruled{none}}\r
2068 %\r
2069 %% before algocf or figure environment\r
2070 \newcommand{\@algocf@init@caption}{%\r
2071   \ifthenelse{\boolean{algocf@procenvironment}}{% if we are inside a procedure/function environment\r
2072     \@algocf@proctitleofalgo% set Titleofalgo to Procedure: or Function:\r
2073                             % accordingly to the environment\r
2074     \let\old@thealgocf=\thealgocf\ifthenelse{\boolean{algocf@procnumbered}}{\relax}{%\r
2075       \renewcommand{\thealgocf}{-}}%\r
2076   }{% else inside environment algorithm\r
2077     \@algocf@algotitleofalgo% fix name for \Titleofalgo to \algorithmcfname\r
2078   }%\r
2079   \algocf@setcaption%       set caption to our caption style\r
2080 }%\r
2081 %\r
2082 \newcommand{\@algofloatboxreset}{\@setminipage}\r
2083 \newcommand{\@algocf@init}{%\r
2084   \refstepcounter{algocfline}%\r
2085   \stepcounter{algocfproc}%to have a different counter for each environment and being abble to make the difference\r
2086     %between href of algoline in different algorithms.\r
2087   \ifthenelse{\boolean{algocf@optnoend}}{%\r
2088       \renewcommand{\algocf@block}[2]{\algocf@group{##1}}%\r
2089     }{%\r
2090       \renewcommand{\algocf@block}[2]{\algocf@@block{##1}{##2}}%\r
2091     }%\r
2092 }%\r
2093 %% after the end of algocf or figure environment\r
2094 \newcommand{\@algocf@term@caption}{%\r
2095   \algocf@resetcaption% restore original caption\r
2096 }%\r
2097 %\r
2098 \newcommand{\@algocf@term}{%\r
2099   \setboolean{algocf@algoH}{false}% no H by default\r
2100   \ifthenelse{\boolean{algocf@optnoend}}{%\r
2101     \renewcommand{\algocf@block}[2]{\algocf@@block{##1}{##2}}%\r
2102   }{%\r
2103     \renewcommand{\algocf@block}[2]{\algocf@group{##1}}%\r
2104   }%\r
2105   \SetAlgoRefName{\relax}%\r
2106 }%\r
2107 %\r
2108 %%%%%%%%%%%%%%%%%\r
2109 %% makethealgo: macro which print effectively the algo in its box\r
2110 %% \r
2111 \newsavebox\algocf@algobox%\r
2112 \newcommand{\algocf@makethealgo}{%\r
2113   \vtop{%\r
2114     % place caption above if needed  bye the style\r
2115     \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{above}}%\r
2116     {\csname algocf@caption@\algocf@style\endcsname}{}%\r
2117     %\r
2118     % precommand according to the style\r
2119     \csname @algocf@pre@\algocf@style\endcsname%\r
2120     % place caption at top if needed  bye the style\r
2121      \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{top}}%\r
2122      {\csname algocf@caption@\algocf@style\endcsname}{}%\r
2123     %\r
2124     \box\algocf@algobox% the algo\r
2125     % place caption at bottom if needed  bye the style\r
2126      \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{bottom}}%\r
2127      {\csname algocf@caption@\algocf@style\endcsname}{}%\r
2128     % postcommand according to the style\r
2129     \csname @algocf@post@\algocf@style\endcsname%\r
2130     % place caption under if needed  bye the style\r
2131      \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{under}}%\r
2132      {\csname algocf@caption@\algocf@style\endcsname}{}%\r
2133   }%\r
2134 }%\r
2135 %%%%%%%%%%%%%%%%%%%\r
2136 %\r
2137 %% at the beginning of algocf or figure environment\r
2138 \newcommand{\@algocf@start}{%\r
2139   \@algoskip%\r
2140   \begin{lrbox}{\algocf@algobox}%\r
2141   \setlength{\algowidth}{\hsize}%\r
2142   \vbox\bgroup% save all the algo in a box\r
2143   \hbox to\algowidth\bgroup\hbox to \algomargin{\hfill}\vtop\bgroup%\r
2144   \ifthenelse{\boolean{algocf@slide}}{\parskip 0.5ex\color{black}}{}%\r
2145   % initialization\r
2146   \addtolength{\hsize}{-1.5\algomargin}%\r
2147   \let\@mathsemicolon=\;\def\;{\ifmmode\@mathsemicolon\else\@endalgoln\fi}%\r
2148   \raggedright\AlFnt{}%\r
2149   \ifthenelse{\boolean{algocf@slide}}{\IncMargin{\skipalgocfslide}}{}%\r
2150   \@algoinsideskip%\r
2151 }%\r
2152 %\r
2153 %% at the end of algocf or figure environment\r
2154 \newcommand{\@algocf@finish}{%\r
2155   \@algoinsideskip%\r
2156   \egroup%end of vtop which contain all the text\r
2157   \hfill\egroup%end of hbox wich contains [margin][vtop]\r
2158   \ifthenelse{\boolean{algocf@slide}}{\DecMargin{\skipalgocfslide}}{}%\r
2159   %\r
2160   \egroup%end of main vbox\r
2161   \end{lrbox}%\r
2162   \algocf@makethealgo% print the algo\r
2163   \@algoskip%\r
2164   % restore dimension and macros\r
2165   \setlength{\hsize}{\algowidth}%\r
2166   \lineskip\normallineskip\setlength{\skiptotal}{\@defaultskiptotal}%\r
2167   \let\;=\@mathsemicolon%  \r
2168 }%\r
2169 %\r
2170 %%%%%%%%%%%%%%%%%%%%\r
2171 %% basic definition of the environment algorithm\r
2172 %%\r
2173 %\r
2174 \newboolean{algocf@procenvironment}\setboolean{algocf@procenvironment}{false}%\r
2175 \newboolean{algocf@func}\setboolean{algocf@func}{false}%\r
2176 \newboolean{algocf@algoH}\setboolean{algocf@algoH}{false}%\r
2177 \newboolean{algocf@algostar}\setboolean{algocf@algostar}{false}%\r
2178 %\r
2179 %%% environment for {algorithm}[H]\r
2180 \newenvironment{algocf@Here}{\noindent%\r
2181   \def\@captype{algocf}% if not defined, caption exit with an error\r
2182   \begin{minipage}{\hsize}%\r
2183 }{%\r
2184   \end{minipage}%\par%\r
2185 }%\r
2186 %%% real algorithm environment which manages H and * option\r
2187 %    \let\algocf@originalfloatboxreset=\@floatboxreset%\r
2188 %    \let\@floatboxreset=\@algofloatboxreset%\r
2189 \newenvironment{algocf@algorithm}[1][htbp]{\r
2190    \@algocf@init%\r
2191    \ifthenelse{\equal{\algocf@float}{figure}}{% if option figure set\r
2192      \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* with figure option\r
2193        \begin{figure*}[#1]% call figure*\r
2194      }{% else algorithm environment with figure option\r
2195        \begin{figure}[#1]%  call figure\r
2196      }%\r
2197    }{% else normal algorithm environment\r
2198      \@algocf@init@caption%\r
2199      \ifthenelse{\equal{#1}{H}}{% if [H] algorithm\r
2200        \if@twocolumn\@latex@error{[H] in two columns mode is not allowed for algorithms}\fi% TODO: SCREAM if H in two colums!\r
2201        \setboolean{algocf@algoH}{true}\begin{algocf@Here}% call corresponding environment\r
2202      }{% else floating algorithm environment\r
2203        \ifthenelse{\boolean{algocf@algostar}}{% if algorithm*\r
2204          \begin{algocf*}[#1]% call algocf*\r
2205        }{% else algorithm environment\r
2206          \begin{algocf}[#1]%  call algcf\r
2207        }%\r
2208      }%\r
2209    }% fin test option figure ou pas\r
2210    \@algocf@start% \r
2211    \@ResetCounterIfNeeded%\r
2212    \algocf@linesnumbered\ignorespaces%\r
2213 }{%\r
2214   \@algocf@finish%\r
2215   \ifthenelse{\equal{\algocf@float}{figure}}{%\r
2216      \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* with figure option\r
2217        \end{figure*}% call figure*\r
2218      }{% else algorithm environment with figure option\r
2219        \end{figure}%  call figure\r
2220      }%\r
2221   }{%\r
2222     \@algocf@term@caption%\r
2223     \ifthenelse{\boolean{algocf@algoH}}{% if [H] algorithm\r
2224        \end{algocf@Here}\par% call corresponding environment\r
2225      }{% else floating algorithm environment\r
2226        \ifthenelse{\boolean{algocf@algostar}}{% if algorithm*\r
2227          \end{algocf*}% call algocf*\r
2228        }{% else algorithm environment\r
2229          \end{algocf}%  call algocf\r
2230        }%\r
2231      }%\r
2232   }%\r
2233   \@algocf@term\ignorespacesafterend%\r
2234 }%\r
2235 %\r
2236 %%% user algorithm environment\r
2237 \newenvironment{\algocf@envname}[1][htbp]{%\r
2238   \setboolean{algocf@algostar}{false}%\r
2239   \setboolean{algocf@procenvironment}{false}\gdef\algocfautorefname{\algorithmautorefname}%\r
2240   \begin{algocf@algorithm}[#1]\ignorespaces%\r
2241 }{%\r
2242   \end{algocf@algorithm}\ignorespacesafterend%\r
2243 }%\r
2244 %%% user algorithm* environment\r
2245 \newenvironment{\algocf@envname*}[1][htbp]{%\r
2246   \setboolean{algocf@algostar}{true}%\r
2247   \setboolean{algocf@procenvironment}{false}\gdef\algocfautorefname{\algorithmautorefname}%\r
2248   \begin{algocf@algorithm}[#1]\ignorespaces%\r
2249 }{%\r
2250   \end{algocf@algorithm}\ignorespacesafterend%\r
2251 }%\r
2252 %\r
2253 %%%%%%%%%%%%%%%%%%%%%%%\r
2254 %%%\r
2255 %\r
2256 \expandafter\newcommand\csname\algocf@listofalgorithms\endcsname{%\r
2257   \ifthenelse{\equal{\algocf@float}{figure}}{\listoffigures}{\listofalgocfs}%\r
2258 }%\r
2259 %%%\r
2260 %%%\r
2261 %\r
2262 % ----------------------  procedure and function environments\r
2263 %\r
2264 %\r
2265 % -- new style (used in particular in the caption of function and procedure environments)\r
2266 %\r
2267 % three macros to extract parts of the caption\r
2268 \gdef\algocf@captname#1(#2)#3@{#1}  % keep characters before the first brace\r
2269 \gdef\algocf@captparam#1(#2)#3@{#2} % keep character in between the braces\r
2270 \gdef\algocf@captother#1(#2)#3@{#3} % keep character after the braces\r
2271 %\r
2272 %%% Text of caption for Procedure or Function\r
2273 \newcommand{\algocf@captionproctext}[2]{%\r
2274   {%\r
2275     \ProcSty{\ProcFnt\algocf@procname\ifthenelse{\boolean{algocf@procnumbered}}{\nobreakspace\thealgocf\algocf@typo\algocf@capseparator}{\relax}}%\r
2276     \nobreakspace\ProcNameSty{\ProcNameFnt\algocf@captname #2@}% Name of the procedure in ProcName Style. \r
2277     \ifthenelse{\equal{\algocf@captparam #2@}{\arg@e}}{}{% if no argument, write nothing\r
2278       \ProcNameSty{\ProcNameFnt(}\ProcArgSty{\ProcArgFnt\algocf@captparam #2@}\ProcNameSty{\ProcNameFnt)}%else put arguments in ProcArgSty:\r
2279     }% endif\r
2280     \algocf@captother #2@%\r
2281   }%\r
2282 }%\r
2283 %\r
2284 %\r
2285 % -- procedure and function environments are defined from algocf@algorithm environment\r
2286 %\r
2287 \newenvironment{procedure}[1][htbp]{%\r
2288   \setboolean{algocf@algostar}{false}%\r
2289   \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{false}%\r
2290   \newcommand{\algocf@procname}{\@algocf@procname}\gdef\algocfprocautorefname{\procedureautorefname}%\r
2291   \begin{algocf@algorithm}[#1]\ignorespaces%\r
2292 }{%\r
2293   \end{algocf@algorithm}\ignorespacesafterend%\r
2294 }%\r
2295 \newenvironment{function}[1][htbp]{%\r
2296   \setboolean{algocf@algostar}{false}%\r
2297   \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{true}%\r
2298   \newcommand{\algocf@procname}{\@algocf@funcname}\gdef\algocffuncautorefname{\functionautorefname}%\r
2299   \begin{algocf@algorithm}[#1]\ignorespaces%\r
2300 }{%\r
2301   \end{algocf@algorithm}\ignorespacesafterend%\r
2302 }%\r
2303 %\r
2304 \newenvironment{procedure*}[1][htbp]{%\r
2305   \setboolean{algocf@algostar}{true}%\r
2306   \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{false}%\r
2307   \newcommand{\algocf@procname}{\@algocf@procname}\gdef\algocfprocautorefname{\procedureautorefname}%\r
2308   \begin{algocf@algorithm}[#1]\ignorespaces%\r
2309 }{%\r
2310   \end{algocf@algorithm}\ignorespacesafterend%\r
2311 }%\r
2312 \newenvironment{function*}[1][htbp]{%\r
2313   \setboolean{algocf@algostar}{true}%\r
2314   \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{true}%\r
2315   \newcommand{\algocf@procname}{\@algocf@funcname}\gdef\algocffuncautorefname{\functionautorefname}%\r
2316   \begin{algocf@algorithm}[#1]\ignorespaces%\r
2317 }{%\r
2318   \end{algocf@algorithm}\ignorespacesafterend%\r
2319 }%\r
2320 %\r
2321 %\r
2322 %%%%%%%%%%%%%%%%%%%%\r
2323 %% definition of algondfloat environment\r
2324 %%\r
2325 \ifthenelse{\boolean{algocf@endfloat}}{% if endfloat option then\r
2326 \newcommand{\algoplace}{% macro which is used to writhe algorithm about there\r
2327    \begin{center}%\r
2328      [\algorithmcfname~\thepostfig\ about here.]%\r
2329    \end{center}%\r
2330 }%\r
2331 \newcommand{\algoendfloat}{% use as a \begin{algoendfloat} environment to start scanning of line\r
2332 %  \immediate\openout\@mainfff\jobname.fff%\r
2333   \efloat@condopen{fff}\r
2334   \efloat@iwrite{fff}{\string\begin{\algocf@envname}}%\r
2335     \if@domarkers%\r
2336        \ifthenelse{\equal{\algocf@list}{lof}}{%\r
2337          \addtocounter{postfig}{1}%\r
2338        }{%\r
2339          \addtocounter{postalgo}{1}%\r
2340        }%\r
2341        \algoplace%\r
2342     \fi%\r
2343     \bgroup%\r
2344     \let\do\ef@makeinnocent\dospecials%\r
2345     \ef@makeinnocent\^^L% and whatever other special cases\r
2346     \endlinechar`\^^M \catcode`\^^M=12 \ef@xalgocfendfloat}%\r
2347 }{\relax}%%%% end of endfloat option ifthenelse\r
2348 %% some macros useful for endfloat option that cannot be defined inside the ifthenelse\r
2349 %scan algoendfloat algorithm and write the text into .fff file\r
2350 {\catcode`\^^M=12 \endlinechar=-1 %\r
2351  \gdef\ef@xalgocfendfloat#1^^M{% scan the lines inside algoendfloat environment being read by latex\r
2352    \def\test{#1}% test is the line being currently scan by latex\r
2353    \ifx\test\ef@endalgocftest% if it is \end{algoendfloat}\r
2354      \def\next{% define next as to not continue the scan and write \end{algorithm} into .fff file\r
2355        \egroup\end{algoendfloat}%\r
2356        \efloat@iwrite{fff}{\string\end{\algocf@envname}}%\r
2357        \efloat@iwrite{fff}{\string\efloatseparator}%\r
2358        \efloat@iwrite{fff}{ }%\r
2359      }%\r
2360      \else% else write the current line being scanned by latex and set next to continue the scan\r
2361        \efloat@iwrite{fff}{#1}%\r
2362        \let\next\ef@xalgocfendfloat%\r
2363      \fi% endif\r
2364      \next}% next is continue if it was else condition, else it does not continue the scan and write end to file\r
2365 }%\r
2366 % test if the scan is finish by looking at the string \end{algoendfloat}\r
2367 {\escapechar=-1%\r
2368  \xdef\ef@endalgocftest{\string\\end\string\{algoendfloat\string\}}%\r
2369 }%\r
2370 %\r
2371 %\r
2372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
2373 %\r
2374\r
2375 \newcommand{\TitleOfAlgo}[1]{\@titleprefix\ \r
2376   \TitleSty{#1}\par\smallskip}%\r
2377 %\r
2378 \newcommand{\SetAlgorithmName}[3]{%\r
2379   \renewcommand{\listalgorithmcfname}{#3}%\r
2380   \renewcommand{\algorithmcfname}{#1}%\r
2381   \renewcommand{\algorithmautorefname}{#2}%\r
2382 }%\r
2383 %\r
2384 \newcommand{\algocf@refrelsize}{-2}\newcommand{\SetAlgoRefRelativeSize}[1]{\renewcommand{\algocf@refrelsize}{#1}}%\r
2385 \newcommand{\SetAlgoRefName}[1]{%\r
2386   \renewcommand{\algocf@algocfref}{#1}%\r
2387 }%\r
2388 %\r
2389 %\r
2390 %\r
2391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
2392 %\r
2393\r
2394 % -------------------------   Default Definitions\r
2395 %\r
2396 %%\r
2397 %%\r
2398 %\r
2399 \SetKwComment{tcc}{/* }{ */}%\r
2400 \SetKwComment{tcp}{// }{}%\r
2401 %\r
2402 %\newcommand{\algocf@defaults@common}{\r
2403 %\r
2404 %\r
2405 % french keywords\r
2406 %\r
2407 %\SetKwInOut{AlgDonnees}{Donn\'ees}\SetKwInOut{AlgRes}{R\'esultat}\r
2408 \SetKwInput{Donnees}{Donn\'ees}%\r
2409 \SetKwInput{Res}{R\'esultat}%\r
2410 \SetKwInput{Entree}{Entr\'ees}%\r
2411 \SetKwInput{Sortie}{Sorties}%\r
2412 \SetKw{KwA}{\`a}%\r
2413 \SetKw{Retour}{retourner}%\r
2414 \SetKwBlock{Deb}{d\'ebut}{fin}%\r
2415 \SetKwRepeat{Repeter}{r\'ep\'eter}{jusqu'\`a}%\r
2416 %\r
2417 \SetKwIF{Si}{SinonSi}{Sinon}{si}{alors}{sinon si}{sinon}{fin si}%\r
2418 \SetKwSwitch{Suivant}{Cas}{Autre}{suivant}{faire}{cas o\`u}{autres cas}{fin d'alternative}%\r
2419 \SetKwFor{Pour}{pour}{faire}{fin pour}%\r
2420 \SetKwFor{PourPar}{pour}{faire en parallèle}{fin pour}%\r
2421 \SetKwFor{PourCh}{pour chaque}{faire}{fin pour chaque}%\r
2422 \SetKwFor{PourTous}{pour tous les}{faire}{fin pour tous}%\r
2423 \SetKwFor{Tq}{tant que}{faire}{fin tq}%\r
2424 %\r
2425 % english keywords\r
2426 %\r
2427 \SetKwInput{KwIn}{Input}%\r
2428 \SetKwInput{KwOut}{Output}%\r
2429 \SetKwInput{KwData}{Data}%\r
2430 \SetKwInput{KwResult}{Result}%\r
2431 \SetKw{KwTo}{to}\r
2432 \SetKw{KwRet}{return}%\r
2433 \SetKw{Return}{return}%\r
2434 \SetKwBlock{Begin}{begin}{end}%\r
2435 \SetKwRepeat{Repeat}{repeat}{until}%\r
2436 %\r
2437 \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}%\r
2438 \SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end switch}%\r
2439 \SetKwFor{For}{for}{do}{end for}%\r
2440 \SetKwFor{ForPar}{for}{do in parallel}{end forpar}\r
2441 \SetKwFor{ForEach}{foreach}{do}{end foreach}%\r
2442 \SetKwFor{ForAll}{forall the}{do}{end forall}%\r
2443 \SetKwFor{While}{while}{do}{end while}%\r
2444 %\r
2445 % --- German keywords\r
2446 %\r
2447 \SetKwInput{Ein}{Eingabe}%KwIn\r
2448 \SetKwInput{Aus}{Ausgabe}%KwOut\r
2449 \SetKwInput{Daten}{Daten}%KwData\r
2450 \SetKwInput{Ergebnis}{Ergebnis}%KwResult\r
2451 \SetKw{Bis}{bis}%KwTo\r
2452 \SetKw{KwZurueck}{zur\"uck}%KwRet\r
2453 \SetKw{Zurueck}{zur\"uck}%Return\r
2454 \SetKwBlock{Beginn}{Beginn}{Ende}%Begin\r
2455 \SetKwRepeat{Wiederh}{wiederhole}{bis}%Repeat\r
2456 %\r
2457 \SetKwIF{Wenn}{SonstWenn}{Sonst}{wenn}{dann}{sonst wenn}{sonst}{Ende wenn}%gIf\r
2458 \SetKwSwitch{Unterscheide}{Fall}{Anderes}{unterscheide}{tue}{Fall}{sonst}{Ende Unt.}%Switch\r
2459 \SetKwFor{Fuer}{f\"ur}{tue}{Ende f\"ur}%For\r
2460 \SetKwFor{FuerPar}{f\"ur}{tue gleichzeitig}{Ende gleichzeitig}%ForPar\r
2461 \SetKwFor{FuerJedes}{f\"ur jedes}{tue}{Ende f\"ur}%ForEach\r
2462 \SetKwFor{FuerAlle}{f\"ur alle}{tue}{Ende f\"ur}%ForAll\r
2463 \SetKwFor{Solange}{solange}{tue}{Ende solange}%While\r
2464 %\r
2465 % --- Czech keywords\r
2466 %\r
2467 \SetKwInput{Vst}{Vstup}%\r
2468 \SetKwInput{Vyst}{V\'{y}stup}%\r
2469 \SetKwInput{Vysl}{V\'{y}sledek}%\r
2470 %\r
2471 % --- Portuguese keywords\r
2472 %\r
2473 \SetKwInput{Entrada}{Entrada}%\r
2474 \SetKwInput{Saida}{Sa\'{i}da}%\r
2475 \SetKwInput{Dados}{Dados}%\r
2476 \SetKwInput{Resultado}{Resultado}%\r
2477 \SetKw{Ate}{at\'{e}}\r
2478 \SetKw{KwRetorna}{retorna}%\r
2479 \SetKw{Retorna}{retorna}%\r
2480 \SetKwBlock{Inicio}{in\'{i}cio}{fim}%\r
2481 \SetKwRepeat{Repita}{repita}{at\'{e}}%\r
2482 %\r
2483 \SetKwIF{Se}{SenaoSe}{Senao}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}%\r
2484 \SetKwSwitch{Selec}{Caso}{Outro}{selecione}{fa\c{c}a}{caso}{sen\~{a}o}{fim selec}%\r
2485 \SetKwFor{Para}{para}{fa\c{c}a}{fim para}%\r
2486 \SetKwFor{ParaPar}{para}{fa\c{c}a em paralelo}{fim para}\r
2487 \SetKwFor{ParaCada}{para cada}{fa\c{c}a}{fim para cada}%\r
2488 \SetKwFor{ParaTodo}{para todo}{fa\c{c}a}{fim para todo}%\r
2489 \SetKwFor{Enqto}{enquanto}{fa\c{c}a}{fim enqto}%\r
2490 %\r
2491 % --- Italian keywords\r
2492 %\r
2493 \SetKwInput{KwIng}{Ingresso}%\r
2494 \SetKwInput{KwUsc}{Uscita}%\r
2495 \SetKwInput{KwDati}{Dati}%\r
2496 \SetKwInput{KwRisult}{Risultato}%\r
2497 \SetKw{KwA}{a}%\r
2498 \SetKw{KwRitorna}{ritorna}%\r
2499 \SetKw{Ritorna}{ritorna}%\r
2500 \SetKwBlock{Inizio}{inizio}{fine}%\r
2501 \SetKwRepeat{Ripeti}{ripeti}{finché}%\r
2502 %\r
2503 \SetKwIF{Sea}{AltSe}{Altrimenti}{se}{allora}{altrimenti se}{allora}{fine se}%\r
2504 \SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endsw}%\r
2505 \SetKwFor{Per}{per}{fai}{fine per}%\r
2506 \SetKwFor{PerPar}{per}{fai in parallelo}{fine per}%\r
2507 \SetKwFor{PerCiascun}{per ciascun}{fai}{fine per ciascun}%\r
2508 \SetKwFor{PerTutti}{per tutti i}{fai}{fine per tutti}%\r
2509 \SetKwFor{Finche}{finché}{fai}{fine finché}%\r
2510 %\r
2511 % --- End \r
2512 %}\r
2513 %\r
2514 %\algocf@defaults@common\r
2515 %\r
2516 % option onelanguage redefinition\r
2517 %\r
2518 \ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{french}}{%\r
2519 \SetKwInput{KwIn}{Entr\'ees}%\r
2520 \SetKwInput{KwOutSortie}{Sorties}%\r
2521 \SetKwInput{KwData}{Donn\'ees}%\r
2522 \SetKwInput{KwResult}{R\'esultat}%\r
2523 \SetKw{KwTo}{\`a}%\r
2524 \SetKw{KwRet}{retourner}%\r
2525 \SetKw{Return}{retourner}%\r
2526 \SetKwBlock{Begin}{d\'ebut}{fin}%\r
2527 \SetKwRepeat{Repeat}{r\'ep\'eter}{jusqu'\`a}%\r
2528 %\r
2529 \SetKwIF{If}{ElseIf}{Else}{si}{alors}{sinon si}{sinon}{fin si}%\r
2530 \SetKwSwitch{Switch}{Case}{Other}{suivant}{faire}{cas o\`u}{autres cas}{fin d'alternative}%\r
2531 \SetKwFor{For}{pour}{faire}{fin pour}%\r
2532 \SetKwFor{ForPar}{pour}{faire en parallèle}{fin pour}%\r
2533 \SetKwFor{ForEach}{pour chaque}{faire}{fin pour chaque}%\r
2534 \SetKwFor{ForAll}{pour tous les}{faire}{fin pour tous}%\r
2535 \SetKwFor{While}{tant que}{faire}{fin tq}%\r
2536 }{}%\r
2537 \ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{german}}{%\r
2538 \SetKwInput{KwIn}{Eingabe}%KwIn\r
2539 \SetKwInput{KwOut}{Ausgabe}%KwOut\r
2540 \SetKwInput{KwData}{Daten}%KwData\r
2541 \SetKwInput{KwResult}{Ergebnis}%KwResult\r
2542 \SetKw{KwTo}{bis}%KwTo\r
2543 \SetKw{KwRet}{zur\"uck}%KwRet\r
2544 \SetKw{Return}{zur\"uck}%Return\r
2545 \SetKwBlock{Begin}{Beginn}{Ende}%Begin\r
2546 \SetKwRepeat{Repeat}{wiederhole}{bis}%Repeat\r
2547 %\r
2548 \SetKwIF{If}{ElseIf}{Else}{wenn}{dann}{sonst wenn}{sonst}{Ende wenn}%gIf\r
2549 \SetKwSwitch{Switch}{Case}{Other}{unterscheide}{tue}{Fall}{sonst}{Ende Unt.}%Switch\r
2550 \SetKwFor{For}{f\"ur}{tue}{Ende f\"ur}%For\r
2551 \SetKwFor{ForPar}{f\"ur}{tue gleichzeitig}{Ende gleichzeitig}%ForPar\r
2552 \SetKwFor{ForEach}{f\"ur jedes}{tue}{Ende f\"ur}%ForEach\r
2553 \SetKwFor{ForAll}{f\"ur alle}{tue}{Ende f\"ur}%ForAll\r
2554 \SetKwFor{While}{solange}{tue}{Ende solange}%While\r
2555 }{}%\r
2556 \ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{portugues}}{%\r
2557 \SetKwInput{KwIn}{Entrada}%\r
2558 \SetKwInput{KwOut}{Sa\'{i}da}%\r
2559 \SetKwInput{KwData}{Dados}%\r
2560 \SetKwInput{KwResult}{Resultado}%\r
2561 \SetKw{KwTo}{at\'{e}}\r
2562 \SetKw{KwRet}{retorna}%\r
2563 \SetKw{Return}{retorna}%\r
2564 \SetKwBlock{Begin}{in\'{i}cio}{fim}%\r
2565 \SetKwRepeat{Repeat}{repita}{at\'{e}}%\r
2566 %\r
2567 \SetKwIF{If}{ElseIf}{Else}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}%\r
2568 \SetKwSwitch{Switch}{Case}{Other}{selecione}{fa\c{c}a}{caso}{sen\~{a}o}{fim selec}%\r
2569 \SetKwFor{For}{para}{fa\c{c}a}{fim para}%\r
2570 \SetKwFor{ForPar}{para}{fa\c{c}a em paralelo}{fim para}\r
2571 \SetKwFor{ForEach}{para cada}{fa\c{c}a}{fim para cada}%\r
2572 \SetKwFor{ForAll}{para todo}{fa\c{c}a}{fim para todo}%\r
2573 \SetKwFor{While}{enquanto}{fa\c{c}a}{fim enqto}%\r
2574 }{}%\r
2575 \ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{italiano}}{%\r
2576 \SetKwInput{KwIn}{Ingresso}%\r
2577 \SetKwInput{KwOut}{Uscita}%\r
2578 \SetKwInput{KwData}{Dati}%\r
2579 \SetKwInput{KwResult}{Risultato}%\r
2580 \SetKw{KwTo}{a}%\r
2581 \SetKw{KwRet}{ritorna}%\r
2582 \SetKw{Return}{ritorna}%\r
2583 \SetKwBlock{Begin}{inizio}{fine}%\r
2584 \SetKwRepeat{Repeat}{ripeti}{finché}%\r
2585 %\r
2586 \SetKwIF{If}{ElseIf}{Else}{se}{allora}{altrimenti se}{allora}{fine se}%\r
2587 \SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{endsw}%\r
2588 \SetKwFor{For}{per}{fai}{fine per}%\r
2589 \SetKwFor{ForPar}{per}{fai in parallelo}{fine per}%\r
2590 \SetKwFor{ForEach}{per ciascun}{fai}{fine per ciascun}%\r
2591 \SetKwFor{ForAll}{per tutti i}{fai}{fine per tutti}%\r
2592 \SetKwFor{While}{finché}{fai}{fine finché}%\r
2593 }{}%\r
2594 %\r
2595 %%%% old commands compatibility\r
2596 %\r
2597 \ifthenelse{\boolean{algocf@oldcommands}}{%\r
2598 \newcommand{\SetNoLine}{\SetAlgoNoLine}%\r
2599 \newcommand{\SetVline}{\SetAlgoVlined}%\r
2600 \newcommand{\SetLine}{\SetAlgoLined}%\r
2601 %\r
2602 \newcommand{\dontprintsemicolon}{\DontPrintSemicolon}%\r
2603 \newcommand{\printsemicolon}{\PrintSemicolon}%\r
2604 \newcommand{\incmargin}[1]{\IncMargin{#1}}%\r
2605 \newcommand{\decmargin}[1]{\DecMargin{-#1}}%\r
2606 \newcommand{\setnlskip}[1]{\SetNlSkip{#1}}%\r
2607 \newcommand{\Setnlskip}[1]{\SetNlSkip{#1}}%\r
2608 \newcommand{\setalcapskip}[1]{\SetAlCapSkip{#1}}%\r
2609 \newcommand{\setalcaphskip}[1]{\SetAlCapHSkip{#1}}%\r
2610 \newcommand{\nlSty}[1]{\NlSty{#1}}%\r
2611 \newcommand{\Setnlsty}[3]{\SetNlSty{#1}{#2}{#3}}%\r
2612 \newcommand{\linesnumbered}{\LinesNumbered}%\r
2613 \newcommand{\linesnotnumbered}{\LinesNotNumbered}%\r
2614 \newcommand{\linesnumberedhidden}{\LinesNumberedHidden}%\r
2615 \newcommand{\showln}{\ShowLn}%\r
2616 \newcommand{\showlnlabel}[1]{\ShowLnLabel{#1}}%\r
2617 \newcommand{\nocaptionofalgo}{\NoCaptionOfAlgo}%\r
2618 \newcommand{\restorecaptionofalgo}{\RestoreCaptionOfAlgo}%\r
2619 \newcommand{\restylealgo}[1]{\RestyleAlgo{#1}}%\r
2620 %\r
2621 \newcommand{\Titleofalgo}[1]{\TitleOfAlgo{#1}}%\r
2622 \SetKwIF{gSi}{gSinonSi}{gSinon}{si}{alors}{sinon si}{sinon}{fin si}%\r
2623 \SetKwIF{gIf}{gElsIf}{gElse}{if}{then}{else if}{else}{end if}%\r
2624 \SetKwIF{gIf}{gElseIf}{gElse}{if}{then}{else if}{else}{end if}%\r
2625 \SetKwIF{gWenn}{gSonstWenn}{gSonst}{wenn}{dann}{sonst wenn}{sonst}{Ende wenn}%gIf\r
2626 \SetKwIF{gSe}{gSenaoSe}{gSenao}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}%\r
2627 \SetKwIF{gSea}{gAltSe}{gAltrimenti}{se}{allora}{altrimenti se}{allora}{fine se}%\r
2628 }{%\r
2629   \relax%\r
2630 }%\r
2631 %\r
2632 %\r
2633 %\r
2634 %%\r
2635 %%%\r
2636 %%%% END