From 56d3c609e20dfd35cb5187d29a0d1fa7a429f8ad Mon Sep 17 00:00:00 2001 From: Kahina Date: Fri, 10 Jun 2016 12:30:08 +0200 Subject: [PATCH] je viens de rajouter les fichiers .sty --- algorithm2e.sty | 3254 +++++++++++++++++++++++++++++++++++ algorithme.sty | 420 +++++ algorithmic.sty | 188 ++ bbm.sty | 40 + changemargin.sty | 16 + drop.sty | 67 + dropping.sty | 137 ++ spimbasephdthesis.sty | 430 +++++ upmethodology-backpage.sty | 81 + upmethodology-code.sty | 143 ++ upmethodology-document.sty | 560 ++++++ upmethodology-extension.sty | 123 ++ upmethodology-fmt.sty | 1498 ++++++++++++++++ upmethodology-frontpage.sty | 230 +++ upmethodology-p-common.sty | 230 +++ upmethodology-spec.sty | 457 +++++ upmethodology-task.sty | 268 +++ upmethodology-version.sty | 203 +++ yfonts.sty | 128 ++ 19 files changed, 8473 insertions(+) create mode 100644 algorithm2e.sty create mode 100644 algorithme.sty create mode 100644 algorithmic.sty create mode 100644 bbm.sty create mode 100644 changemargin.sty create mode 100644 drop.sty create mode 100644 dropping.sty create mode 100644 spimbasephdthesis.sty create mode 100644 upmethodology-backpage.sty create mode 100644 upmethodology-code.sty create mode 100644 upmethodology-document.sty create mode 100644 upmethodology-extension.sty create mode 100644 upmethodology-fmt.sty create mode 100644 upmethodology-frontpage.sty create mode 100644 upmethodology-p-common.sty create mode 100644 upmethodology-spec.sty create mode 100644 upmethodology-task.sty create mode 100644 upmethodology-version.sty create mode 100644 yfonts.sty diff --git a/algorithm2e.sty b/algorithm2e.sty new file mode 100644 index 0000000..07ab7ff --- /dev/null +++ b/algorithm2e.sty @@ -0,0 +1,3254 @@ +% algorithm2e.sty --- style file for algorithms +% almost everything can be customized by users. See the document for more explanations +%% Copyright 1996-2015 Christophe Fiorio +% +% This work may be distributed and/or modified under the conditions of the LaTeX Project +% Public License, either version 1.3 of this license or (at your option) any later version. +% The latest version of this license is in http://www.latex-project.org/lppl.txt and +% version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is M. Christophe Fiorio +% +% This work consists of the files algorithm2e.sty and algorithm2e.tex +% and the associated example files algorithm2e_exAlgoDisjdecomp.tex, +% algorithm2e_exIR.tex, algorithm2e_ex01.tex, algorithm2e_exProg.tex, +% algorithm2e_ex02.tex, algorithm2e_exfor.tex, algorithm2e_ex03.tex, +% algorithm2e_exgeneric.tex, algorithm2e_ex04.tex, algorithm2e_exgeneric2.tex, +% algorithm2e_ex05.tex, algorithm2e_exnlsty.tex, algorithm2e_ex06.tex, +% algorithm2e_exrepeat.tex, algorithm2e_ex07.tex, algorithm2e_exswitch.tex +% +% Report bugs and comments to: +% - algorithm2e-announce@lirmm.fr mailing list for announcement about releases^^J% +% - algorithm2e-discussion@lirmm.fr mailing list for discussion about package^^J% +% subscribe by emailing sympa@lirmm.fr with 'subscribe '^^J% +% +% $Id: algorithm2e.sty,v 5.1 2015/10/18 21:37:30 cfiorio Exp $ +% +% PACKAGES REQUIRED: +% +% - float (in contrib/supported/float) +% - ifthen (in base) +% - xspace (in packages/tools) +% - relsize (in contrib/misc/relsize.sty) +% +%%%%%%%%%%%%%%% Release 5.1 +% +% Package options: +% --------------- +% - oldcommands : to use old command names +% - french, english, german, ngerman +% portuguese, czech, italiano, +% slovak, croatian, spanish : for the name of the algorithm and some keyword code +% - onelanguage : to simply switch keyword from one language to another without changing +% keyword commands +% - boxed, boxruled, ruled, tworuled, +% algoruled, plain : layout of the algorithm +% - algo2e : environment is algorithm2e instead of algorithms and \listofalgorithmes +% instead of \listofalgorithms +% - slide : to use when making slides +% - noline,lined,vlined : how block are designed. +% - shortend, longend, noend : short or long end keyword as endif for e.g. +% - linesnumbered : auto numbering of the algorithm's lines +% - linesnumberedhidden : to hide autonumbered lines (show number on a line with \ShowLn +% - commentsnumbered, inoutnumbered : to autonumber comments and inout keywords (by defaut not numbered) +% - rightnl : to have line number on the right instead of on the left as default +% - algonl : line numbers preceded by algo number +% - scright, scleft : right or left justified side comments +% - fillcomment, nofillcomment : end mark of comment is flushed to the right so comments fill the line +% - dotocloa : add an entry in the toc for list of algorithms (require tocbibind package) +% - endfloat : add algoendfloat environment pushing algorithm so written to the end of document +% - resetcount, noresetcount : start value of line numbers. +% - algopart,algochapter,algosection : algo numbering within part, chapter or section +% - titlenumbered,titlenotnumbered : numbering of title set by \Titleofalgo +% - figure : algorithms are figures, numbered as figures, and put in the list of figures. +% - procnumbered : procedure or function are numbered as algorithm +% - nokwfunc : procedure or function name doens't become a command +% - norelsize : don't use relsize package (useful if it breaks the compatibily) +% - displayblockmarkers : display begin, end keywords at start of each block +% +% defaults are; english,plain,resetcount,titlenotnumbered +% +%%%%%%%%%%%%%% +% +% Short summary +% ------------- +% +% algorithm is an environment for writing algorithm in LaTeX2e. +% Almost all is customizable. You can add keywords, change style, change the layout, ... +% It provide macros that allow you to create differents sorts of key words, therefore a set of predefined key +% word is gived. +% +% IT should be used as follows +% +% \begin{algorithm} +% ... +% ... +% \end{algorithm} +% +% +% IMPORTANT : each line MUST end with \; +% +% Note that if you define macros outside algorithm environment they +% are avaible in all the document and particulary you can use then +% inside all algorithms without re-define them. +% +% an example: +% +% \begin{algorithm} +% \SetAlgoLined +% \KwIn{this text} +% \KwOut{how to write algorithm with \LaTeX2e } +% +% initialization\; +% \While{not at end of this document}{ +% read current section\; +% \eIf{understand}{ +% go to next section\; +% current section becomes this one\; +% }{ +% go back to the beginning of current section\; +% } +% } +% \caption{How to write algorithm} +% \end{algorithm} +% +% +%%%%%%%%%%%%%% predefined keywords +% +% \KwIn{input} +% \KwOut{output} +% \KwData{input} +% \KwResult{output} +% \KwTo % a simple keyword +% \KwFrom % a simple keyword +% \KwRet{[value]} +% \Return{[value]} +% \Begin{block inside} +% \eIf{condition}{Then Block}{Else block} % in blocks +% \If{condition}{Then block} % in a block +% \uIf{condition}{Then block} % in a block unended +% \lIf{condition}{Else text} % on the same line +% \Else{inside Else} % in a block +% \lElse{Else text} % on the same line +% \uElse{Else text} % in a block unended +% \ElseIf{inside Elseif} % in a block +% \lElseIf{Elseif text} % on the same line +% \uElseIf{Elseif text} % in a block unended +% \Switch{Condition}{Switch block} +% \Case{a case}{case block} % in a block +% \lCase{a case}{case text} % on the same line +% \Other{otherwise block} % in a block +% \lOther{otherwise block} % on the same line +% \For{condition}{text loop} % in a block +% \lFor{condition}{text} % on the same line +% \ForEach{condition}{text loop} % in a block +% \lForEach{condition}{text} % on the same line +% \ForPar{condition}{text loop} % in a block +% \lForPar{condition}{text} % on the same line +% \While{condition}{text loop} % in a block +% \lWhile{condition}{text loop} % on the same line +% \Repeat{End condition}{text loop} % in a block +% \lRepeat{condition}{text} % on the same line +% +%%%%%%%%%%%%%% +% +% History: +% +% - October 19 2015 - revision 5.1 +% * CHANGE/ADD: l commands (the ones as \lIf) can now be used with a +% star. If done, no end of line are done, so you can enclose +% l command into another one. For example, you can write: +% \lForEach{$i$}{\lIf*{foo}{bar}}. +% Note that when you use a star, side comments are not allowed. +% * CHANGE/ADD: Now you can have a side comment at end of macros which +% have a block. For example you can do : +% \Begin(\tcc*[h]{side comment for begin}{text}(\tcc*[h]{side comment after end}) +% Note: there are some side effects for some commands: +% \SetKwProg : macro defined thanks to \SetKwProg are allowed +% to have no end marker. In this case, +% beware to end side comment, this can +% do weird output (but no error) +% * CHANGE: \SetKwSwitch defines also an \uOther command which was not +% the case until this release. +% * CHANGE: \SetStartEndCondition{typo1}{typo2}{typo3} defined two end +% conditions (type2 and typo3) : typo3 is no more used for +% case condition as typo2 is used which is more consistent +% since there is a condition followed by a keyword as for +% if-then or other command that are defined using typo2. +% * CHANGE: keywords was not language dependant to allow to use multiple +% languages in the same document, but some keywords in +% different language were having the same keyword that lead +% last one declared to replace first one and so you could have some +% spanish keywords printed as you were in portuguese. So +% this behavior is changed from now: +% - localized keywords are defined if according language +% option is defined ; +% - if you want to keep old behaviour and use localized +% keywords without using language option (keep old +% behavior), you can use languagekw option +% (e.g. frenchkw, germankw, ...). Note that you can use +% multiple languagekw options at the same time, in +% contrary of language option. Note also that if you use +% multiple languagekw options, you can get back the same +% problem as previously when keywords was not language +% dependant. +% * ADD: new typo styles: +% - Arguments of functions have now their own style. By +% default, FuncArgSty is the same as ArgSty. +% - Name of KwProg have now their own sty (they used ArgSty +% previously). By default, ProgSty is still ArgSty. +% As usual, \SetFuncArgSty{}, FuncArgSty{} and +% \SetProgSty{}, ProgSty{} are macros to set and use these +% typo styles. +% * ADD: Options to manage algorithm hangindent +% Until this revision, long statement acts as classical text and +% continue on next line starting from the same point. This makes +% difficult to notice that the new lines of text is not a new +% statement. Now, hangindent is managed and when a long +% statement continue on next lines, lines, except the first, +% are indented. +% Option: noalgohanging +% By default, long statement are indented on subsequent +% lines; with this option you get old behavior and lines are +% no more indented +% Option: hangingcomment +% Comment that are alone on a line (not side comment) are +% not driven by algo hanging: subsequent lines of long +% comments are indented according to width of start comment +% marker. With this option, comment are indented like normal +% statement. +% Option: hanginginout +% As for comment, by default, in/out keywords and input +% keywords (defined by \SetKwInOut or \SetKwInput) are not +% indented by algorithm hangindent. They are indented +% according to width of input keyword. If you want that these +% keywords acts like normal statement, use this option. +% \SetAlgoHangIndent{length} +% This macro allows you to set your own indent length. By +% default, \SetAlgoHangIndent{0.5em} +% * ADD: Group markers. +% This option is related to block markers of release 5.0. Some +% have ask to put also block markers for single line +% command. This new feature has been implemented to do this. +% So, you can now ask package to put begin and end keywords +% automatically at start and end of single line command (see +% example in documentation). +% These new group markers macros are: +% - \AlgoDisplayGroupMarkers and \AlgoDontDisplayGroupMarkers +% Note that a new option has also been added: displaygroupmarkers +% * ADD: \SetCustomAlgoRuledWidth{length} +% set a custom ruled width of ruled and algoruled options ; +% note that by the moment you use this macro, rules will have +% this fixed length: this can cause strange behavior in +% multicolumn mode or other layout that change the line +% width. +% * ADD: turkish language option +% * FIX: a spurious whitespace which results in a spurious indent in the +% user's text right after the end of the algorithm environment +% was introduced in release 5.0. This is fixed now thanks to +% Alexander Malkis. +% * FIX: there was a problem with margins in caption when option figure +% was use with caption package. This is fixed. +% * FIX: when changing font size in caption with, interline skip stayed +% unchanged and so with a small font was to large. This is fixed. +% * FIX: in contrary of that is written in the documentation, ':' what +% not in KwSty typo for KwIn and KwOut command. This is fixed. +% * FIX: strange behaviour with label and lines numbered: @currentlabel +% was updated according to algo line number not in all +% situation. For e.g, with hyperref package, always updated ; +% with \nlset also updated, but with \nl or linesnumbered +% option, not updated. This "feature" causes different output +% with \label command according to options used which is not +% that one want. This is solved now, and @currentlabel is +% always updated so \label command works always is the same way. +% * FIX: some czech keywords +% * FIX: some spanish keywords +% * FIX: some croatian keywords +% * FIX: krantz class changes definition of chapter and get one more +% option that classical classes as book.cls or report.cls and +% broke fix for hyperref on chapter definition. This is now +% fixed and algorithm detects use of krantz class and use then +% a definition of chapter working with krantz class. +% * FIX: an issue with internal macro which causes ([Q]) use as argument +% of some environment to be misprinted (thanks to Martin Schröder). +% * FIX: mispelled name of hyperrefcounter inside internal macro. +% +% - January 06 2013 - revision 5.0 +% * CHANGE: SetKwSwitch takes now 9 args: 9th arg is the same as +% previous 8th arg ('end of switch' keyword). New 8th arg is +% 'end of case' keyword. This is due to change of release +% 3.2 which introduce end after case block... as I never +% test with longend option, I never see that the 'end +% switch' used for case was not good. +% * CHANGE: when no end keyword is defined in a block macro, then +% algorithm2e does no more try to print it. So even with lined or noline +% option, no empty line is printed (before: a blank end was +% printed, so a blank line appeared) +% * Internal Change: add some internal function to improve readibility +% (thanks to Philip K. F. H\ölzenspies) +% * ADD: Block markers. +% You can now ask package to put begin and end keywords automatically at begin +% and end of blocks, it means each group of commands shifted and enclosed in +% braces. +% This is tricky to use but, combined with \SetStartEndCondition and +% redefinition of keywords, you should be abble to simulate any syntax. See +% examples in documentation where a generic example is derived in pseudo-code, +% python and C by keeping code and changing only style using block markers +% macros, \SetStartEndCondition and some redefinition of keywords. +% These new block markers macros are: +% - \AlgoDisplayBlockMarkers and \AlgoDontDisplayBlockMarkers +% - \SetAlgoBlockMarkers{begin marker}{end marker} +% - \BlockMarkersSty{text} and \SetBlockMarkersSty +% Note that a new option has also been added: displayblockmarkers +% * ADD: \leIf macro automatically defined by \SetKwIF: allow to define +% an if-then-else on a single line. +% * ADD: new macro \SetStartEndCondition{typo1}{typo2}{typo3} which +% sets typo around condition in For, If, Switch, Case and +% Repeat macros. First two are used around For, If, Swith +% conditions, First and third are used for Case and Repeat +% condition where condition ends the line. Default definition +% is \SetStartEndCondition{ }{ }{}. +% A common alternative is \SetStartEndCondition{ (}{) }{)} +% Can also be used to remove space around condition, for +% example if you want python style commands: +% \SetStartEndCondition{ }{}{} and \SetKwFor{For}{for}{:}{} +% * ADD: new environment algomathdisplay which allow display math (like inside \[ \] or $$ $$) +% handling end line and line number +% * ADD: new command \SetKwProg{Env}{Title}{is}{end} which defines a macro +% \Env{args}{text}. Env is a block with 'Title' (in \CapSty) at the beginning +% followed by args followed by 'is' then 'text' is put below inside a block ended +% by 'end'. If no 'end' is specified, nothing is written (no +% blank line is inserted). Useful to typeset function or prog for example: +% \SetKwProg{Fn}{Function}{ is}{end} makes \Fn{afunc(i: int) : int}{return 0\;} +% writes: +% Function afunc(i: int) : int is +% | return 0; +% end +% or \SetKwProg{Def}{def}{:}{} makes \Def{afunc(i: int)}{return 0\;} writes: +% def afunc(i: int): +% | return 0 +% Tip: combine it with \SetKwFunction to write recursive function algorithm. With +% example above, you could define \SetKwFunction{\Afunc}{afunc} and then write: +% \Def{\Afunc{i:int}{\eIf{i>0}{\KwRet \Afunc{i-1}}{\KwRet 0\;}} that writes: +% def afunc(i: int): +% | if(i>0): +% | return afunc(i-1) +% | else: +% | return 0 +% with appropriate typo. +% * ADD: option croatian: croatian keywords (thanks to Ivan Gavran) +% * ADD: option ngerman: same as german option but so can be used with global option ngerman +% of babel +% * ADD: option spanish: Spanish support (thanks to Mario Abarca) +% * ADD: unterminated block: useful to add part separator that doesn't necessary need an end +% keyword. +% Designed on the pattern of unterminated if (see \uIf macro) allowing to +% add a block that is not terminated by a keyword. Such block are defined in the same +% time as a block is defined by adding a macro beginning with u. So, for example, +% predefined \SetKwBlock{Begin}{begin}{end} defines now two commands: +% - \Begin{} as previously which print a begin - end block +% - \uBegin{} that defines a begin only block +% * FIX: problem when numbering line inside until condition of +% \SetKwRepeat macro: line number was not correctly aligned. +% * FIX: dotocloa option which was broken +% * FIX: uIf and uCase didn't have same behavior when used with +% noline, vlined or lined option. This is fixed. Side effect: no empty +% line after an uIf or uCase when used with options lined or vlined +% * FIX: a bug with Repeat Until command when use with side comment on Until +% * FIX: a bug with side text -- text put into () -- of command macro (SetKwIf and so on) +% which was always setting a ';' even after a \DontPrintSemicolon +% * FIX: a bug with hyperref and chapter definition (thanks to Hubert Meier) +% * FIX: bugs with l macro and side comment +% * FIX: revision number +% * FIX: fix non ascii character (utf8 not yet recognized by all latex engine) +% * FIX: fnum@algocf had an useless parameter which sometimes broke expansion and output an error +% * FIX: works now with multicol package +% +% - december 14 2009 - revision 4.1 +% * ADD: new command \SetKwHangingKw{Name}{text} (hanging indent with keyword): This creates a +% hanging indent much like \texttt{SetKwInput}, except that it removes the trailing `:' +% and does not reset numbering (thanks to Nathan Tallent) +% +% - november 17 2009 - revision 4.00 - +% +% * CHANGE: IMPORTANT: some commands have been renamed to have consistent naming (CamlCase +% syntax) and old commands are no more available. If you doesn't want to change +% your mind or use old latex files, you can use oldcommands option to enable old +% commands back. +% text. Here are these commands: +% - \SetNoLine becomes \SetAlgoNoLine +% - \SetVline becomes \SetAlgoVlined +% - \Setvlineskip becomes \SetVlineSkip +% - \SetLine becomes \SetAlgoLined +% - \dontprintsemicolon becomes \DontPrintSemicolon +% - \printsemicolon becomes \PrintSemicolon +% - \incmargin becomes \IncMargin +% - \decmargin becomes \DecMargin +% - \setnlskip becomes \SetNlSkip +% - \Setnlskip becomes \SetNlSkip +% - \setalcapskip becomes \SetAlCapSkip +% - \setalcaphskip becomes \SetAlCapHSkip +% - \nlSty becomes \NlSty +% - \Setnlsty becomes \SetNlSty +% - \linesnumbered becomes \LinesNumbered +% - \linesnotnumbered becomes \LinesNotNumbered +% - \linesnumberedhidden becomes \LinesNumberedHidden +% - \showln becomes \ShowLn +% - \showlnlabel becomes \ShowLnLabel +% - \nocaptionofalgo becomes \NoCaptionOfAlgo +% - \restorecaptionofalgo becomes \RestoreCaptionOfAlgo +% - \restylealgo becomes \RestyleAlgo +% - gIf macros and so on do no more exist +% * NEW: - Compatibily with other packages improven by changing name of internal +% macros. Algorithm2e can now be used with arabtex for example, if this last is +% loaded after algorithm2e package. +% * ADD: - OPTION endfloat: endfloat packages doesn't allow float environment inside other +% environment. So using it with figure option of algorithm2e makes error. This +% option enables a new environment algoendfloat to be used instead of algorithm +% environment that put algorithm at the end. algoendfloat environment make +% algorithm acting as endfloat figures. This option requires endfloat packages. +% * ADD: - OPTION norelsize: starting from this release (v4.00), algorithm2e package uses +% relsize package in order to get relative size for lines numbers; but it seems +% that some rare classes (such as inform1.cls) are not compatible with relsize; to +% have algorithm2e working, this option makes algorithm2e not to load relsize +% package and go back to previous definition by using \scriptsize font for lines +% numbers. +% * ADD: - OPTION onelanguage: allow, if using standard keywords listed below, to switch +% from one language to another without changing keywords by using appropriate +% language option: +% . KwIn, KwOut, KwData, KwResult +% . KwTo KwFrom +% . KwRet, Return +% . Begin +% . Repeat +% . If, ElseIf, Else +% . Switch, Case, Other +% . For, ForPar, ForEach, ForAll, While +% . +% * ADD: - OPTION rightnl: put lines numbers to the right of the algorithm instead of left. +% * ADD: new commands \setRightLinesNumbers and \setLeftLinesNumbers which sets the lines +% numbers to the right or to the left of the algorithm. +% * ADD: - new kind of keywords: KwArray used to define arrays: +% \SetKwArray{Kw}{array} defines an array keywords Kw called array and printed in +% DataSty style when call with \Kw. It can be used with one argument which +% denotes the element index: \Kw{n} prints array[n] with array in DataSty and n in +% ArgSty. +% * ADD/FIX: rules of ruled, algoruled, tworuled styles used rules of different sizes! This +% is now fixed. Moreover size of the rules is now controlled by a length and so +% can be customized by the user. +% \algoheightrule is the height of the rules and can be changed via \setlength +% \algoheightruledefault is the default height of he rules (0.8pt) +% \algotitleheightrule is the height of the rule that comes just after the +% caption in ruled and algoruled style; it can be changed via \setlength +% \algotitleheightruledefault is the default height of this rules (0.8pt) +% Thanks to Philippe Dumas who reports the bug and make the suggestion. +% * ADD: - \SetAlgoCaptionSeparator which sets the separator between Algorithm 1 and the +% title. By default it's ':' and caption looks like "Algorithm 2: title" but now +% you can change it by using for example \SetAlgoCaptionSeparator{.} which will +% give "Algorithm 3. title" +% * ADD: - \SetAlgoLongEnd and \SetAlgoShortEnd and \SetAlgoNoEnd commands which act as +% corresponding package options +% * ADD: - OPTIONS italiano and slovak as new language (thanks to Roberto Posenato and +% Miroslav Binas) +% * CHANGE: - Fnt and Sty macro to have consistent use and naming (see below) +% * ADD: - \AlCapSty, \AlCapNameSty, \AlCapFnt, \AlCapNameFnt, \ProcSty, \ProcFnt, +% \ProcNameSty, \ProcNameFnt, \ProcArgSty, ProcArgFnt and corresponding "set macro" +% \SetAlCapSty, \SetAlCapNameSty, \SetAlCapFnt, \SetAlCapNameFnt, \SetProcSty, +% \SetProcFnt, \SetProcNameSty, \SetProcNameFnt, \SetProcArgSty, \SetProcArgFnt which +% control the way caption is printed. Sty macro use command taking one parameter as +% argument, Fnt macros use directly command. In Fact caption is printed as follow: +% \AlCapSty{\AlCapFnt Algorithm 1:}\AlCapNameSty{\AlCapNameFnt my algorithm} +% By default, \AlCapSty is textbf and \AlCapFnt is nothing. \AlCapNameSty keep text +% as it is, and \AlCapNameFnt do nothing also. +% You can redefine \AlCapFnt and \AlCapNameFnt by giving macro to \Set commands. For +% example, you can do \SetAlCapFnt{\large} to see Algorithm printed in \large font. +% You can redefine \AlCapSty, \AlCapFnt, \AlCapNameSty and \AlCapNameFnt with the +% corresponding \Set command. For the Sty commands, you have to give in parameter +% name of a macro (whithout \) which takes one argument. For example, +% \SetAlCapFnt{textbf} defines the default behaviour. If you want to do more +% complicated thing, you should define your own macro and give it to \SetAlCapFnt or +% \SetAlCapNameFnt. Here are two examples: +% - \newcommand{\mycapsty}[1]{\tiny #1}\SetAlCapNameSty{mycapsty} +% - \newcommand{\mycapsty}[1]{\textsl{\small #1}}\SetAlCapNameSty{mycapsty} +% Or you can combine the two, for the last example you can also do: +% \SetAlCapNameSty{textsl}\SetAlCapNameFnt{\small} +% Thanks to Jan Stilhammer who gives me the idea of \AlCapNameFnt. +% * CHANGE \AlTitleFnt to match definition of all other Fnt macros and add a \AlTitleSty +% macro (see below) . Now you set \AlTitleFnt by calling \SetAlTitleFnt with +% directly a macro without parameter in argument: +% Example: \SetAlTitleFnt{\small} to set title in small font. +% * ADD: - \AlTitleSty and \SetAlTitleSty commands to set a style for title. These commands +% are defined from a macro taking the text in argument, as \textbf for example. +% To set the TitleSty you have to give name of the macro (without the '\') +% to \SetAlTitleSty. For example \SetAlTitleSty{textbf} to set \textbf style. +% * ADD: - new command \SetAlgorithmName{algorithmname}{list of algorithms name} which +% redefines name of the algorithms and the sentence list of algorithms. Second +% argument is the name that \autoref, from hyperref package, will use. Example: +% \SetAlgorithmName{Protocol}{List of protocols} if you prefer protocol than +% algorithm. +% * ADD: - new \SetAlgoRefName{QXY} which change the default ref (number of the algorithm) by +% the name given in parameter (QXY in the example). +% * ADD: - new command \SetAlgoRefRelativeSize{-2} which sets the output size of refs, defined +% by \SetAlgoRefName, used in list of algorithms. +% * ADD: - two dimensions to control the layout of caption in ruled, algoruled and boxruled +% algorithms: +% - interspacetitleruled (2pt by defaut) which controls the vertical space between +% rules and title in ruled and algoruled algorithms. +% - interspaceboxruled (2\lineskip by default) which controls the vertical space +% between rules and title in boxruled algorithms. +% These two dimensions can be changed by using \setlength command. +% * ADD: - With the fix (see below) of procedure and function environments, a new feature has +% been added: the name of the procedure or function set in caption is automatically +% defined as a KwFunction and so can be used as a macro. For example, if inside a +% procedure environment you set \caption{myproc()}, you can use \myproc macro in you +% main text. Beware that the macro is only defined after the \caption! +% * ADD: - OPTION nokwfunc to unable the new feature described above in function and +% procedure environment. Useful if you use name of procedure or function that cannot +% be a command name as a math display for example. +% * ADD: - \SetAlgoNlRelativeSize{number} command which sets the relative size of line +% numbers. By default, line numbers are two size smaller than algorithm text. Use +% this macro to change this behavior. For example, \SetAlgoNlRelativeSize{0} sets it +% to the same size, \SetAlgoNlRelativeSize{-1} to one size smaller and +% \SetAlgoNlRelativeSize{1} to one size bigger +% * ADD: - \SetAlgoProcName{aname} command which sets the name of Procedure printed by +% procedure environment (the environment prints Procedure by default). Second +% argument is the name that \autoref, from hyperref package, will use. +% * ADD: - \SetAlgoFuncName{aname} command which sets the name of Function printed by +% procedure environment (the environment prints Function by default). Second +% argument is the name that \autoref, from hyperref package, will use. +% * ADD: - \SetAlgoCaptionLayout{style} command which sets style of the caption; style must +% be the name of a macro taking one argument (the text of the caption). Examples +% below show how to use it: +% . \SetAlgoCaptionLayout{centerline} to have centered caption +% . \SetAlgoCaptionLayout{textbf} to have bold caption +% If you want to apply two styles in the same time, such as centered bold, you have +% to define you own macro and then use \SetAlgoCaptionLayout with its name. +% * ADD: - OPTION procnumbered: which makes the procedure and function to be numbered as +% algorithm +% * ADD: - OPTIONS tworuled and boxruled +% these are two new layouts: tworuled acts like ruled but doesn't put a line after +% caption ; boxruled surround algorithm by a box, puts caption above and add a line +% after caption. +% * REMOVE: - SetKwInParam has been deleted since not useful itself because of different +% macros which can do the same in a better and a more consistent way as +% SetKwFunction or SetKw. +% * FIX: - line number is now correctly vertically aligned with math display. +% * FIX: - references with hyperref. No more same identifier or missing name error. BUT now +% you must NOT use naturalnames option of hyperref packages if you do PdfLaTeX +% * FIX: - autoref with hyperref package (thanks to Jörg Sommer who notices the problem). +% * FIX: - titlenumbered was not working! fixed. +% * FIX: - Else(){} acted like uElse. Corrected. +% * FIX: - noend management: when a block was inside another and end of block was following +% each other, a blank line was added: it's now corrected. +% * FIX: - Function and Procedure environment was no more working as defined originally: the +% label was no more name of the procedure, it acts always as if procumbered option +% has been used. +% * FIX: - line numbers had a fixed size which can be bigger than algorithm text accordingly +% to \AlFnt set (see also new command \SetAlgoNlRelativeSize above) +% * FIX: - semicolon in comments when dontprintsemicolon is used. +% * FIX: - listofalgorithms adds a vertical space before first algo of a chapter as for +% listoffigures or listoftables +% * FIX: - listofalgorithms with twocolumns mode and some classes which don't allow onecolumn +% and so don't define \if@restonecol as prescribed in LaTeX (sig-alternate for +% example) +% * FIX: - algorithm2e now works with elsart cls and some more classes. +% * FIX: - blocks defined by SetKwBlock act now as other blocks (if for instance) and don't +% write end in vlined mode, instead they print a small horizontal line as required +% by the option. +% * FIX: - underfull hbox warning at each end of algorithm environment removed. +% +% * INTERNAL CHANGE: - short end keyword are deduce from long end keyword by keeping the +% first one. Allows to avoid double definition. +% * INTERNAL CHANGE: - procedure, function and algorithm are now resolved by the same +% environment to avoid code duplication. +% +% - October 04 2005 - revision 3.9 - +% * ADD: - \setalcaphskip command which sets the horizontal skip before Algorithm: in caption +% when used in ruled algorithm. +% * ADD: - \SetAlgoInsideSkip command which allows to add an extra vertical space before and +% after the core of the algorithm (ie: \SetAlgoInsideSkip{bigskip}) +% * CHANGE: - caption, when used with figure option, is no more controlled by algorithm2e +% package and so follows the exact behaviour of figures. The drawback is that you +% cannot change the typo with AlTitleFnt or CapFnt. The avantage is that if you +% use caption package, it works. +% * FIX: - problem with numbering line and pdflatex +% * FIX: - error when algorithm2e package was used with beamer and listings together +% - February 12 2005 - revision 3.8 - +% * FIX: - extra line with noend option. +% - February 10 2005 - revision 3.7 - +% * ADD: - sidecomment: different macros allowing to put text right after code on the same +% line. They are defined in the same time comment macros are defined with a star +% after the macro name. By default comments are right justified but this can be +% change with appropriate option in the macro. Ex: +% . default: \tcc*{side comment} +% . same as previous: \tcc*[r]{side comment} +% . left justify: \tcc*[l]{side comment} +% . here: \tcc*[h]{side comment} don't put the end of line mark before +% comment (; by default) and don't end the line. +% . flushed: \tcc*[f]{side comment} same as the precedent but right +% justified +% * ADD: - OPTION scright (default): right justified side comments (side comments +% are flushed to the righr) +% * ADD: - OPTION scleft: left justified side comments (side comments are put right after the +% code line) +% * ADD: - \SetSideCommentLeft acts as scleft option +% * ADD: - \SetSideCommentRight acts as scright option +% * ADD: - block like macro side text: all macro defining a block allows now to put text right +% after key words by putting text into (). Done to be used with sidecomment macros, +% but all text can be used. +% Ex: \eIf(\tcc*[f]{then comment}){test}{then text}(else side text){else text} +% * ADD: - OPTION fillcomment (default): end mark of comment is flushed to the right so +% comments fill all the width of text. +% * ADD: - OPTION nofillcomment: end mark of comment is put right after the comment. +% * ADD: - \SetNoFillComment acts as nofillcomment option. +% * ADD: - \SetFillComment acts as fillcomment option. +% * ADD: - OPTION dotocloa: which adds an entry in the toc for the list of algorithms. This +% option load package tocbibind if not already done and so list of figures and list +% of tables are also added in the toc. If you want to control which ones of the lists +% will be added in the toc, please load package tocbibind before package algorithm +% and give it the options you want. +% * FIX: - vertical spacing for uif macro with noend option +% * FIX: - all the compatibility problems between caption and other packages +% * FIX: - typographical differences between list of algorithms and other lists when in +% report or book +% +% - January 24 2005 - revision 3.6 - +% * FIX: - vertical spacing and space characters at the beginning or end of comments. +% line numbers of comments not in the NlSty. +% Thanks to Arnaud Giersch for his comments and suggestions. +% * FIX: - Set*Sty macro: the styles defined was not protected and was modified by surrounding +% context. For example KwTo in a \For{}{} was in bold AND italic instead of just in +% bold. +% * FIX: - line number misplacement after \Indp +% +% - January 21 2005 - revision 3.5 - +% * ADD: - hidden numbering of the lines. Lines are auto-numbered but numbers are shown only +% on lines you specify: +% * linesnumberedhidden option or \LinesNumberedHidden macro activate this +% functionnality. +% * \ShowLn and \ShowLnLabel{lab} macros make the number visible on the +% line. \ShowLnLabel{lab} allows to set a label for this line. +% Thanks to Samson de Jager who makes this suggestion and provides the macros. +% * ADD: - \AlCapFnt and \SetAlCapFnt which allow to have a different font for +% caption. Works like \AlFnt and \SetAlFnt and by default is the same. +% * ADD: - \AlCapSkip skip length. This vertical space is added before caption in plain ou +% boxed mode. It allows to change distance between text and caption. +% * FIX: - caption compatible with IEEEtran class. +% * FIX: - some vertical spacing error with \uIf macros (Thanks to Arnaud Giersch) +% * FIX: - Procedure and Function: lines are also numbered like algorithms +% * FIX: - CommentSty was not used for Comments +% +% - January 10 2005 - revision 3.4 - +% * FIX: - caption compatible with new release of Beamer class. +% +% - June 16 2004 - revision 3.3 - +% * FIX: - Hyperlink references of Hyperref package works now if compiled with pdflatex +% and [naturalnames] option of hyperref package is used. +% * FIX: - algorithm[H] had problem in an list environment - corrected +% * FIX: - interline was not so regular in nested blocks - corrected +% * ADD - \SetVlineSkip macro which sets the vertical skip after the little horizontal +% rule which closes a block in Vlined mode. By default 0.8ex +% +% - June 11 2004 - revision 3.2 - AUTO NUMBERING LINES !!! +% * ADD: auto numbering of the lines (the so asked and so long awaiting feature) +% this feature is managed by 3 options and 3 commands: +% - linesnumbered option: lines of the algo are numbered except for comments and +% input/output (KwInput and KwInOut) +% - commentsnumbered option: makes comments be numbered +% - inoutnumbered option: makes data input/output be numbered +% - \nllabel{lab} labels the line so you can cite with \ref{lab} +% - \LinesNumbered make the following algorithms having auto-numbered lines +% - \linesnotnumbered make the following algorithms having no auto-numbered lines +% * Change: algo2e option renames listofalgorithms in listofalgorithmes +% * FIX: new solution for compatibility with color package, more robust and not tricky. +% Many thanks to David Carlisle for his advices +% +% - June 09 2004 - revision 3.1 - +% * Change: \SetKwSwitch command defines an additionnal macro \uCase and \Case prints end +% * Change: now macros SetKw* do a renewcommand if the keyword is already defined. So you can +% redefine default definition at your own convenience or change your definition +% without introducing a new macro and changing your text. +% * ADD: new macro \SetKwIF which do \SetKwIf and +% \SetKwIfElseIf.The following default definition has been added: +% \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif} +% and so you get the macros; +% \If \eIf \lIf \uIf \ElseIf \uElseIf \lElseIf \Else \uElse \lElse +% * ADD: new macro \SetAlgoSkip which allow to fix the vertical skip before and after the +% algorithms. Default is smallskip, do \SetAlgoSkip{} if you don't want an extra space +% or \SetAlgoSkip{medskip} or \SetAlgoSkip{bigskip} if you want bigger space. +% * ADD: macro \SetKwIf defines in addition a new macro \uElse (depending on wat name you +% have given in #2 arg). +% * ADD: macro \SetKwIfElseIf defines in addition a new macro \uElse and \ugElseIf (depending +% on what name you have given in #2 and #3 arg). +% * Change: baseline of algorithm is now top, so two algorithms can be put side by side. +% * FIX: Compatibility with color package solved. The problem was due to a redefinition of +% standard macros by color package. This solves compatibility problem with other +% packages as pstcol or colortbl. (notified by Dirk Fressmann, Antti Tarvainen and Koby +% Crammer) +% * Fix: extra little shift to the right with boxed style algorithm removed (notified by +% P. Tanovski) +% * Fix: algoln option was buggy (notified bye Jiaying Shen) +% * Fix: german and portuges option didn't work due to bad typo (notified by Martin Sievers, +% Thorsten Vitt and Jeronimo Pellegrini) +% +% - February 13 2004 - revision 3.0 - +% * Major revision which makes the package independent from float.sty, so now +% - algorithm* works better, in particular can be used in multicols environments +% - (known bug corrected) +% [H] works now for all sort of environment but is handled differently for classic +% environment and star environment (algorithm, figure, procedure and function). For star +% environment, H acts like for classical figure environment, so it doesn't stay here +% absolutely. +% - (known bug corrected) +% you can use now floatflt package with algorithm package and even with figure +% option. Beware that if you want to put an algorithm inside a floatingfigure, it cannot +% be floating, so [H] is required and then figure option should not be used, since +% standard figure[H] are still floating with LaTeX. +% * boxruled: a new style added. Possible now since no style no more defined by the float +% package. +% * nocaptionofalgo: dosen't print Algorithm #: in the caption for algorithm in ruled or +% algoruled style. +% note: this is just documentation of a macro which was already in the package. +% - December 14 2003 - revision 2.52 - +% * output message shorter +% * French keyword macro \PourTous was missing for longend option, it has been added. +% * TitleofAlgo prints Function or Procedure in corresponding environments. +% +% - October 27 2003 - revision 2.51 - Revision submitted to CTAN archive +% * correction of a minor which make caption in procedure +% and function to be blanck with pdfscreen package +% (thanks to Joel Gossens for the notification) +% * add two internal definition to avoid some errors when +% used with Hyperref package (Hyperref package need to +% define new counter macro from existing ones, and +% don't do it for algorithm2e package, so we do it) +% +% - October 17 2003 - revision 2.50 - first revision for CTAN archive +% * add \AlFnt and \SetAlFnt{font} macros: \AlFnt is used at the beginning of the caption and +% the body of algorithm in order to define the fonts used for typesetting algorithms. You +% can use it elsewhere you want to typeset text as algorithm. For example you can do +% \SetAlFnt{\small\sf} to have algorithms typeset in small sf font. Default is nothing so +% algorithm is typeset as the text of the document. +% * add \AlTitleFnt{text} and \SetAlTitleFnt{font} macros: The {Algorithm: } in the caption is +% typeset with \AlTitleFnt{Algorithm:}. You can use it to have text typeset as {Algorithm:} +% of captions. Default is textbf. Default can be redefined by \SetAlTitleFnt{font}, for +% example you can do \SetAlTitleFnt{emph} +% * add CommentSty typo for text comment. +% * add some compatibility with hyperref package (still an error on multiply defined refs but +% pdf correctly generated) +% * flush text to left in order to have correct indentation even with class as amsart which +% center all figures +% * add german, portuguese and czech options for title of algorithms and typo. +% * add portuguese translation of predefined keywords * add czech translation of some +% predefined keywords +% +% - December 23 2002 - revision 2.40 +% * add some French keyword missing +% * add function* and procedure* environment like algorithme* environment: print in one column +% even if twocolumn option is specified for the document. +% * add a new macro \SetKwComment to define macro which writes comments in the text. First +% argument is the name of the macro, second is the text put before the comment, third is the +% text put at the end of the comment.Default are \tcc and \tcp +% * add new options to change the way algo are numbered: +% [algopart] algo are numbered within part (counter must exist) +% [algochapter] algo are numbered within chapter +% [algosection] algo are numbered within section +% +% - March 27 2002 - revision 2.39 +% * Gilles Geeraerts: added the \SetKwIfElseIf to manage +% if (c) +% i; +% else if (c) +% i; +% ... +% else +% i; +% end +% * Also added \gIf \gElseIf \gElse. +% +% - January 02 2001 - revision 2.38 +% * bugs related to the caption in procedure and function +% environment are corrected. +% * bug related to option noend (extra vertical space added +% after block command as If or For) is corrected. +% * czech option language added (thanks to Libor Bus: l.bus@sh.cvut.cz). +% +% - October 16 2000 - revision 2.37 +% * option algo2e added: change the name of environment +% algorithm into algorithm2e. So allow to use the package +% with some journal style which already define an algorithm +% environment. +% +% - September 13 2000 - revision 2.36 +% * option slide added: require package color +% * Hack for slide class in order to have correct +% margins +% +% - November 25 1999 - revision 2.35 +% * revision number match RCS number +% * Thanks to David A. Bader, a new option is added: +% noend: no end keywords are printed. +% +% - November 19 1999 - revision 2.32 +% * minor bug on longend option corrected. +% +% - August 26 1999 - revision 2.31 +% * add an option: figure +% this option makes algorithms be figure and so are numbered +% as figures, have Figure as caption and are put in +% the \listoffigures +% +% - January 21 1999 - revision 2.3 beta +% add 2 new environments: procedure and function. +% These environments works like algorithm environment but: +% - the ruled (or algoruled) style is imperative. +% - the caption now writes Procedure name.... +% - the syntax of the \caption command is restricted as +% follow: you MUST put a name followed by 2 braces like +% this ``()''. You can put arguments inside the braces and +% text after. If no argument is given, the braces will be +% removed in the title. +% - label now puts the name (the text before the braces in the +% caption) of the procedure or function as reference (not +% the number like a classic algorithm environment). +% There are also two new styles: ProcNameSty and +% ProcArgSty. These style are by default the same as FuncSty +% and ArgSty but are used in the caption of a procedure or a +% function. +% +% - November 28 1996 - revision 2.22 +% add a new macro \SetKwInParam{arg1}{arg2}{arg3}: +% it defines a macro \arg1{name}{arg} which prints name in keyword +% style followed byt arg surrounded by arg2 and arg3. The main +% application is to a function working as \SetKwInput to be used +% in the head of the algorithm. For example +% \SetKwInParam{Func}{(}{)} allows +% \Func{functionname}{list of arguments} which prints: +% \KwSty{functioname(}list of arguments\KwSty{)} +% +% +% - November 27 1996 - revision 2.21: +% minor bug in length of InOut boxes fixed. +% add algorithm* environment. +% +% - July 12 1996 - revision 2.2: \SetArg and \SetKwArg macros removed. +% +% \SetArg has been removed since it never has been +% documented. +% \SetKwArg has been removed since \SetKw can now +% take an argument in order to be consistent with +% \SetKwData and \SetKwFunction macros. +% +% - July 04 1996 - revision 2.1: still more LaTeX2e! Minor compatibility break +% +% Macros use now \newcommand instead of \def, use of \setlength, +% \newsavebox, ... and other LaTeX2e specific stuff. +% The compatibility break: +% - \SetData becomes \SetKwData to be more consistent. So the old +% \SetKwData becomes \SetKwInput +% - old macros \titleofalgo, \Freetitleofalgo and \freetitleofalgo +% from LaTeX209 version which did print a warning message and call +% \Titleofalgo in version 2.0 are now removed! +% +% - March 13 1996 - revision 2.0: first official major revision. +% +% +%%%%%%%%%%%%%% +% +% Known bugs: +% ----------- +% - horizontal spacing (indent) doesn't work with revtex4 class. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% for more complete informations you can see algorithm2e.tex +% +% +%%%%%%%%%%%%%%%%%%%%%%%% Identification Part %%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +% +\ProvidesPackage{algorithm2e}[2013/01/06 v5.00 algorithms environments] +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%% Initial Code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\@makeother\*% some package redefined it as a letter (as color.sty) +\def\@firstword#1 #2\@nil{#1}% an useful fonction +%%%%%%% Utilities: +% \ifArgumentEmpty ; if c is empty, i.e. {}, then t, else e. +% Function used internally, but may as well expose it to the user; it's useful +\begingroup +\catcode`\Q=3 +\catcode`\T=3 +\long\gdef\ALGOCF@argemptyaux#1#2Q#3#4#5T{#4} +\long\gdef\ifArgumentEmpty#1{% + \begingroup\long\edef\@tempa{\endgroup + \ALGOCF@argemptyaux#1QQ{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}T% + }\@tempa +} +\endgroup +% \long\def\ifArgumentEmpty#1{\bgroup +% \catcode`\Q=3 +% \catcode`\T=3 +% \long\def\@tempa##1##2Q##3##4##5T{##4}% +% \xdef\@tempa{\@tempa#1QQ{\noexpand\@secondoftwo}{\noexpand\@firstoftwo}T}% +% \egroup\@tempa} +%%%%%%%%%%% +% +% \algocf@longdef -> shorthand to reduce +% \expandafter\long\expandafter\def +% to +% \expandafter\algocf@longdef +% may look insignificant, but reads that much better ;) +\def\algocf@longdef{\long\def} +% +% \algocf@newcommand (and helper \algocf@new@command) behaves like LaTeX's newcommand, +% with two differences: +% - the argument is not "\", but rather ""; i.e. one level of indirection +% - if the command exists already, then \renewcommand, rather than \newcommand +\def\algocf@newcommand#1{\expandafter\algocf@new@command\csname#1\endcsname} +\def\algocf@new@command#1{% + \begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}\endgroup + \expandafter\@ifundefined\@gtempa\newcommand\renewcommand#1}% +% +% \algocf@newcmdside +% The largest time-saver; many commands we define have the pattern: +% \()... +% where "()" is optional. By defining them with this function, +% the arguments are parsed and renumbered, i.e. the body works as if the +% command was: +% \... +% and can use \ifArgumentEmpty to see whether its #1 exists (default case +% for the side text is (), so there's no difference between calling +% \foo{bar} +% or +% \foo(){bar} +% Technically this is new behaviour, but it shouldn't really occur... +\algocf@longdef\algocf@newcmdside#1#2#3{% + \expandafter\def\csname#1\endcsname{% + \@ifnextchar({\csname algocf@#1strip\endcsname}{\csname algocf@#1strip\endcsname()}% + }% + \expandafter\algocf@longdef\csname algocf@#1strip\endcsname(##1){\csname algocf@#1main\endcsname{##1}}% + \algocf@newcommand{algocf@#1main}[#2]{#3}% +} +% +% a serie of newcmdside macro for block that allows a comment after the end +% \()...()% +% +% 1. kind of begin-end : for command with only one block as begin-end +\algocf@longdef\algocf@newcmdside@kobe#1#2{% + % command starts by checking for side comment at beginning + \expandafter\def\csname#1\endcsname{% + \@ifnextchar({\csname algocf@#1strip\endcsname}{\csname algocf@#1strip\endcsname()}% + }% + % next we strip comment and include it in cmd that get body and check last side comment + \expandafter\algocf@longdef\csname algocf@#1strip\endcsname(##1)##2{\csname algocf@#1checkcomfol\endcsname{##1}{##2}}% + % now check for last side comment; args are : , + \expandafter\algocf@longdef\csname algocf@#1checkcomfol\endcsname##1##2{\@ifnextchar({\csname algocf@#1withendcom\endcsname{##1}{##2}}{\csname algocf@#1noendcom\endcsname{##1}{##2}}}% call macro that manages end of command, with or without last side comment + % finally manage end of macro... with end side comment... + \expandafter\algocf@longdef\csname algocf@#1withendcom\endcsname##1##2(##3){% + \csname algocf@#1main\endcsname{##1}{##2}{##3}}% + % ... or without end side comment + \expandafter\algocf@longdef\csname algocf@#1noendcom\endcsname##1##2{% + \csname algocf@#1main\endcsname{##1}{##2}{}}% + \algocf@newcommand{algocf@#1main}[3]{#2}% +}% +% +% 2. kind of if-else : for command with two blocks as if-then-else +\algocf@longdef\algocf@newcmdside@koif#1#2{% + % command starts by checking for side comment at beginning + \expandafter\def\csname#1\endcsname{% + \@ifnextchar({\csname algocf@#1strip\endcsname}{\csname algocf@#1strip\endcsname()}% + }% + % next we strip comment and include it in cmd that get body and check last side comment + \expandafter\algocf@longdef\csname algocf@#1strip\endcsname(##1)##2##3{\csname algocf@#1checkcomfol\endcsname{##1}{##2}{##3}}% + % now check for last side comment; args are : <1st side com>, <1st body of cmd>, <2nd body of cmd> + \expandafter\algocf@longdef\csname algocf@#1checkcomfol\endcsname##1##2##3{\@ifnextchar({\csname algocf@#1withendcom\endcsname{##1}{##2}{##3}}{\csname algocf@#1noendcom\endcsname{##1}{##2}{##3}}}% call macro that manages end of command, with or without last side comment + % finally manage end of macro... with end side comment... + \expandafter\algocf@longdef\csname algocf@#1withendcom\endcsname##1##2##3(##4){% + \csname algocf@#1main\endcsname{##1}{##2}{##3}{##4}}% + % ... or without end side comment + \expandafter\algocf@longdef\csname algocf@#1noendcom\endcsname##1##2##3{% + \csname algocf@#1main\endcsname{##1}{##2}{##3}{}}% + \algocf@newcommand{algocf@#1main}[4]{#2}% +}% +% +% \algocf@newcmdsides +% Like the command above, but with an optional side text at the end +% of the command as well, i.e.: +% \()() +% It may be a bit confusing that doesn't count , +% but since it is for internal use, the naming can be a little more +% fuzzy. This function behaves as if: +% = +\algocf@longdef\algocf@newcmdsides#1#2#3#4#5{% + \expandafter\def\csname#1\endcsname{% + \@ifnextchar({\csname algocf@#1strip\endcsname}{\csname algocf@#1strip\endcsname()}% + }% + \expandafter\algocf@longdef\csname algocf@#1strip\endcsname(##1){\csname algocf@#1main\endcsname{##1}}% + \algocf@newcommand{algocf@#1main}[#2]{#3\@ifnextchar({\csname algocf@#1end\endcsname}{#4#5}}% + \expandafter\algocf@longdef\csname algocf@#1end\endcsname(##1){#4{##1}\strut\par}% +}% +% +% definition of commands which can be redefined in options of the package. +% +\newcounter{AlgoLine}% +\setcounter{AlgoLine}{0}% +% +\newcommand{\algocf@algocfref}{\relax}% +\newcommand{\listalgorithmcfname}{}% +\newcommand{\algorithmcfname}{}% +\@ifundefined{algorithmautorefname}{\newcommand{\algorithmautorefname}{algorithm}}{\renewcommand{\algorithmautorefname}{algorithm}}% +\newcommand{\algorithmcflinename}{}% +\newcommand{\algocf@typo}{}% +\newcommand{\@algocf@procname}{}\newcommand{\procedureautorefname}{}% +\newcommand{\SetAlgoProcName}[2]{\renewcommand{\@algocf@procname}{#1}\renewcommand{\procedureautorefname}{#2}}% +\newcommand{\@algocf@funcname}{}\newcommand{\functionautorefname}{}% +\newcommand{\SetAlgoFuncName}[2]{\renewcommand{\@algocf@funcname}{#1}\renewcommand{\functionautorefname}{#2}}% +\newcommand{\@algocf@titleofalgoname}{\algorithmcfname}% +\newcommand{\@algocf@algotitleofalgo}{% + \renewcommand{\@algocf@titleofalgoname}{\algorithmcfname}}% +\newcommand{\@algocf@proctitleofalgo}{% + \renewcommand{\@algocf@titleofalgoname}{\algocf@procname}}% +% +\newcommand{\algocf@style}{plain}% +\newcommand{\@ResetCounterIfNeeded}{}% +\newcommand{\@titleprefix}{}% +% +\newcommand{\algocf@numbering}[1]{\newcommand{\algocf@within}{#1}}% +% +\newcommand{\defaultsmacros@algo}{\algocf@defaults@shortend}% +% +\newcommand{\algocf@list}{loa}% +\newcommand{\algocf@float}{algocf}% +% +\newcommand{\algocf@envname}{algorithm}% +\newcommand{\algocf@listofalgorithms}{listofalgorithms}% +% +% +%% redefine chapter so that it adds a vspace in the loa as the original does for lof and lot +% \let\algocf@original@chapter=\chapter% +% \def\chapter{\expandafter\addtocontents{loa}{\protect\addvspace{10\p@}}\algocf@original@chapter}% +% +% bug correction with hyperref submitted by Hubert Meier +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname @chapter\endcsname\relax\else +% \let\algocf@original@chapter=\chapter% +% \def\chapter{\addtocontents{loa}{\protect\addvspace{10\p@}}\algocf@original@chapter}% +\let\algocf@original@chapter=\@chapter% +\@ifclassloaded{krantz}{% +\def\@chapter[#1][#2]#3{\algocf@original@chapter[#1][#2]{#3}\addtocontents{loa}{\protect\addvspace{10\p@}}}% +}{% +\def\@chapter[#1]#2{\algocf@original@chapter[#1]{#2}\addtocontents{loa}{\protect\addvspace{10\p@}}}% +}% +\fi +% +%% if@restonecol is defined in article and book but some other classes don't define it and we need it, so we do +\ifx\if@restonecol\relax\else\newif\if@restonecol\fi% +% +% +%%%%%%%%%%%%%%%%%%%%%% Declaration of Options %%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\RequirePackage{ifthen}% +% +\newboolean{algocf@displayblockmarkers}\setboolean{algocf@displayblockmarkers}{false}% +\DeclareOption{displayblockmarkers}{% + \setboolean{algocf@displayblockmarkers}{true}% +} +\newboolean{algocf@displaygroupmarkers}{\setboolean{algocf@displaygroupmarkers}{false} +\DeclareOption{displaygroupmarkers}{% + \setboolean{algocf@displaygroupmarkers}{true}% +} +% +\newboolean{algocf@nokwfunc}\setboolean{algocf@nokwfunc}{false}% +\DeclareOption{nokwfunc}{% + \setboolean{algocf@nokwfunc}{true}% +}% +% +\newboolean{algocf@oldcommands}\setboolean{algocf@oldcommands}{false}% +\DeclareOption{oldcommands}{% + \setboolean{algocf@oldcommands}{true}% +}% +% +\newboolean{algocf@leftlinenumber}\setboolean{algocf@leftlinenumber}{true}% +\newcommand{\setLeftLinesNumbers}{\setboolean{algocf@leftlinenumber}{true}}% +\newcommand{\setRightLinesNumbers}{\setboolean{algocf@leftlinenumber}{false}}% +\DeclareOption{rightnl}{% + \setRightLinesNumbers% +}% +% +\newboolean{algocf@endfloat}\setboolean{algocf@endfloat}{false}% +\DeclareOption{endfloat}{% + \setboolean{algocf@endfloat}{true}% + \newcounter{postalgo}\setcounter{postalgo}{0}% +}% +% +\newboolean{algocf@procnumbered}\setboolean{algocf@procnumbered}{false}% +\DeclareOption{procnumbered}{% + \setboolean{algocf@procnumbered}{true}% +}% +% +\DeclareOption{algo2e}{% + \renewcommand{\algocf@envname}{algorithm2e}% + \renewcommand{\algocf@listofalgorithms}{listofalgorithmes}% +}% +% +\newboolean{algocf@slide}\setboolean{algocf@slide}{false}% +\DeclareOption{slide}{% + \setboolean{algocf@slide}{true}% +}% +% +\newboolean{algocf@figurecaption}\setboolean{algocf@figurecaption}{false}% +\DeclareOption{figure}{% +\renewcommand{\algocf@list}{lof}% +\renewcommand{\algocf@float}{figure}% +\AtBeginDocument{\@ifpackageloaded{caption}{\setboolean{algocf@figurecaption}{true}}{}}% +}% +% +\newboolean{algocf@optonelanguage}\setboolean{algocf@optonelanguage}{false}% +\DeclareOption{onelanguage}{\setboolean{algocf@optonelanguage}{true}}% +% +\newcommand{\algocf@languagechoosen}{english}% +\newboolean{algocf@localkw@english}\setboolean{algocf@localkw@english}{true}% +\DeclareOption{englishkw}{% +\setboolean{algocf@localkw@english}{true}% +}% +% +\DeclareOption{english}{% +\renewcommand{\listalgorithmcfname}{List of Algorithms}% +\renewcommand{\algorithmcfname}{Algorithm}% +\renewcommand{\algorithmautorefname}{algorithm}% +\renewcommand{\algorithmcflinename}{line}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Procedure}% +\renewcommand{\@algocf@funcname}{Function}% +\renewcommand{\procedureautorefname}{procedure}% +\renewcommand{\functionautorefname}{function}% +\renewcommand{\algocf@languagechoosen}{english}% +}% +% +%---- +\newboolean{algocf@localkw@french}\setboolean{algocf@localkw@french}{false}% +\DeclareOption{frenchkw}{% +\setboolean{algocf@localkw@french}{true}% +}% +% +\DeclareOption{french}{% +\renewcommand{\listalgorithmcfname}{Liste des Algorithmes}% +\renewcommand{\algorithmcfname}{Algorithme}% +\renewcommand{\algorithmautorefname}{algorithme}% +\renewcommand{\algorithmcflinename}{ligne}% +\renewcommand{\algocf@typo}{\ }% +\renewcommand{\@algocf@procname}{Proc\'edure}% +\renewcommand{\@algocf@funcname}{Fonction}% +\renewcommand{\procedureautorefname}{proc\'edure}% +\renewcommand{\functionautorefname}{fonction}% +\renewcommand{\algocf@languagechoosen}{french}% +}% +% +%---- +\newboolean{algocf@localkw@czech}\setboolean{algocf@localkw@czech}{false}% +\DeclareOption{czechkw}{% +\setboolean{algocf@localkw@czech}{true}% +}% +% +\DeclareOption{czech}{% +\renewcommand{\listalgorithmcfname}{Seznam algoritm\r{u}}% +\renewcommand{\algorithmcfname}{Algoritmus}% +\renewcommand{\algorithmautorefname}{\algorithmcfname}% +\renewcommand{\algorithmcflinename}{Radek}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Procedura}% +\renewcommand{\@algocf@funcname}{Funkce}% +\renewcommand{\procedureautorefname}{\@algocf@procname}% +\renewcommand{\functionautorefname}{\@algocf@funcname}% +\renewcommand{\algocf@languagechoosen}{czech}% +}% +% +%---- +\newboolean{algocf@localkw@german}\setboolean{algocf@localkw@german}{false}% +\DeclareOption{germankw}{% +\setboolean{algocf@localkw@german}{true}% +}% +% +\DeclareOption{german}{% +\renewcommand{\listalgorithmcfname}{Liste der Algorithmen}% +\renewcommand{\algorithmcfname}{Algorithmus}% +\renewcommand{\algorithmautorefname}{\algorithmcfname}% +\renewcommand{\algorithmcflinename}{Zeile}% +\renewcommand{\algocf@typo}{\ }% +\renewcommand{\@algocf@procname}{Prozedur}% +\renewcommand{\@algocf@funcname}{Funktion}% +\renewcommand{\procedureautorefname}{\@algocf@procname}% +\renewcommand{\functionautorefname}{\@algocf@funcname}% +\renewcommand{\algocf@languagechoosen}{german}% +}% +% +%---- +\DeclareOption{ngermankw}{% +\setboolean{algocf@localkw@german}{true}% +}% +% +\DeclareOption{ngerman}{% +\renewcommand{\listalgorithmcfname}{Liste der Algorithmen}% +\renewcommand{\algorithmcfname}{Algorithmus}% +\renewcommand{\algorithmautorefname}{\algorithmcfname}% +\renewcommand{\algorithmcflinename}{Zeile}% +\renewcommand{\algocf@typo}{\ }% +\renewcommand{\@algocf@procname}{Prozedur}% +\renewcommand{\@algocf@funcname}{Funktion}% +\renewcommand{\procedureautorefname}{\@algocf@procname}% +\renewcommand{\functionautorefname}{\@algocf@funcname}% +\renewcommand{\algocf@languagechoosen}{german}% +}% +% +%---- +\newboolean{algocf@localkw@portuguese}\setboolean{algocf@localkw@portuguese}{false}% +\DeclareOption{portuguesekw}{% +\setboolean{algocf@localkw@portuguese}{true}% +}% +% +\DeclareOption{portuguese}{% +\renewcommand{\listalgorithmcfname}{Lista de Algoritmos}% +\renewcommand{\algorithmcfname}{Algoritmo}% +\renewcommand{\algorithmautorefname}{algoritmo}% +\renewcommand{\algorithmcflinename}{linha}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Procedimento}% +\renewcommand{\@algocf@funcname}{Fun\c{c}\~{a}o}% +\renewcommand{\procedureautorefname}{procedimento}% +\renewcommand{\functionautorefname}{fun\c{c}\~{a}o}% +\renewcommand{\algocf@languagechoosen}{portuguese}% +}% +% +%---- +\newboolean{algocf@localkw@italiano}\setboolean{algocf@localkw@italiano}{false}% +\DeclareOption{italianokw}{% +\setboolean{algocf@localkw@italiano}{true}% +}% +% +\DeclareOption{italiano}{% +\renewcommand{\listalgorithmcfname}{Elenco degli algoritmi}% +\renewcommand{\algorithmcfname}{Algoritmo}% +\renewcommand{\algorithmautorefname}{algoritmo}% +\renewcommand{\algorithmcflinename}{riga}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Procedura}% +\renewcommand{\@algocf@funcname}{Funzione}% +\renewcommand{\procedureautorefname}{procedura}% +\renewcommand{\functionautorefname}{funzione}% +\renewcommand{\algocf@languagechoosen}{italiano}% +}% +%---- +\newboolean{algocf@localkw@spanish}\setboolean{algocf@localkw@spanish}{false}% +\DeclareOption{spanishkw}{% +\setboolean{algocf@localkw@spanish}{true}% +}% +% +\DeclareOption{spanish}{% +\renewcommand{\listalgorithmcfname}{\'Indice de algoritmos}% +\renewcommand{\algorithmcfname}{Algoritmo}% +\renewcommand{\algorithmautorefname}{algoritmo}% +\renewcommand{\algorithmcflinename}{l\'inea}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Procedimiento}% +\renewcommand{\@algocf@funcname}{Funci\'on}% +\renewcommand{\procedureautorefname}{procedimiento}% +\renewcommand{\functionautorefname}{funci\'on}% +\renewcommand{\algocf@languagechoosen}{spanish}% +}% +%---- +\newboolean{algocf@localkw@slovak}\setboolean{algocf@localkw@slovak}{false}% +\DeclareOption{slovakkw}{% +\setboolean{algocf@localkw@slovak}{true}% +}% +% +\DeclareOption{slovak}{% +\renewcommand{\listalgorithmcfname}{Zoznam algoritmov}% +\renewcommand{\algorithmcfname}{Algoritmus}% +\renewcommand{\algorithmautorefname}{\algorithmcfname}% +\renewcommand{\algorithmcflinename}{Radek}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Proced\'{u}ra}% +\renewcommand{\@algocf@funcname}{Funkcia}% +\renewcommand{\procedureautorefname}{\@algocf@procname}% +\renewcommand{\functionautorefname}{\@algocf@funcname}% +\renewcommand{\algocf@languagechoosen}{slovak}% +}% +% +%---- +\newboolean{algocf@localkw@croatian}\setboolean{algocf@localkw@croatian}{false}% +\DeclareOption{croatiankw}{% +\setboolean{algocf@localkw@croatian}{true}% +}% +% +\DeclareOption{croatian}{% +\renewcommand{\listalgorithmcfname}{Popis algoritama}% +\renewcommand{\algorithmcfname}{Algoritam}% +\renewcommand{\algorithmautorefname}{\algorithmcfname}% +\renewcommand{\algorithmcflinename}{redak}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Procedura}% +\renewcommand{\@algocf@funcname}{Funkcija}% +\renewcommand{\procedureautorefname}{\@algocf@procname}% +\renewcommand{\functionautorefname}{\@algocf@funcname}% +\renewcommand{\algocf@languagechoosen}{croatian}% +}% +%%% adding 'turkish' option customization +% +%---- +\newboolean{algocf@localkw@turkish}\setboolean{algocf@localkw@turkish}{false}% +\DeclareOption{turkishkw}{% +\setboolean{algocf@localkw@turkish}{true}% +}% +\DeclareOption{turkish}{% +\renewcommand{\listalgorithmcfname}{Algoritma Listesi}% +\renewcommand{\algorithmcfname}{Algoritma}% +\renewcommand{\algorithmautorefname}{algoritma}% +\renewcommand{\algorithmcflinename}{çizgi}% +\renewcommand{\algocf@typo}{}% +\renewcommand{\@algocf@procname}{Prosedür}% +\renewcommand{\@algocf@funcname}{Fonksiyon}% +\renewcommand{\procedureautorefname}{prosedür}% +\renewcommand{\functionautorefname}{fonksiyon}% +\renewcommand{\algocf@languagechoosen}{turkish}% +}% +% +% OPTIONs plain, boxed, ruled, algoruled & boxruled +% +\newcommand{\algocf@style@plain}{\renewcommand{\algocf@style}{plain}}% +\newcommand{\algocf@style@boxed}{\renewcommand{\algocf@style}{boxed}}% +\newcommand{\algocf@style@ruled}{\renewcommand{\algocf@style}{ruled}}% +\newcommand{\algocf@style@algoruled}{\renewcommand{\algocf@style}{algoruled}}% +\newcommand{\algocf@style@boxruled}{\renewcommand{\algocf@style}{boxruled}}% +\newcommand{\algocf@style@tworuled}{\renewcommand{\algocf@style}{tworuled}}% +\newcommand{\algocf@style@plainruled}{\renewcommand{\algocf@style}{plainruled}}% +\newcommand{\RestyleAlgo}[1]{\csname algocf@style@#1\endcsname}% +\DeclareOption{plain}{\algocf@style@plain}% +\DeclareOption{plainruled}{\algocf@style@plainruled}% +\DeclareOption{boxed}{\algocf@style@boxed}% +\DeclareOption{ruled}{\algocf@style@ruled}% +\DeclareOption{algoruled}{\algocf@style@algoruled}% +\DeclareOption{boxruled}{\algocf@style@boxruled}% +\DeclareOption{tworuled}{\algocf@style@tworuled}% +% +% OPTIONs algopart,algochapter & algosection +% +\DeclareOption{algopart}{\algocf@numbering{part}}% %algo part numbered +\DeclareOption{algochapter}{\algocf@numbering{chapter}}% %algo chapter numbered +\DeclareOption{algosection}{\algocf@numbering{section}}% %algo section numbered +% +% OPTIONs resetcount & noresetcount +% +\DeclareOption{resetcount}{\renewcommand{\@ResetCounterIfNeeded}{\setcounter{AlgoLine}{0}}}% +\DeclareOption{noresetcount}{\renewcommand{\@ResetCounterIfNeeded}{}}% +% +% OPTIONs algorithm hanging for long lines +% +\newlength{\algocf@hangindent}\setlength{\algocf@hangindent}{.5em} +\newcommand{\SetAlgoHangIndent}[1]{\setlength{\algocf@hangindent}{#1}} +% +\newboolean{algocf@hanging}\setboolean{algocf@hanging}{true}% hanging is handle by default +\newboolean{algocf@hanginginout}\setboolean{algocf@hanginginout}{false}% inout are managed as previously: hanging set by inout keywords +\newboolean{algocf@hangingcomment}\setboolean{algocf@hangingcomment}{false}% comment that are not side comment are indented accordingly to comment mark, not as normal text +\newcommand{\algocf@everyparnl}{\relax}% +\newcommand{\algocf@everyparhanging}{\hangafter=1\hangindent=\algocf@hangindent\relax}% +\newcommand{\algocf@everypar}{\algocf@everyparnl\algocf@everyparhanging}% +\newcommand{\algocf@seteverypar}{% + \ifthenelse{\boolean{algocf@hanging}}{\everypar{\algocf@everypar}}{\relax}% +}% +% +\newcommand{\algocf@seteveryparnl}[1]{\renewcommand{\algocf@everyparnl}{#1}\everypar{\algocf@everypar}}% +\newcommand{\algocf@seteveryparhanging}[1]{% +\let\algocf@oldeveryparhanging=\algocf@everyparhanging% +\renewcommand{\algocf@everyparhanging}{#1}\everypar{\algocf@everypar}% +}% +\newcommand{\algocf@reseteveryparhanging}{% +\let\algocf@everyparhanging=\algocf@oldeveryparhanging% +\everypar{\algocf@everypar}% +}% +\DeclareOption{hanginginout}{\setboolean{algocf@hanginginout}{true}}% +\DeclareOption{hangingcomment}{\setboolean{algocf@hangingcomment}{true}}% +\DeclareOption{noalgohanging}{% + \setboolean{algocf@hanginginout}{false}% + \setboolean{algocf@hangingcomment}{false}% + \setboolean{algocf@hanging}{false}% +}% +%\newcommand{ +% +% +% OPTION linesnumbered +% +\newboolean{algocf@linesnumbered}\setboolean{algocf@linesnumbered}{false}% +\newcommand{\algocf@linesnumbered}{\relax}% +\DeclareOption{linesnumbered}{% + \setboolean{algocf@linesnumbered}{true}% + \renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\nl}}% +}% +% +% OPTION linesnumberedhidden +% +\DeclareOption{linesnumberedhidden}{% + \setboolean{algocf@linesnumbered}{true}% + \renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\stepcounter{AlgoLine}}}% +}% +% +% OPTION commentsnumbered inoutnumbered +% +\newboolean{algocf@commentsnumbered}\setboolean{algocf@commentsnumbered}{false}% +\DeclareOption{commentsnumbered}{\setboolean{algocf@commentsnumbered}{true}}% +\newboolean{algocf@inoutnumbered}\setboolean{algocf@inoutnumbered}{false}% +\DeclareOption{inoutnumbered}{\setboolean{algocf@inoutnumbered}{true}}% +% +% OPTIONs titlenumbered & titlenotnumbered +% +\DeclareOption{titlenumbered}{% + \renewcommand{\@titleprefix}{% + \refstepcounter{\algocf@float}% + \AlTitleSty{\AlTitleFnt\@algocf@titleofalgoname\ \expandafter\csname the\algocf@float\endcsname\algocf@typo: }% + }% +}% +% +\DeclareOption{titlenotnumbered}{\renewcommand{\@titleprefix}{% + \AlTitleSty{\AlTitleFnt\@algocf@titleofalgoname\algocf@typo: }}% +}% +% +% OPTIONs algonl +% line numbered with the counter of the algorithm +% +\DeclareOption{algonl}{\renewcommand{\theAlgoLine}{\expandafter\csname the\algocf@float\endcsname.\arabic{AlgoLine}}}% +% +% OPTIONs lined, vlined & noline +% +\DeclareOption{lined}{\AtBeginDocument{\SetAlgoLined}}% \SetAlgoLined (default) +\DeclareOption{vlined}{\AtBeginDocument{\SetAlgoVlined}}% \SetAlgoVlined +\DeclareOption{noline}{\AtBeginDocument{\SetAlgoNoLine}}%\SetAlgoNoLine +% +% OPTIONs longend, shotend & noend +% +\DeclareOption{longend}{\AtBeginDocument{\SetAlgoLongEnd}}% \SetAlgoLongEnd +\DeclareOption{shortend}{\AtBeginDocument{\SetAlgoShortEnd}}%\SetAlgoShortEnd +\DeclareOption{noend}{\AtBeginDocument{\SetAlgoNoEnd}}% \SetAlgoNoEnd +% +\DeclareOption{nosemicolon}{\AtBeginDocument{\DontPrintSemicolon}}% \SetAlgoNoEnd +% +% OPTION dotoc +% +\newboolean{algocf@dotocloa}\setboolean{algocf@dotocloa}{false}% +\DeclareOption{dotocloa}{% + \setboolean{algocf@dotocloa}{true}% +} +% +% OPTION comments +% +\newboolean{algocf@optfillcomment}\setboolean{algocf@optfillcomment}{true}% +\DeclareOption{nofillcomment}{% + \setboolean{algocf@optfillcomment}{false}% +}% +\DeclareOption{fillcomment}{% + \setboolean{algocf@optfillcomment}{true}% +}% +% +% OPTION sidecommments +% +\newboolean{algocf@scleft}\setboolean{algocf@scleft}{false}% +\DeclareOption{scleft}{% + \setboolean{algocf@scleft}{true}% +}% +\DeclareOption{sright}{% default + \setboolean{algocf@scleft}{false}% +}% +% +% OPTION norelsize +% +\newboolean{algocf@norelsize}\setboolean{algocf@norelsize}{false}% +\DeclareOption{norelsize}{% + \setboolean{algocf@norelsize}{true}% +}% +% +% +%%%%%%%%%%%%%%%%%%%%%%% Execution of Options %%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\ExecuteOptions{english,plain,resetcount,titlenotnumbered,lined,shortend}% +% +\ProcessOptions% +% +\@algocf@algotitleofalgo% fix name for \TitleOfAlgo to \algorithmcfname by default +% +%%%%%%%%%%%%%%%%%%%%%%%%%% Package Loading %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +\RequirePackage{xspace}% +% +\ifthenelse{\boolean{algocf@endfloat}}{% + \RequirePackage{endfloat}% +}{\relax}% +% +\ifthenelse{\boolean{algocf@norelsize}}{% + \newcommand{\relsize}[1]{\scriptsize}% +}{% + \RequirePackage{relsize}% +}% +% +\ifthenelse{\boolean{algocf@slide}}{\RequirePackage{color}}{}% +% +% +\AtEndOfPackage{% + \ifthenelse{\boolean{algocf@dotocloa}}{% + \renewcommand{\listofalgorithms}{\tocfile{\listalgorithmcfname}{loa}}% + }{\relax}% +}% +% +% if loa in toc required, load tocbibind package if not already done. +\ifthenelse{\boolean{algocf@dotocloa}}{% + \ifx\@tocextra\undefined% + \RequirePackage{tocbibind}% + \fi% +}{\relax}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Main Part %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\newcommand{\algocf@name}{algorithm2e}% +\newcommand{\algocf@date}{october 19 2015}% +\newcommand{\algocf@version}{Release 5.1}% +\newcommand{\algocf@id}{\algocf@version\space -- \algocf@date\space --}% +\typeout{********************************************************^^JPackage `\algocf@name'\space\algocf@id^^J% + - algorithm2e-announce@lirmm.fr mailing list for announcement about releases^^J% + - algorithm2e-discussion@lirmm.fr mailing list for discussion about package^^J% + subscribe by emailing sympa@lirmm.fr with 'subscribe '^^J% + - Author: Christophe Fiorio (christophe.fiorio@umontpellier.fr)^^J********************************************************}% +%% +%% +%% +%% +%% +%% +%%%% hyperref compatibility tricks: Hyperref package defines H counters from + % standard counters (i.e \theHpage from \thepage) and check some particular + % counters of some packages, unfortunately it doesn't do the same for + % algorithm2e package but act as Hcounter was defined. To avoid errors we + % defined \theHalgocf ourself +%%%% +% +\@ifundefined{theHalgocf}{\def\theHalgocf{\thealgocf}}{}% +\@ifundefined{theHAlgoLine}{\def\theHAlgoLine{\theAlgoLine}}{}% +\@ifundefined{theHalgocfproc}{\def\theHalgocfproc{0}}{}% +\@ifundefined{theHalgocffunc}{\def\theHalgocffunc{0}}{}% +\@ifundefined{toclevel@algocf}{\def\toclevel@algocf{0}}{}% +% +% autoref from hyperref needs an autorefname, so we give it. +\def\AlgoLineautorefname{\algorithmcflinename}% +\def\algocfautorefname{\algorithmautorefname}% +\def\algocfprocautorefname{\procedureautorefname}% +\def\algocffuncautorefname{\functionautorefname}% +%% +%% +%% +\newcommand{\@defaultskiptotal}{0.5em}% +\newskip\skiptotal\skiptotal=0.5em% +\newskip\skiplinenumber\skiplinenumber=\hsize\advance\skiplinenumber by-\skiptotal% +\newskip\skiprule% +\newskip\skiphlne% +\newskip\skiptext% +\newskip\skiplength% +\newskip\algomargin% +\newskip\skipalgocfslide\skipalgocfslide=1em% +\newdimen\algowidth% +\newdimen\inoutsize% +\newdimen\inoutindent% +\newdimen\interspacetitleruled\setlength{\interspacetitleruled}{2pt}% +\newdimen\interspacealgoruled\setlength{\interspacealgoruled}{2pt}% +\newdimen\interspacetitleboxruled\setlength{\interspacetitleboxruled}{2\lineskip}% +% +\newcommand{\@algoskip}{\smallskip}% +\newcommand{\SetAlgoSkip}[1]{\renewcommand{\@algoskip}{\csname#1\endcsname}}% +\newcommand{\@algoinsideskip}{\relax}% +\newcommand{\SetAlgoInsideSkip}[1]{\renewcommand{\@algoinsideskip}{\csname#1\endcsname}}% +% +% ruledwidth +% +\newlength{\algocf@ruledwidth}\setlength{\algocf@ruledwidth}{\linewidth}% +\newboolean{algocf@customruledwidth}\setboolean{algocf@customruledwidth}{false}% +\newcommand{\SetCustomAlgoRuledWidth}[1]{% + \setboolean{algocf@customruledwidth}{true}% + \ifthenelse{\boolean{algocf@customruledwidth}}{\setlength{\algocf@ruledwidth}{#1}}{\relax}% +}% +% +\newsavebox{\algocf@inoutbox}% +\newsavebox{\algocf@inputbox}% +%% +%% +\newcommand{\arg@e}{}% +\newcommand{\arg@space}{\ }% +\newcommand{\BlankLine}{\vskip 1ex}% +%% +\newcommand{\vespace}{1ex}% +\newcommand{\SetInd}[2]{% +\skiprule=#1% +\skiptext=#2% +\skiplength=\skiptext\advance\skiplength by \skiprule\advance\skiplength by 0.4pt}% +\SetInd{0.5em}{1em} +\algomargin=\leftskip\advance\algomargin by \parindent% +\newcommand{\IncMargin}[1]{\advance\algomargin by #1}% +\newcommand{\DecMargin}[1]{\advance\algomargin by -#1}% +\newcommand{\SetNlSkip}[1]{% + \renewcommand{\@defaultskiptotal}{#1}% + \setlength{\skiptotal}{#1}}% +%% +\newskip\AlCapSkip\AlCapSkip=0ex% +\newskip\AlCapHSkip\AlCapSkip=0ex% +\newcommand{\SetAlCapSkip}[1]{\setlength{\AlCapSkip}{#1}}% +\newcommand{\SetAlCapHSkip}[1]{\setlength{\AlCapHSkip}{#1}}% +\SetAlCapHSkip{.5\algomargin}% +%% +%% +\newskip\algoskipindent +\newcommand{\algocf@adjustskipindent}{% + \algoskipindent=\skiprule% + \advance\algoskipindent by \skiptext\advance\algoskipindent by 0.4pt} +\algocf@adjustskipindent% +% +\newcommand{\Indentp}[1]{\advance\leftskip by #1}% +\newcommand{\Indp}{\algocf@adjustskipindent\advance\leftskip by \algoskipindent} +\newcommand{\Indpp}{\advance\leftskip by 0.5em}% +\newcommand{\Indm}{\algocf@adjustskipindent\advance\leftskip by -\algoskipindent} +\newcommand{\Indmm}{\advance\leftskip by -0.5em}% +% +%% +%% +%% Line Numbering +%% +%% +% number line style +\newcommand{\algocf@nlrelsize}{-2}\newcommand{\SetAlgoNlRelativeSize}[1]{\renewcommand{\algocf@nlrelsize}{#1}}% +\newcommand{\NlSty}[1]{\textnormal{\textbf{\relsize{\algocf@nlrelsize}#1}}}% default definition +\newcommand{\SetNlSty}[3]{\renewcommand{\NlSty}[1]{\textnormal{\csname#1\endcsname{\relsize{\algocf@nlrelsize}#2##1#3}}}}% +% +% nl definitions +% +\newsavebox{\algocf@nlbox}% +\newcommand{\algocf@printnl}[1]{% + \ifthenelse{\boolean{algocf@leftlinenumber}}{% + \skiplinenumber=\skiptotal\advance\skiplinenumber by\leftskip% + \strut\raisebox{0pt}{\llap{\NlSty{#1}\kern\skiplinenumber}}\ignorespaces% + }{% + \sbox\algocf@nlbox{\NlSty{#1}}% + \skiplinenumber=\hsize\advance\skiplinenumber by-\leftskip\advance\skiplinenumber by-\skiptext% + \advance\skiplinenumber by\algomargin\advance\skiplinenumber by.3em\advance\skiplinenumber by-\wd\algocf@nlbox% + % to handle particular case of until: printnl is after 'until' keyword has been writen, so we need to substract length of this keyword + \advance\skiplinenumber by-\algocf@skipuntil% + \strut\raisebox{0pt}{\rlap{\kern\skiplinenumber\NlSty{#1\ignorespaces}}}\ignorespaces% + }% +}% +\newcommand{\algocf@nl@sethref}[1]{% + \renewcommand{\theHAlgoLine}{\thealgocfproc.#1}% + \hyper@refstepcounter{AlgoLine}\gdef\@currentlabel{#1}% +}% +\newcommand{\nl}{% + \@ifundefined{hyper@refstepcounter}{% if not hyperref then do a simple refstepcounter + \refstepcounter{AlgoLine}\gdef\@currentlabel{\theAlgoLine}% + }{% else if hyperref, do the anchor so 2 lines in two differents algorithms cannot have the same href + \stepcounter{AlgoLine}\algocf@nl@sethref{\theAlgoLine}% + }% now we can do the line numbering + \algocf@printnl{\theAlgoLine}% +}% +% +\newcommand{\nllabel}[1]{\label{#1}}% +% +\newcommand{\enl}{% + \@ifundefined{hyper@refstepcounter}{% if not hyperref then do a simple refstepcounter + \refstepcounter{AlgoLine}\gdef\@currentlabel{\theAlgoLine}% + }{% else if hyperref, do the anchor so 2 lines in two differents algorithms cannot have the same href + \stepcounter{AlgoLine}\algocf@nl@sethref{\theAlgoLine}% + }% now we can do the line numbering + \skiplinenumber=\hsize\advance\skiplinenumber by-\leftskip% + \strut\raisebox{0pt}{\rlap{\kern\skiplinenumber\strut\NlSty{\theAlgoLine}}}\ignorespaces% +}% +%% nlset +\newcommand{\nlset}[1]{% + \@ifundefined{hyper@refstepcounter}{\protected@edef\@currentlabel{#1}}{\algocf@nl@sethref{#1}}\algocf@printnl{#1}% +}% +% +%% lnl definitions +\newcommand{\lnl}[1]{\nl\label{#1}\ignorespaces}% +% +%% lnlset +\newcommand{\lnlset}[2]{\nlset{#2}\label{#1}}% +% +% set char put at end of each line +% +\newcommand{\algocf@endline}{\string;} +\newcommand{\SetEndCharOfAlgoLine}[1]{\renewcommand{\algocf@endline}{#1}} +% +% end of line definition +% +\newcommand{\@endalgocfline}{\algocf@endline}% default definition: printsemicolon +\newcommand{\DontPrintSemicolon}{\renewcommand{\@endalgocfline}{\relax}}% +\newcommand{\PrintSemicolon}{\renewcommand{\@endalgocfline}{\algocf@endline}}% +\newcommand{\@endalgoln}{\@endalgocfline\hfill\strut\par}% +% +% line numbering +% +\newcommand{\LinesNumbered}{\setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\nl}}}% +\newcommand{\LinesNotNumbered}{% + \setboolean{algocf@linesnumbered}{false}% + \renewcommand{\algocf@linesnumbered}{\relax}% +}% +% +\newcommand{\LinesNumberedHidden}{% + \setboolean{algocf@linesnumbered}{true}\renewcommand{\algocf@linesnumbered}{\algocf@seteveryparnl{\stepcounter{AlgoLine}}}}% +\newcommand{\ShowLn}{\nlset{\theAlgoLine}\ignorespaces}% display the line number on this line (without labelling) +\newcommand{\ShowLnLabel}[1]{\lnlset{#1}{\theAlgoLine}\ignorespaces}% display the line number and label this line +% +%% +% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Styling text commands +% +\newcommand{\AlFnt}{\relax}% default definition +\newcommand{\SetAlFnt}[1]{\renewcommand{\AlFnt}{#1}}% +\newcommand{\AlTitleFnt}{\relax}% default definition +\newcommand{\SetAlTitleFnt}[1]{\renewcommand{\AlTitleFnt}{#1}}% +% +\newcommand{\AlCapFnt}{\relax}% default definition +\newcommand{\SetAlCapFnt}[1]{\renewcommand{\AlCapFnt}{#1}}% +\newcommand{\AlCapNameFnt}{\relax}% default definition +\newcommand{\SetAlCapNameFnt}[1]{\renewcommand{\AlCapNameFnt}{#1}}% +% +\newcommand{\ProcFnt}{\relax}% default definition +\newcommand{\SetProcFnt}[1]{\renewcommand{\ProcFnt}{#1}}% +\newcommand{\ProcNameFnt}{\relax}% default definition +\newcommand{\SetProcNameFnt}[1]{\renewcommand{\ProcNameFnt}{#1}}% +\newcommand{\ProcArgFnt}{\relax}% default definition +\newcommand{\SetProcArgFnt}[1]{\renewcommand{\ProcArgFnt}{#1}}% +% +\newcommand{\AlTitleSty}[1]{\textbf{#1}\unskip}% default definition +\newcommand{\SetAlTitleSty}[1]{\renewcommand{\AlTitleSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\AlCapSty}[1]{\textnormal{\textbf{#1}}\unskip}% default definition +\newcommand{\SetAlCapSty}[1]{\renewcommand{\AlCapSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\AlCapNameSty}[1]{\textnormal{#1}\unskip}% default definition +\newcommand{\SetAlCapNameSty}[1]{\renewcommand{\AlCapNameSty}[1]{\textnormal{\csname #1\endcsname{##1}}\unskip}}% +% +\newcommand{\ProcSty}[1]{\AlCapSty{#1}}% +\newcommand{\SetProcSty}[1]{\renewcommand{\ProcSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\ProcNameSty}[1]{\AlCapNameSty{#1}}% +\newcommand{\SetProcNameSty}[1]{\renewcommand{\ProcNameSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\ProcArgSty}[1]{\AlCapNameSty{#1}}% +\newcommand{\SetProcArgSty}[1]{\renewcommand{\ProcArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +% +\newcommand{\KwSty}[1]{\textnormal{\textbf{#1}}\unskip}% default definition +\newcommand{\SetKwSty}[1]{\renewcommand{\KwSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\ArgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetArgSty{emph} +\newcommand{\SetArgSty}[1]{\renewcommand{\ArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\FuncArgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetFuncArgSty{emph} +\newcommand{\SetFuncArgSty}[1]{\renewcommand{\FuncArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\FuncSty}[1]{\textnormal{\texttt{#1}}\unskip}%\SetFuncSty{texttt} +\newcommand{\SetFuncSty}[1]{\renewcommand{\FuncSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\ProgSty}[1]{\textnormal{\emph{#1}}\unskip}%\SetProgSty{emphg} +\newcommand{\SetProgSty}[1]{\renewcommand{\ArgSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\DataSty}[1]{\textnormal{\textsf{#1}}\unskip}%%\SetDataSty{textsf} +\newcommand{\SetDataSty}[1]{\renewcommand{\DataSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\CommentSty}[1]{\textnormal{\texttt{#1}}\unskip}%%\SetDataSty{texttt} +\newcommand{\SetCommentSty}[1]{\renewcommand{\CommentSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +\newcommand{\TitleSty}[1]{#1\unskip}%\SetTitleSty{}{} +\newcommand{\SetTitleSty}[2]{\renewcommand{\TitleSty}[1]{% +\csname#1\endcsname{\csname#2\endcsname##1}}\unskip}% +\newcommand{\BlockMarkersSty}[1]{\KwSty{#1}}% +\newcommand{\SetBlockMarkersSty}[1]{\renewcommand{\BlockMarkersSty}[1]{\textnormal{\csname#1\endcsname{##1}}\unskip}}% +% +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Block basic commands +% +\newcommand{\algocf@push}[1]{\advance\skiptotal by #1\moveright #1}% +\newcommand{\algocf@pop}[1]{\advance\skiptotal by -#1}% +\newcommand{\algocf@addskiptotal}{\advance\skiptotal by 0.4pt\advance\hsize by -0.4pt\advance\hsize by -\skiplength}% 0.4 pt=width of \vrule +\newcommand{\algocf@subskiptotal}{\advance\skiptotal by -0.4pt\advance\hsize by 0.4pt\advance\hsize by \skiplength}% 0.4 pt=width of \vrule +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% group of instructions definition +% +\skiphlne=.8ex% +\newcommand{\SetVlineSkip}[1]{\skiphlne=#1}% +\newcommand{\algocf@bblock}{\BlockMarkersSty{begin}}% +\newcommand{\algocf@eblock}{\BlockMarkersSty{end}}% +\newcommand{\AlgoDisplayBlockMarkers}{\setboolean{algocf@displayblockmarkers}{true}}% +\newcommand{\AlgoDontDisplayBlockMarkers}{\setboolean{algocf@displayblockmarkers}{false}}% +\newcommand{\AlgoDisplayGroupMarkers}{\setboolean{algocf@displaygroupmarkers}{true}}% +\newcommand{\AlgoDontDisplayGroupMarkers}{\setboolean{algocf@displaygroupmarkers}{false}}% +\newcommand{\algocf@bblockcode}{% + \ifthenelse{\boolean{algocf@displayblockmarkers}}{\algocf@bblock\par}{\relax}% +}% +\newcommand{\algocf@eblockcode}{% + \ifthenelse{\boolean{algocf@displayblockmarkers}}{\algocf@eblock\par}{\relax}% +}% +\newcommand{\algocf@bgroupcode}{% + \ifthenelse{\boolean{algocf@displaygroupmarkers}}{\algocf@bblock}{\relax}% +}% +\newcommand{\algocf@egroupcode}{% + \ifthenelse{\boolean{algocf@displaygroupmarkers}}{\algocf@eblock}{\relax}% +}% +\newcommand{\SetAlgoBlockMarkers}[2]{% + \ifArgumentEmpty{#1}{% + \renewcommand{\algocf@bblock}{\relax}% + }{% + \renewcommand{\algocf@bblock}{\BlockMarkersSty{#1}}% + }% begin marker set + \ifArgumentEmpty{#2}{% + \renewcommand{\algocf@eblock}{\relax}% + }{% + \renewcommand{\algocf@eblock}{\BlockMarkersSty{#2}}% + }% end marker set +} +% +%%%%%%%%% block with a vertical line end by a little horizontal line +\newcommand{\algocf@Vline}[1]{% no vskip in between boxes but a strut to separate them, + \strut\par\nointerlineskip% then interblock space stay the same whatever is inside it + \algocf@push{\skiprule}% move to the right before the vertical rule + \hbox{\vrule% + \vtop{\algocf@push{\skiptext}%move the right after the rule + \vtop{\algocf@addskiptotal #1}\Hlne}}\vskip\skiphlne% inside the block + \algocf@pop{\skiprule}%\algocf@subskiptotal% restore indentation + \nointerlineskip}% no vskip after +% +%%%%%%%%% block with a vertical line +\newcommand{\algocf@Vsline}[1]{% no vskip in between boxes but a strut to separate them, + \strut\par\nointerlineskip% then interblock space stay the same whatever is inside it + \algocf@bblockcode% + \algocf@push{\skiprule}% move to the right before the vertical rule + \hbox{\vrule% the vertical rule + \vtop{\algocf@push{\skiptext}%move the right after the rule + \vtop{\algocf@addskiptotal #1}}}% inside the block + \algocf@pop{\skiprule}% restore indentation + \algocf@eblockcode% +} +% +\newcommand{\algocf@Hlne}{\hrule height 0.4pt depth 0pt width .5em}% +% +%%%%%%%%% block without line +\newcommand{\algocf@Noline}[1]{% no vskip in between boxes but a strut to separate them, + \strut\par\nointerlineskip% then interblock space stay the same whatever is inside it + \algocf@bblockcode% + \algocf@push{\skiprule}% + \hbox{% + \vtop{\algocf@push{\skiptext}% + \vtop{\algocf@addskiptotal #1}}}% inside the block + \algocf@pop{\skiprule}% + \algocf@eblockcode% + % \nointerlineskip% no vskip after +}% +%%%%%%%%% +% +%% default=NoLine +% +\newcommand{\algocf@group}[1]{\algocf@Noline{#1}}% group: set of instruction depending from another (ex: then part of the If) +\newcommand{\algocf@@@eblock}[2]{#1\ifArgumentEmpty{#2}{\relax}{\KwSty{\@algocf@endoption{#2}}\strut\par}}% block: group with a end keyword. +\newcommand{\algocf@@@block}[3]{#1\ifArgumentEmpty{#2}{\ifArgumentEmpty{#3}{\relax}{ #3\relax}}{\KwSty{\@algocf@endoption{#2}}\ifArgumentEmpty{#3}{\relax}{ #3}\strut\par}}% block: group with a end keyword. +\newcommand{\algocf@@block}[3]{\algocf@@@block{#1}{#2}{#3}}% block: group with a end keyword. +\newcommand{\algocf@block}[3]{\algocf@@block{#1}{#2}{#3}}% command that will be used and redefined accordingly to noend option +%\newcommand{\algocf@nblock}[3]{\algocf@@block{#1}{#2}{#3}}% command that will be used and redefined accordingly to noend option +\newcommand{\algocf@setBlock}{% + \ifthenelse{\boolean{algocf@optnoend}}{% if no end option + \renewcommand{\algocf@block}[3]{\algocf@group{##1}}% block will be a group + }{% else + \renewcommand{\algocf@block}[3]{\algocf@@block{##1}{##2}{##3}}% block stays a block + }% +}% +% +\newcommand{\Hlne}{}% little hrizontal line ending a block in vline mode +% +\newcommand{\@algocf@endoption}[1]{#1}% +\newboolean{algocf@optnoend}\setboolean{algocf@optnoend}{false}% +% +\newcommand{\SetAlgoLongEnd}{%%%%%%%%%%%%%%%%%%%%%%%%% Long End + \setboolean{algocf@optnoend}{false}% + \renewcommand{\@algocf@endoption}[1]{##1}% + \algocf@setBlock}% +% +\newcommand{\SetAlgoShortEnd}{%%%%%%%%%%%%%%%%%%%%%%%% ShortEnd + \setboolean{algocf@optnoend}{false}% + \renewcommand{\@algocf@endoption}[1]{\@firstword##1 \@nil}% + \algocf@setBlock}% +% +\newcommand{\SetAlgoNoEnd}{%%%%%%%%%%%%%%%%%%%%%%%%%%% NoEnd + \setboolean{algocf@optnoend}{true}% + \renewcommand{\@algocf@endoption}[1]{}% + \algocf@setBlock}% +% +\newcommand{\SetAlgoNoLine}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Noline +\renewcommand{\algocf@@block}[2]{\algocf@@@block{\algocf@Noline{##1}}{##2}}% +\renewcommand{\algocf@group}[1]{\algocf@Noline{##1}}% +\renewcommand{\Hlne}{}}% +% +\newcommand{\SetAlgoVlined}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Vline +\renewcommand{\algocf@@block}[2]{\algocf@Vline{##1}}% +\renewcommand{\algocf@group}[1]{\algocf@Vsline{##1}}%\ifthenelse{\boolean{algocf@optnoend}}{\relax}{\strut\ignorespaces}}% +\renewcommand{\Hlne}{\algocf@Hlne}}% +% +\newcommand{\SetAlgoLined}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Line +\renewcommand{\algocf@@block}[2]{\algocf@@@block{\strut\algocf@Vsline{##1}}{##2}}% no skip after a block so garantie at least one line +\renewcommand{\algocf@group}[1]{\algocf@Vsline{##1}}%\ifthenelse{\boolean{algocf@optnoend}}{\relax}{\strut\ignorespaces}}% +\renewcommand{\Hlne}{}}% +% +\newcommand{\SetNothing}{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Noline +\renewcommand{\algocf@@block}[2]{\algocf@Noline{##1}\par}% +%\long +\renewcommand{\algocf@group}[1]{\algocf@Noline{##1}}% +\renewcommand{\Hlne}{}}% +% +%% +%% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ``Input:'''s like command +% +%%% +% text staying at the right of the longer keyword of KwInOut commands +% (text of KwInOut commands are all vertically aligned) +% +\newcommand{\algocf@newinout}{\par\parindent=\inoutindent}% to put right indentation after a \\ in the KwInOut +\newcommand{\SetKwInOut}[2]{% + \sbox\algocf@inoutbox{\KwSty{#2\algocf@typo:}}% + \expandafter\ifx\csname InOutSizeDefined\endcsname\relax% if first time used + \newcommand\InOutSizeDefined{}\setlength{\inoutsize}{\wd\algocf@inoutbox}% + \sbox\algocf@inoutbox{\parbox[t]{\inoutsize}{\KwSty{#2\algocf@typo\hfill:}}~}\setlength{\inoutindent}{\wd\algocf@inoutbox}% + \else% else keep the larger dimension + \ifdim\wd\algocf@inoutbox>\inoutsize% + \setlength{\inoutsize}{\wd\algocf@inoutbox}% + \sbox\algocf@inoutbox{\parbox[t]{\inoutsize}{\KwSty{#2\algocf@typo\hfill:}}~}\setlength{\inoutindent}{\wd\algocf@inoutbox}% + \fi% + \fi% the dimension of the box is now defined. + \algocf@newcommand{#1}[1]{% + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@seteveryparhanging{\relax}}% + \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% +% {\let\\\algocf@newinout\hangindent=\wd\algocf@inoutbox\hangafter=1\parbox[t]{\inoutsize}{\KwSty{#2}\algocf@typo\hfill:}~##1\par}% + {\let\\\algocf@newinout\hangindent=\inoutindent\hangafter=1\parbox[t]{\inoutsize}{\KwSty{#2\algocf@typo\hfill:}}~##1\par}% + \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@reseteveryparhanging}% + }}% +% +%% allow to ajust the skip size of InOut +%% +\newcommand{\ResetInOut}[1]{% + \sbox\algocf@inoutbox{\hbox{\KwSty{#1\algocf@typo:}\ }}% + \setlength{\inoutsize}{\wd\algocf@inoutbox}% + }% +% +% +%%% +% text staying at the right of the keyword. +% +\newcommand{\algocf@newinput}{\par\parindent=\wd\algocf@inputbox}% to put right indentation after a \\ in the KwInput +\newcommand{\SetKwInput}[2]{% + \algocf@newcommand{#1}[1]{% + \sbox\algocf@inputbox{\hbox{\KwSty{#2\algocf@typo:} }}% + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@seteveryparhanging{\relax}}% + \ifthenelse{\boolean{algocf@inoutnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% + {\let\\\algocf@newinput\hangindent=\wd\algocf@inputbox\hangafter=1\unhbox\algocf@inputbox##1\par}% + \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hanginginout}}{\relax}{\algocf@reseteveryparhanging}% + }}% +\newcommand{\SetKwData}[2]{% + \algocf@newcommand{@#1}[1]{\DataSty{#2(}\ArgSty{##1}\DataSty{)}}% + \algocf@newcommand{#1}{% + \@ifnextchar\bgroup{\csname @#1\endcsname}{\DataSty{#2}\xspace}}% + }% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tallent: +% +% Add following macros: +% \SetKwHangingKw: [kw] ------------ <= hanging determined by [kw] +% ------------ +% Should act like a combination of \SetKwInput and \SetKw. +% Based on \SetKwInput: +% - remove ':' at end of keyword +% - do not reset numbering +% - use separate savebox +\newsavebox{\algocf@hangingbox} +\newcommand{\algocf@newhanging}{\par\parindent=\wd\algocf@hangingbox}% to put right indentation after a \\ in the KwInput +\newcommand{\SetKwHangingKw}[2]{% + \algocf@newcommand{#1}[1]{% + \sbox\algocf@hangingbox{\hbox{\KwSty{#2}\algocf@typo\ }}% + {\let\\\algocf@newhanging\hangindent=\wd\algocf@hangingbox\hangafter=1\unhbox\algocf@hangingbox##1\;}% + }% +}% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Comments macros +% +%%%% +% comment in the text, first argument is the name of the macro, second is +% the text put before the comment, third is the text put at the end of the +% comment. +% +% first side comment justification +\newcommand{\SetSideCommentLeft}{\setboolean{algocf@scleft}{true}}% +\newcommand{\SetSideCommentRight}{\setboolean{algocf@scleft}{false}}% +\newcommand{\SetNoFillComment}{\setboolean{algocf@optfillcomment}{false}}% +\newcommand{\SetFillComment}{\setboolean{algocf@optfillcomment}{true}}% +% +% next comment and side comment +% +\newcommand{\algocf@endmarkcomment}{\relax}% +\newcommand{\algocf@fillcomment}{% + \ifthenelse{\boolean{algocf@optfillcomment}}{\hfill}{\relax}}% +% +\newcommand{\algocf@startcomment}{% + \hangindent=\wd\algocf@inputbox\hangafter=1\usebox\algocf@inputbox}% +\newcommand{\algocf@endcomment}{\algocf@fillcomment\algocf@endmarkcomment\ignorespaces\par}% +\newcommand{\algocf@endstartcomment}{\algocf@endcomment\algocf@startcomment\ignorespaces}% +% +\newboolean{algocf@sidecomment}% +\newboolean{algocf@altsidecomment}\setboolean{algocf@altsidecomment}{false}% +\newcommand{\algocf@scpar}{\ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\par}}% +\newcommand{\algocf@sclfill}{\ifthenelse{\boolean{algocf@scleft}}{\algocf@fillcomment}{\relax}}% +\newcommand{\algocf@scrfill}{\ifthenelse{\boolean{algocf@scleft}}{\relax}{\hfill}}% +\newcommand{\algocf@startsidecomment}{\usebox\algocf@inputbox}% +\newcommand{\algocf@endsidecomment}{\algocf@endmarkcomment\algocf@scpar}% +\newcommand{\algocf@endstartsidecomment}{% + \algocf@sclfill\algocf@endsidecomment% + \algocf@scrfill\algocf@startsidecomment\ignorespaces}% +% +\newcommand{\SetKwComment}[3]{% + \algocf@newcommand{#1}{\@ifstar{\csname algocf@#1@star\endcsname}{\csname algocf@#1\endcsname}}% + \algocf@newcommand{algocf@#1}[1]{% + \ifthenelse{\boolean{algocf@hangingcomment}}{\relax}{\algocf@seteveryparhanging{\relax}}% + \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}% + \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% + {\renewcommand{\algocf@endmarkcomment}{#3}% + \let\\\algocf@endstartcomment% + \algocf@startcomment\CommentSty{% + \strut\ignorespaces##1\strut\algocf@fillcomment#3}\par}% + \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hangingcomment}}{\relax}{\algocf@reseteveryparhanging}% + }% + %%% side comment definitions + \algocf@newcommand{algocf@#1@star}[2][]{% + \ifArgumentEmpty{##1}\relax{% TODO: Is this even necessary, with all those \ifx's? + \ifthenelse{\boolean{algocf@scleft}}{\setboolean{algocf@sidecomment}{true}}{\setboolean{algocf@sidecomment}{false}}% + \ifx##1h\setboolean{algocf@altsidecomment}{true}\SetSideCommentLeft\fi% + \ifx##1f\setboolean{algocf@altsidecomment}{true}\SetSideCommentRight\fi% + \ifx##1l\setboolean{algocf@altsidecomment}{false}\SetSideCommentLeft\fi% + \ifx##1r\setboolean{algocf@altsidecomment}{false}\SetSideCommentRight\fi% + }% + \sbox\algocf@inputbox{\CommentSty{\hbox{#2}}}% + \ifthenelse{\boolean{algocf@commentsnumbered}}{\relax}{\algocf@seteveryparnl{\relax}}% + {% + \renewcommand{\algocf@endmarkcomment}{#3}% + \let\\\algocf@endstartsidecomment% + % here is the comment + \ifthenelse{\boolean{algocf@altsidecomment}}{\relax}{\@endalgocfline\ }% + \algocf@scrfill\algocf@startsidecomment\CommentSty{% + \strut\ignorespaces##2\strut\algocf@sclfill#3}\algocf@scpar% + }% + \algocf@linesnumbered% reset the numbering of the lines + \ifArgumentEmpty{##1}\relax{% + \ifthenelse{\boolean{algocf@sidecomment}}{\setboolean{algocf@scleft}{true}}{\setboolean{algocf@scleft}{false}}% + \setboolean{algocf@altsidecomment}{false}% + }% + }% + }% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% KwProg +% +\newcommand{\SetKwProg}[4]{%\SetKwProg{Env}{Title}{is}{end} + \algocf@newcmdside@koif{#1}{\KwSty{#2}\ifArgumentEmpty{#2}\relax{\ }\ProgSty{##2}\KwSty{#3}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#4}{##4}}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\KwSty{#2} \ProgSty{##2}\KwSty{#3}\algocf@bgroupcode\ ##3\algocf@egroupcode\@endalgocfline\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\KwSty{#2} \ProgSty{##2}\KwSty{#3}\algocf@bgroupcode\ ##3\algocf@egroupcode}% +}% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Kw +% +\newcommand{\SetKw}[2]{% + \algocf@newcommand{@#1}[1]{\KwSty{#2} \ArgSty{##1}} + \algocf@newcommand{#1}{\@ifnextchar\bgroup{\csname @#1\endcsname}{\KwSty{#2}\xspace}}% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% KwFunction +% +\newcommand{\SetKwFunction}[2]{% +%%% use of gdef since newcommand doesn't manage to define the macro when SetKwFunction is used in \algocf@caption@proc + \expandafter\gdef\csname @#1\endcsname##1{\FuncSty{#2(}\FuncArgSty{##1}\FuncSty{)}}% + \expandafter\gdef\csname#1\endcsname{% + \@ifnextchar\bgroup{\csname @#1\endcsname}{\FuncSty{#2}\xspace}}% +}% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% KwTab +% +\newcommand{\SetKwArray}[2]{% +%%% use of gdef since newcommand doesn't manage to define the macro when SetKwFunction is used in \algocf@caption@proc + \expandafter\gdef\csname @#1\endcsname##1{\DataSty{#2[}\ArgSty{##1}\DataSty{]}}% + \expandafter\gdef\csname#1\endcsname{% + \@ifnextchar\bgroup{\csname @#1\endcsname}{\DataSty{#2}\xspace}}% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% KwBlock +% +\newcommand{\SetKwBlock}[3]{% + \algocf@newcmdside@kobe{#1}% + {\KwSty{#2}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##2}{#3}{##3}\par}% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% condition typo +% +\newcommand{\algocf@scond}{\ } +\newcommand{\algocf@econd}{\ } +\newcommand{\algocf@ucond}{} +\newcommand{\SetStartEndCondition}[3]{% + \renewcommand{\algocf@scond}{#1}\renewcommand{\algocf@econd}{#2}\renewcommand{\algocf@ucond}{#3}}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% For Switch +% +\newcommand{\SetKwSwitch}[9]{% #1=\Switch #2=\Case #3=\Other #4=switch #5=do #6=case #7=otherwise #8=endcase #9=endsw +% \algocf@newcmdside{#1}{3}% + \algocf@newcmdside@koif{#1}% + {\KwSty{#4}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#9} {##4\relax}}% +%%%% Case + \algocf@newcmdside@koif{#2}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#8}{##4\relax}}% + %uCase + \algocf@newcmdside{u#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@group{##3}}% + %lcase + \algocf@newcommand{l#2}{\@ifstar{\csname algocf@l#2star\endcsname}{\csname algocf@l#2\endcsname}}% + \algocf@newcmdside{algocf@l#2}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\ \relax{ ##1}\strut\par}% + \algocf@newcmdside{algocf@l#2star}{3}{\KwSty{#6}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#5}\algocf@bgroupcode\ ##3\algocf@egroupcode}% +%%%% Other + \algocf@newcmdside@kobe{#3}{\KwSty{#7} \KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##2}{#8}{##3\relax}}% + %lOther + \algocf@newcommand{l#3}{\@ifstar{\csname algocf@l#3star\endcsname}{\csname algocf@l#3\endcsname}}% + \algocf@newcmdside{algocf@l#3}{2}{\KwSty{#7} \KwSty{#5}\algocf@bgroupcode\ ##2\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#3star}{2}{\KwSty{#7} \KwSty{#5}\algocf@bgroupcode\ ##2\algocf@egroupcode}% + %uOther + \algocf@newcmdside{u#3}{3}{\KwSty{#7} \KwSty{#5}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@group{##2}}% +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% If macros +% +\newcommand{\SetKwIF}[8]{% #1=\If #2=\ElseIf #3=\Else #4=if #5=then #6=elseif #7=else #8=endif +% +% common text + \algocf@newcommand{#1@ifthen}[1]{\KwSty{#4}\algocf@scond\ArgSty{##1}\algocf@econd\KwSty{#5}}% + \algocf@newcommand{#1@endif} [2]{\algocf@block{##1}{#8}{##2}}% + \algocf@newcommand{#1@noend} [1]{\algocf@group{##1}}% + \algocf@newcommand{#1@else} [1]{\algocf@group{##1}\KwSty{#7}}% + \algocf@newcommand{#2@elseif}[1]{\KwSty{#6}\algocf@scond\ArgSty{##1}\algocf@econd\KwSty{#5}}% + \algocf@newcommand{#3@else} {\KwSty{#7}}% +%%%% If then { } endif + \algocf@newcmdside@koif{#1}{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##3}{##4\relax}}% +%%%% If then {} else {} endif + % first command to handle optional side comment of else (so just after first braces) + \algocf@newcmdside@kobe{algocf@e#1thenelse}{\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##2}{##3}}% + % the definition of if-then-else command using command above + \algocf@newcmdside{e#1}{3}{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@else\endcsname{##3}\csname algocf@e#1thenelse\endcsname}% + %%% leif + \algocf@newcommand{le#1}{\@ifstar{\csname algocf@le#1star\endcsname}{\csname algocf@le#1\endcsname}}% + \algocf@newcmdside{algocf@le#1}{4}{\csname #1@ifthen\endcsname{##2} \algocf@bgroupcode##3 \csname #3@else\endcsname\ ##4\@endalgocfline\ \algocf@egroupcode\ifArgumentEmpty{##1}\relax{##1}\strut\par}% + \algocf@newcmdside{algocf@le#1star}{4}{\csname #1@ifthen\endcsname{##2} \algocf@bgroupcode##3 \csname #3@else\endcsname\ ##4\algocf@egroupcode}% +%%%% If then + % \algocf@newcmdside{l#1}{3}{\csname #1@ifthen\endcsname{##2}\algocf@bgroupcode\ + % ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\csname #1@ifthen\endcsname{##2}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\csname #1@ifthen\endcsname{##2}\algocf@bgroupcode\ ##3\algocf@egroupcode}% + \algocf@newcmdside{u#1}{3}{\csname #1@ifthen\endcsname{##2}\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@noend\endcsname{##3}}% +%%%% ElseIf {} endif + \algocf@newcmdside@koif{#2}{\csname #2@elseif\endcsname{##2}\relax\ifArgumentEmpty{##1}\relax{ ##1}\csname #1@endif\endcsname{##3}{##4\relax}}% +%%%% ElseIf + \algocf@newcommand{l#2}{\@ifstar{\csname algocf@l#2star\endcsname}{\csname algocf@l#2\endcsname}}% + \algocf@newcmdside{algocf@l#2}{3}{\csname #2@elseif\endcsname{##2}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#2star}{3}{\csname #2@elseif\endcsname{##2}\algocf@bgroupcode\ ##3\algocf@egroupcode}% + \algocf@newcmdside{u#2}{3}{\csname #2@elseif\endcsname{##2}\relax\ifArgumentEmpty{##1}\relax{##1}\csname #1@noend\endcsname{##3}}% +%%%% Else {} endif + \algocf@newcmdside@kobe{#3}{\csname #3@else\endcsname\ifArgumentEmpty{##1}\relax\ ##1\csname #1@endif\endcsname{##2}{##3\relax}}% +%%%% Else + \algocf@newcommand{l#3}{\@ifstar{\csname algocf@l#3star\endcsname}{\csname algocf@l#3\endcsname}}% + \algocf@newcmdside{algocf@l#3}{2}{\csname #3@else\endcsname\algocf@bgroupcode\ ##2\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#3star}{2}{\csname #3@else\endcsname\algocf@bgroupcode\ ##2\algocf@egroupcode}% + \algocf@newcmdside{u#3}{2}{\csname #3@else\endcsname\ifArgumentEmpty{##1}\relax\ {##1\relax}\csname #1@noend\endcsname{##2}}% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% For macros +% +\newcommand{\SetKwFor}[4]{% + \algocf@newcmdside@koif{#1}{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\ifArgumentEmpty{##1}\relax{ ##1}\algocf@block{##3}{#4}{##4\relax}}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\algocf@bgroupcode\ ##3\@endalgocfline\algocf@egroupcode\ifArgumentEmpty{##1}\relax\ {##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\KwSty{#2}\algocf@scond\ArgSty{##2}\algocf@econd\KwSty{#3}\algocf@bgroupcode\ ##3\algocf@egroupcode}% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Repeat macros +% +\newsavebox{\algocf@untilbox}% to handle width of until keyword needed to have good skip + % for line numbers +\newskip\algocf@skipuntil +\newcommand{\SetKwRepeat}[3]{% + \algocf@newcmdsides{#1}{3}{% + \sbox\algocf@untilbox{\KwSty{#3}\algocf@scond}\algocf@skipuntil=\wd\algocf@untilbox% + \KwSty{#2}\ifArgumentEmpty{##1}\relax{##1}\algocf@group{##3}% + \KwSty{#3}\algocf@scond% until keyword and start condition typo + %\advance\skiptotal by\algocf@skipuntil% + \ArgSty{##2}% + %\advance\skiptotal by-\algocf@skipuntil% + \algocf@ucond% + \algocf@skipuntil=0pt% reset counter + }{\@endalgocfline}{\strut\par}% + \algocf@newcommand{l#1}{\@ifstar{\csname algocf@l#1star\endcsname}{\csname algocf@l#1\endcsname}}% + \algocf@newcmdside{algocf@l#1}{3}{\KwSty{#2}\algocf@bgroupcode\ ##3\algocf@egroupcode\ \KwSty{#3}\algocf@scond\ArgSty{##2}\algocf@ucond\@endalgocfline\ifArgumentEmpty{##1}\relax{ ##1}\strut\par}% + \algocf@newcmdside{algocf@l#1star}{3}{\KwSty{#2}\algocf@bgroupcode\ ##3\algocf@egroupcode\ \KwSty{#3}\algocf@scond\ArgSty{##2}\algocf@ucond}% +}% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%% Environments definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%% +%% Caption management +%% +% for the following macros: +% #1 is given by caption and is equal to fnum@algocf +% #2 is the text given in argument by the user in the \caption macro +% +%%%%% text of caption +\newcommand{\algocf@captionlayout}[1]{#1}% +\newcommand{\SetAlgoCaptionLayout}[1]{% + \renewcommand{\algocf@captionlayout}[1]{\csname #1\endcsname{##1}}}% +\newcommand{\algocf@capseparator}{:}% +\newcommand{\SetAlgoCaptionSeparator}[1]{\renewcommand{\algocf@capseparator}{#1}}% +\newcommand{\algocf@captiontext}[2]{% + \algocf@captionlayout{\AlCapSty{\AlCapFnt #1\algocf@typo\algocf@capseparator}\nobreakspace% + \AlCapNameSty{\AlCapNameFnt{}#2\endgraf}}}% text of caption +% +%%%%% default caption of algorithm: used if no specific style caption is defined +\newcommand{\algocf@makecaption}[2]{% + \addtolength{\hsize}{\algomargin}% + \sbox\@tempboxa{\algocf@captiontext{#1}{#2}}% + \ifdim\wd\@tempboxa >\hsize% % if caption is longer than a line + \hskip .5\algomargin% + \parbox[t]{\hsize}{\algocf@captiontext{#1}{#2}}% then caption is not centered + \else% + \global\@minipagefalse% + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% else caption is centered + \fi% + \addtolength{\hsize}{-\algomargin}% +}% +% +\newsavebox\algocf@capbox% +\newcommand{\algocf@makecaption@plain}[2]{% + \global\sbox\algocf@capbox{\algocf@makecaption{#1}{#2}}}% +\newcommand{\algocf@makecaption@boxed}[2]{% + \addtolength{\hsize}{-\algomargin}% + \global\sbox\algocf@capbox{\algocf@makecaption{#1}{#2}}% + \addtolength{\hsize}{\algomargin}% + }% +% +\newcommand{\algocf@makecaption@plainruled}[2]{\algocf@makecaption@plain{#1}{#2}}% +\newcommand{\algocf@makecaption@tworuled}[2]{\algocf@makecaption@ruled{#1}{#2}}% +\newcommand{\algocf@makecaption@algoruled}[2]{\algocf@makecaption@ruled{#1}{#2}}% +\newcommand{\algocf@makecaption@boxruled}[2]{\algocf@makecaption@ruled{#1}{#2}}% +\newcommand{\algocf@makecaption@ruled}[2]{% + \global\sbox\algocf@capbox{\hskip\AlCapHSkip% .5\algomargin% + \parbox[t]{\hsize}{\algocf@captiontext{#1}{#2}}}% then caption is not centered +}% +% +\newlength{\algoheightruledefault}\setlength{\algoheightruledefault}{0.8pt}% +\newlength{\algoheightrule}\setlength{\algoheightrule}{\algoheightruledefault}% +\newlength{\algotitleheightruledefault}\setlength{\algotitleheightruledefault}{0.8pt}% +\newlength{\algotitleheightrule}\setlength{\algotitleheightrule}{\algotitleheightruledefault}% +\newcommand{\algocf@caption@plain}{\vskip\AlCapSkip\box\algocf@capbox}% +\newcommand{\algocf@caption@plainruled}{\algocf@caption@plain}% +\newcommand{\algocf@caption@boxed}{\vskip\AlCapSkip\box\algocf@capbox}% +\newcommand{\algocf@caption@ruled}{\box\algocf@capbox\kern\interspacetitleruled\hrule + width\algocf@ruledwidth height\algotitleheightrule depth0pt\kern\interspacealgoruled}% +\newcommand{\algocf@caption@tworuled}{\box\algocf@capbox\hrule height0pt depth0pt\kern\interspacealgoruled}% +\newcommand{\algocf@caption@algoruled}{\algocf@caption@ruled}% +\newcommand{\algocf@caption@boxruled}{% + \addtolength{\hsize}{-0.8pt}% + \hbox to\hsize{% + \vrule%\hskip-0.35pt% + \vbox{% + \hrule\vskip\interspacetitleboxruled% + \hbox to\hsize{\unhbox\algocf@capbox\hfill}\vskip\interspacetitleboxruled% + }% + %\hskip-0.35pt% + \vrule% + }\nointerlineskip% + \addtolength{\hsize}{0.8pt}% +}% +% +% +%%%% set caption for the environment +\newcommand{\algocf@captionref}{% + \renewcommand{\fnum@algocf}[1]{\AlCapSty{\AlCapFnt\algorithmcfname\nobreakspace\algocf@algocfref}}% + \addtocounter{algocf}{-1}% \caption do a refstepcounter, so we restore the precedent value + \let\old@thealgocf=\thealgocf\renewcommand{\thealgocf}{{\relsize{\algocf@refrelsize}\algocf@algocfref}}% + \gdef\@currentlabel{\algocf@algocfref}% let the label use the new ref +}% +% +% Unfortunatly, we also need our own caption to set some specific stuff for special references. But after these +% settings, we call the original caption. +% +\long\def\algocf@caption@algo#1[#2]#3{% + \ifthenelse{\equal{\algocf@algocfref}{\relax}}{}{\algocf@captionref}% + \@ifundefined{hyper@refstepcounter}{\relax}{% if hyper@refstepcounter undefind, no hyperref, else... + \ifthenelse{\equal{\algocf@algocfref}{\relax}}{\renewcommand{\theHalgocf}{\thealgocf}}{% take algocf as Href + \renewcommand{\theHalgocf}{\algocf@algocfref}}%else if SetAlgoRefName done, take this name as ref. + \hyper@refstepcounter{algocf}%set algocf as category of ref + }% + \algocf@latexcaption{#1}[{#2}]{{#3}}% call original caption +}% +% +% beamer define is own caption overrinding latex caption! +% as we need it, we have put here the original definition +% to handle manual ref, unfortunately we have to add one line to handle algocf@algocfref +\long\def\algocf@latexcaption#1[#2]#3{% original definition of caption + \par% + \addcontentsline{\csname ext@#1\endcsname}{#1}% + {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% + \begingroup% + \@parboxrestore% + \if@minipage% + \@setminipage% + \fi% + \normalsize% + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par% + \endgroup% +}% +% +% \ifx\beamer@makecaption\undefined% +% \else% beamer detected +\ifx\@makecaption\undefined% +\newcommand{\@makecaption}[2]{\relax}% +\fi% +%% + +% +% more and more packages redefine \@caption instead of just \@makecaption which makes algorithm2e +% caption not works since based on standard \@caption. So we force the definition of \@caption to be +% the standard one (the one from LaTeX) inside algorithm environment. +% +% unfortunately, makecaption is called with \ignorespace #3 so +% we can't do the @currentlabel definition inside \algocf@captionproctext +\long\def\algocf@caption@proc#1[#2]#3{% + \ifthenelse{\boolean{algocf@nokwfunc}}{\relax}{% + \SetKwFunction{\algocf@captname#3@}{\algocf@captname#3@}% + }% + % we tell hyperref to use algocfproc as category and to take the appropriate ref. + \ifthenelse{\boolean{algocf@func}}{\def\@proc@func{algocffunc}}{\def\@proc@func{algocfproc}}% + \@ifundefined{hyper@refstepcounter}{\relax}{% if hyper@refstepcounter undefind, no hyperref, else... + \ifthenelse{\boolean{algocf@procnumbered}}{% + \expandafter\def\csname theH\@proc@func\endcsname{\thealgocf}%if procnumbered, take \thealgocf as ref + }{% + \expandafter\def\csname theH\@proc@func\endcsname{\algocf@captname#3@}%else take procedure or function name + }% + \hyper@refstepcounter{\@proc@func}% + }% + \ifthenelse{\boolean{algocf@procnumbered}}{\relax}{% + \addtocounter{algocf}{-1}% \caption do a refstepcounter, so we restore the precedent value + \gdef\@currentlabel{\algocf@captname#3@}% let the label be the name of the function, not the counter + }% + \ifthenelse{\equal{\algocf@captparam#2@}{\arg@e}}{% if no paramater, we remove the () + \algocf@latexcaption{#1}[\algocf@procname\nobreakspace\algocf@captname#2@]{#3}% + }{% else we give the complete name + \algocf@latexcaption{#1}[\algocf@procname\nobreakspace#2]{#3}% + }% +}% +%% +%%% setcaption +\newcommand{\algocf@setcaption}{% + \ifthenelse{\boolean{algocf@procenvironment}}{% if proc environment, caption text must be changed + \let\algocf@oldcaptiontext=\algocf@captiontext% + \renewcommand{\algocf@captiontext}[2]{% + \algocf@captionproctext{##1}{##2}% + }% + }{}% + \let\algocf@savecaption=\@caption% + \ifthenelse{\boolean{algocf@procenvironment}}{\let\@caption=\algocf@caption@proc}{\let\@caption=\algocf@caption@algo}% + \let\algocf@oldmakecaption=\@makecaption% + \renewcommand{\@makecaption}[2]{% + \expandafter\csname algocf@makecaption@\algocf@style\endcsname{##1}{##2}% + }% +}% +% +%%%%% reset caption +% +% since we have force the LaTeX caption for algorithm environment, we must go back to the caption +% used in the text. +\newcommand{\algocf@resetcaption}{% + \ifthenelse{\boolean{algocf@procenvironment}}{% if proc environment + \let\thealgocf=\old@thealgocf% restore normal counter printing + \let\algocf@captiontext=\algocf@oldcaptiontext% restore normal caption text + }{}% + \let\@caption=\algocf@savecaption% now restore caption outside algo/proc/func environment + \let\@makecaption=\algocf@oldmakecaption% and restore makecaption outside outside algo/proc/func environment + \algocf@resetfnum% +}% +% +%%%%% nocaptionofalgo and restorecaptionofalgo -- +\newcommand{\NoCaptionOfAlgo}{% + \let\@old@algocf@captiontext=\algocf@captiontext% + \renewcommand{\algocf@captiontext}[2]{\AlCapNameSty{\AlCapNameFnt{}##2}}% +}% +\newcommand{\RestoreCaptionOfAlgo}{% + \let\algocf@captiontext=\@old@algocf@captiontext% +}% +% +% ---------------------- algocf environment +% +\newcounter{algocfline}% % new counter to make lines numbers be internally +\setcounter{algocfline}{0}% % different in different algorithms +\newcounter{algocfproc}% counter to count all algo environment (proc, func), just used by hyperref to avoir "same +\setcounter{algocfproc}{0}% identifier" error caused by algocf being set to '-' for procedure or function or not + % changed if no caption is given. +% +\expandafter\ifx\csname algocf@within\endcsname\relax% if \algocf@within doesn't exist +\newcounter{algocf}% % just define a new counter +\renewcommand{\thealgocf}{\@arabic\c@algocf}% and the way it is printed +\else% else +\newcounter{algocf}[\algocf@within]% % counter is numbered within \algocf@within +\renewcommand\thealgocf{\csname the\algocf@within\endcsname.\@arabic\c@algocf}% +\fi% +% +\def\fps@algocf{htbp}% % default +\def\ftype@algocf{10}% % float type +\def\ext@algocf{\algocf@list} % loa by default, lof if figure option used +\newcommand{\fnum@algocf}{\AlCapSty{\AlCapFnt\algorithmcfname\nobreakspace\thealgocf}}% +\newcommand{\algocf@resetfnum}{\renewcommand{\fnum@algocf}{\AlCapSty{\AlCapFnt\algorithmcfname\nobreakspace\thealgocf}}}% +\newenvironment{algocf}% % float environment for algorithms + {\@float{algocf}}% + {\end@float}% +\newenvironment{algocf*}% % float* environment for algorithms + {\@dblfloat{algocf}}% + {\end@dblfloat}% +% +\def\algocf@seclistalgo{}% +\ifx\l@chapter\undefined\let\algocf@seclistalgo=\section\else\let\algocf@seclistalgo=\chapter\fi% +\@ifundefined{if@restonecol}{\newif\if@restonecol}\relax% +\newcommand\listofalgocfs{% + \ifx\algocf@seclistalgo\chapter% + \if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi% + \fi% + \algocf@seclistalgo*{\listalgorithmcfname}% + \@mkboth{\MakeUppercase\listalgorithmcfname}% + {\MakeUppercase\listalgorithmcfname}% + \@starttoc{loa}% + \ifx\algocf@seclistalgo\chapter% + \if@restonecol\twocolumn\fi% + \fi% +} +% +\newcommand*\l@algocf{\@dottedtocline{1}{1em}{2.3em}}% line of the list +% +% ---------------------- algorithm environment +% +%%%%%%% +%% +%% Algorithm environment definition +%% +%%%%%%% +%% +% +\newsavebox\algocf@algoframe% +\def\@algocf@pre@plain{\relax}% action to be done before printing the algo. +\def\@algocf@post@plain{\relax}% action to be done after printing the algo. +\def\@algocf@capt@plain{bottom}% where the caption should be localized. +\def\@algocf@pre@boxed{\noindent\begin{lrbox}{\algocf@algoframe}} +\def\@algocf@post@boxed{\end{lrbox}\framebox[\hsize]{\box\algocf@algoframe}\par}% +\def\@algocf@capt@boxed{under}% +\def\@algocf@pre@ruled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}% +\def\@algocf@post@ruled{\kern\interspacealgoruled\hrule height\algoheightrule\relax}% +\def\@algocf@capt@ruled{top}% +\def\@algocf@pre@algoruled{\hrule width\algocf@ruledwidth height\algoheightrule depth0pt\kern\interspacetitleruled}% +\def\@algocf@post@algoruled{\kern\interspacealgoruled\hrule width\algocf@ruledwidth height\algoheightrule \relax}% +\def\@algocf@capt@algoruled{top}% +\def\@algocf@pre@tworuled{\hrule height\algoheightrule depth0pt\kern\interspacetitleruled}% +\def\@algocf@post@tworuled{\kern\interspacealgoruled\hrule height\algoheightrule\relax}% +\def\@algocf@capt@tworuled{top}% +\def\@algocf@pre@boxruled{\noindent\begin{lrbox}{\algocf@algoframe}}% +\def\@algocf@post@boxruled{\end{lrbox}\framebox[\hsize]{\box\algocf@algoframe}\par}% +\def\@algocf@capt@boxruled{above}% +\def\@algocf@pre@plainruled{\@algocf@pre@ruled}% action to be done before printing the algo. +\def\@algocf@post@plainruled{\@algocf@post@ruled\kern\interspacealgoruled}% action to be done before printing the algo. +\def\@algocf@capt@plainruled{under}% +% +\newcommand{\noalgocaption}{\def\@algocf@capt@ruled{none}} +% +%% before algocf environment (not figure environment) +\newcommand{\@algocf@init@caption}{% + \ifthenelse{\boolean{algocf@procenvironment}}{% if we are inside a procedure/function environment + \@algocf@proctitleofalgo% set Titleofalgo to Procedure: or Function: + % accordingly to the environment + \let\old@thealgocf=\thealgocf\ifthenelse{\boolean{algocf@procnumbered}}{\relax}{% + \renewcommand{\thealgocf}{-}}% + }{% else inside environment algorithm + \@algocf@algotitleofalgo% fix name for \Titleofalgo to \algorithmcfname + }% + \algocf@setcaption% set caption to our caption style +}% +% +\newcommand{\@algofloatboxreset}{\@setminipage} +\newcommand{\@algocf@init}{% + \refstepcounter{algocfline}% + \stepcounter{algocfproc}%to have a different counter for each environment and being abble to make the difference + %between href of algoline in different algorithms. + \ifthenelse{\boolean{algocf@optnoend}}{% + \renewcommand{\algocf@block}[3]{\algocf@group{##1}}% + }{% + \renewcommand{\algocf@block}[3]{\algocf@@block{##1}{##2}{##3}}% + }% +}% +%% after the end of algocf or figure environment +\newcommand{\@algocf@term@caption}{% + \algocf@resetcaption% restore original caption +}% +% +\newcommand{\@algocf@term}{% + \setboolean{algocf@algoH}{false}% no H by default + \ifthenelse{\boolean{algocf@optnoend}}{% + \renewcommand{\algocf@block}[3]{\algocf@@block{##1}{##2}{##3}}% + }{% + \renewcommand{\algocf@block}[2]{\algocf@group{##1}}% + }% + \SetAlgoRefName{\relax}% +}% +% +%%%%%%%%%%%%%%%%% +%% makethealgo: macro which print effectively the algo in its box +%% +\newsavebox\algocf@algobox% +\newcommand{\algocf@makethealgo}{% + \vtop{% + % place caption above if needed bye the style + \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{above}}% + {\csname algocf@caption@\algocf@style\endcsname}{}% + % + % precommand according to the style + \csname @algocf@pre@\algocf@style\endcsname% + % place caption at top if needed bye the style + \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{top}}% + {\csname algocf@caption@\algocf@style\endcsname}{}% + % + \box\algocf@algobox% the algo + % place caption at bottom if needed bye the style + \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{bottom}}% + {\csname algocf@caption@\algocf@style\endcsname}{}% + % postcommand according to the style + \csname @algocf@post@\algocf@style\endcsname% + % place caption under if needed bye the style + \ifthenelse{\equal{\csname @algocf@capt@\algocf@style\endcsname}{under}}% + {\csname algocf@caption@\algocf@style\endcsname}{}% + }% +}% +%%%%%%%%%%%%%%%%%%% +% +%% at the beginning of algocf or figure environment +\newenvironment{algomathdisplay}{\[}{\@endalgocfline\]\ifthenelse{\boolean{algocf@linesnumbered}}{\nl}{\relax}}% +\newcommand{\@algocf@start}{% + \@algoskip% + \begin{lrbox}{\algocf@algobox}% + \setlength{\algowidth}{\hsize}% + \vbox\bgroup% save all the algo in a box + \hbox to\algowidth\bgroup\hbox to \algomargin{\hfill}\vtop\bgroup% + \ifthenelse{\boolean{algocf@slide}}{\parskip 0.5ex\color{black}}{}% + % initialization + \addtolength{\hsize}{-1.5\algomargin}% + \let\@mathsemicolon=\;\def\;{\ifmmode\@mathsemicolon\else\@endalgoln\fi}% + \raggedright\AlFnt{}% + \ifthenelse{\boolean{algocf@slide}}{\IncMargin{\skipalgocfslide}}{}% + \@algoinsideskip% +% \let\@emathdisplay=\]\def\]{\algocf@endline\@emathdisplay\nl}% +}% +% +%% at the end of algocf or figure environment +\newcommand{\@algocf@finish}{% + \@algoinsideskip% + \egroup%end of vtop which contain all the text + \hfill\egroup%end of hbox wich contains [margin][vtop] + \ifthenelse{\boolean{algocf@slide}}{\DecMargin{\skipalgocfslide}}{}% + % + \egroup%end of main vbox + \end{lrbox}% + \algocf@makethealgo% print the algo + \@algoskip% + % restore dimension and macros + \setlength{\hsize}{\algowidth}% + \lineskip\normallineskip\setlength{\skiptotal}{\@defaultskiptotal}% + \let\;=\@mathsemicolon% + \let\]=\@emathdisplay% +}% +% +%%%%%%%%%%%%%%%%%%%% +%% basic definition of the environment algorithm +%% +% +\newboolean{algocf@procenvironment}\setboolean{algocf@procenvironment}{false}% +\newboolean{algocf@func}\setboolean{algocf@func}{false}% +\newboolean{algocf@algoH}\setboolean{algocf@algoH}{false}% +\newboolean{algocf@algostar}\setboolean{algocf@algostar}{false}% +% +%%% environment for {algorithm}[H] +\newenvironment{algocf@Here}{\noindent% + \def\@captype{algocf}% if not defined, caption exit with an error + \begin{minipage}{\hsize}% +}{% + \end{minipage}%\par% +}% +%%% real algorithm environment which manages H and * option +% \let\algocf@originalfloatboxreset=\@floatboxreset% +% \let\@floatboxreset=\@algofloatboxreset% +\newenvironment{algocf@algorithm}[1][htbp]{% + \ifthenelse{\equal{\algocf@float}{figure}}{% + \ifthenelse{\boolean{algocf@figurecaption}}{\captionsetup{margin={-\algomargin,\algomargin}}}{}% + }{}% + \@algocf@init% + \ifthenelse{\equal{\algocf@float}{figure}}{% if option figure set + \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* with figure option + \begin{figure*}[#1]% call figure* + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% + }{% else algorithm environment with figure option + \begin{figure}[#1]% call figure + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% + }% + }{% else normal algorithm environment + \@algocf@init@caption% + \ifthenelse{\equal{#1}{H}}{% if [H] algorithm + \if@twocolumn\@latex@error{[H] in two columns mode is not allowed for algorithms}\fi% TODO: SCREAM if H in two colums! + \setboolean{algocf@algoH}{true}\begin{algocf@Here}% call corresponding environment + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% + }{% else floating algorithm environment + \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* + \begin{algocf*}[#1]% call algocf* + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% + }{% else algorithm environment + \begin{algocf}[#1]% call algcf + \ifthenelse{\boolean{algocf@customruledwidth}}{\relax}{\setlength{\algocf@ruledwidth}{\linewidth}}% + \let\algocf@oldeverypar=\everypar% + \algocf@seteverypar% + }% + }% + }% fin test option figure ou pas + \@algocf@start% + \@ResetCounterIfNeeded% + \algocf@linesnumbered\ignorespaces% +}{% + \@algocf@finish% + \ifthenelse{\equal{\algocf@float}{figure}}{% + \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* with figure option + \let\everypar=\algocf@oldeverypar% + \end{figure*}% call figure* + }{% else algorithm environment with figure option + \let\everypar=\algocf@oldeverypar% + \end{figure}% call figure + }% + }{% + \@algocf@term@caption% + \ifthenelse{\boolean{algocf@algoH}}{% if [H] algorithm + \let\everypar=\algocf@oldeverypar% + \end{algocf@Here}\par% call corresponding environment + }{% else floating algorithm environment + \ifthenelse{\boolean{algocf@algostar}}{% if algorithm* + \let\everypar=\algocf@oldeverypar% + \end{algocf*}% call algocf* + }{% else algorithm environment + \let\everypar=\algocf@oldeverypar% + \end{algocf}% call algocf + }% + }% + }% + \@algocf@term\ignorespacesafterend% +}% +% +%%% user algorithm environment +\newenvironment{\algocf@envname}[1][htbp]{% + \setboolean{algocf@algostar}{false}% + \setboolean{algocf@procenvironment}{false}\gdef\algocfautorefname{\algorithmautorefname}% + \begin{algocf@algorithm}[#1]\ignorespaces% +}{% + \end{algocf@algorithm}\ignorespacesafterend% +}% +%%% user algorithm* environment +\newenvironment{\algocf@envname*}[1][htbp]{% + \setboolean{algocf@algostar}{true}% + \setboolean{algocf@procenvironment}{false}\gdef\algocfautorefname{\algorithmautorefname}% + \begin{algocf@algorithm}[#1]\ignorespaces% +}{% + \end{algocf@algorithm}\ignorespacesafterend% +}% +% +%%%%%%%%%%%%%%%%%%%%%%% +%%% +% +\expandafter\newcommand\csname\algocf@listofalgorithms\endcsname{% + \ifthenelse{\equal{\algocf@float}{figure}}{\listoffigures}{\listofalgocfs}% +}% +%%% +%%% +% +% ---------------------- procedure and function environments +% +% +% -- new style (used in particular in the caption of function and procedure environments) +% +% three macros to extract parts of the caption +\gdef\algocf@captname#1(#2)#3@{#1} % keep characters before the first brace +\gdef\algocf@captparam#1(#2)#3@{#2} % keep character in between the braces +\gdef\algocf@captother#1(#2)#3@{#3} % keep character after the braces +% +%%% Text of caption for Procedure or Function +\newcommand{\algocf@captionproctext}[2]{% + {% + \ProcSty{\ProcFnt\algocf@procname\ifthenelse{\boolean{algocf@procnumbered}}{\nobreakspace\thealgocf\algocf@typo\algocf@capseparator}{\relax}}% + \nobreakspace\ProcNameSty{\ProcNameFnt\algocf@captname #2@}% Name of the procedure in ProcName Style. + \ifthenelse{\equal{\algocf@captparam #2@}{\arg@e}}{}{% if no argument, write nothing + \ProcNameSty{\ProcNameFnt(}\ProcArgSty{\ProcArgFnt\algocf@captparam #2@}\ProcNameSty{\ProcNameFnt)}%else put arguments in ProcArgSty: + }% endif + \algocf@captother #2@% + }% +}% +% +% +% -- procedure and function environments are defined from algocf@algorithm environment +% +\newenvironment{procedure}[1][htbp]{% + \setboolean{algocf@algostar}{false}% + \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{false}% + \newcommand{\algocf@procname}{\@algocf@procname}\gdef\algocfprocautorefname{\procedureautorefname}% + \begin{algocf@algorithm}[#1]\ignorespaces% +}{% + \end{algocf@algorithm}\ignorespacesafterend% +}% +\newenvironment{function}[1][htbp]{% + \setboolean{algocf@algostar}{false}% + \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{true}% + \newcommand{\algocf@procname}{\@algocf@funcname}\gdef\algocffuncautorefname{\functionautorefname}% + \begin{algocf@algorithm}[#1]\ignorespaces% +}{% + \end{algocf@algorithm}\ignorespacesafterend% +}% +% +\newenvironment{procedure*}[1][htbp]{% + \setboolean{algocf@algostar}{true}% + \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{false}% + \newcommand{\algocf@procname}{\@algocf@procname}\gdef\algocfprocautorefname{\procedureautorefname}% + \begin{algocf@algorithm}[#1]\ignorespaces% +}{% + \end{algocf@algorithm}\ignorespacesafterend% +}% +\newenvironment{function*}[1][htbp]{% + \setboolean{algocf@algostar}{true}% + \setboolean{algocf@procenvironment}{true}\setboolean{algocf@func}{true}% + \newcommand{\algocf@procname}{\@algocf@funcname}\gdef\algocffuncautorefname{\functionautorefname}% + \begin{algocf@algorithm}[#1]\ignorespaces% +}{% + \end{algocf@algorithm}\ignorespacesafterend% +}% +% +% +%%%%%%%%%%%%%%%%%%%% +%% definition of algondfloat environment +%% +\ifthenelse{\boolean{algocf@endfloat}}{% if endfloat option then +\newcommand{\algoplace}{% macro which is used to writhe algorithm about there + \begin{center}% + [\algorithmcfname~\thepostfig\ about here.]% + \end{center}% +}% +\newcommand{\algoendfloat}{% use as a \begin{algoendfloat} environment to start scanning of line +% \immediate\openout\@mainfff\jobname.fff% + \efloat@condopen{fff} + \efloat@iwrite{fff}{\string\begin{\algocf@envname}}% + \if@domarkers% + \ifthenelse{\equal{\algocf@list}{lof}}{% + \addtocounter{postfig}{1}% + }{% + \addtocounter{postalgo}{1}% + }% + \algoplace% + \fi% + \bgroup% + \let\do\ef@makeinnocent\dospecials% + \ef@makeinnocent\^^L% and whatever other special cases + \endlinechar`\^^M \catcode`\^^M=12 \ef@xalgocfendfloat}% +}{\relax}%%%% end of endfloat option ifthenelse +%% some macros useful for endfloat option that cannot be defined inside the ifthenelse +%scan algoendfloat algorithm and write the text into .fff file +{\catcode`\^^M=12 \endlinechar=-1 % + \gdef\ef@xalgocfendfloat#1^^M{% scan the lines inside algoendfloat environment being read by latex + \def\test{#1}% test is the line being currently scan by latex + \ifx\test\ef@endalgocftest% if it is \end{algoendfloat} + \def\next{% define next as to not continue the scan and write \end{algorithm} into .fff file + \egroup\end{algoendfloat}% + \efloat@iwrite{fff}{\string\end{\algocf@envname}}% + \efloat@iwrite{fff}{\string\efloatseparator}% + \efloat@iwrite{fff}{ }% + }% + \else% else write the current line being scanned by latex and set next to continue the scan + \efloat@iwrite{fff}{#1}% + \let\next\ef@xalgocfendfloat% + \fi% endif + \next}% next is continue if it was else condition, else it does not continue the scan and write end to file +}% +% test if the scan is finish by looking at the string \end{algoendfloat} +{\escapechar=-1% + \xdef\ef@endalgocftest{\string\\end\string\{algoendfloat\string\}}% +}% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +\newcommand{\TitleOfAlgo}[1]{\@titleprefix\ + \TitleSty{#1}\par\smallskip}% +% +\newcommand{\SetAlgorithmName}[3]{% + \renewcommand{\listalgorithmcfname}{#3}% + \renewcommand{\algorithmcfname}{#1}% + \renewcommand{\algorithmautorefname}{#2}% +}% +% +\newcommand{\algocf@refrelsize}{-2}\newcommand{\SetAlgoRefRelativeSize}[1]{\renewcommand{\algocf@refrelsize}{#1}}% +\newcommand{\SetAlgoRefName}[1]{% + \renewcommand{\algocf@algocfref}{#1}% +}% +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% ------------------------- Default Definitions +% +%% +%% +% +\SetKwComment{tcc}{/* }{ */}% +\SetKwComment{tcp}{// }{}% +% +%\newcommand{\algocf@defaults@common}{ +% +% +% english keywords (default) +% +\SetKwHangingKw{KwHData}{Data$\rightarrow$} +\SetKwInput{KwIn}{Input}% +\SetKwInput{KwOut}{Output}% +\SetKwInput{KwData}{Data}% +\SetKwInput{KwResult}{Result}% +\SetKw{KwTo}{to} +\SetKw{KwRet}{return}% +\SetKw{Return}{return}% +\SetKwBlock{Begin}{begin}{end}% +\SetKwRepeat{Repeat}{repeat}{until}% +% +\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{end switch}% +\SetKwFor{For}{for}{do}{end for}% +\SetKwFor{ForPar}{for}{do in parallel}{end forpar} +\SetKwFor{ForEach}{foreach}{do}{end foreach}% +\SetKwFor{ForAll}{forall}{do}{end forall}% +\SetKwFor{While}{while}{do}{end while}% +% +% French keywords +% +\ifthenelse{\boolean{algocf@localkw@french}\OR\equal{\algocf@languagechoosen}{french}}{% +%\SetKwInOut{AlgDonnees}{Donn\'ees}\SetKwInOut{AlgRes}{R\'esultat} +\SetKwHangingKw{HDonnees}{Donnees$\rightarrow$} +\SetKwInput{Donnees}{Donn\'ees}% +\SetKwInput{Res}{R\'esultat}% +\SetKwInput{Entree}{Entr\'ees}% +\SetKwInput{Sortie}{Sorties}% +\SetKw{KwA}{\`a}% +\SetKw{Retour}{retourner}% +\SetKwBlock{Deb}{d\'ebut}{fin}% +\SetKwRepeat{Repeter}{r\'ep\'eter}{jusqu'\`a}% +% +\SetKwIF{Si}{SinonSi}{Sinon}{si}{alors}{sinon si}{sinon}{fin si}% +\SetKwSwitch{Suivant}{Cas}{Autre}{suivant}{faire}{cas o\`u}{autres cas}{fin cas}{fin d'alternative}% +\SetKwFor{Pour}{pour}{faire}{fin pour}% +\SetKwFor{PourPar}{pour}{faire en parall\`ele}{fin pour}% +\SetKwFor{PourCh}{pour chaque}{faire}{fin pour chaque}% +\SetKwFor{PourTous}{pour tous les}{faire}{fin pour tous}% +\SetKwFor{Tq}{tant que}{faire}{fin tq}% +}{}% +% +% --- German keywords +% +\ifthenelse{\boolean{algocf@localkw@german}\OR\equal{\algocf@languagechoosen}{german}}{% +\SetKwInput{Ein}{Eingabe}%KwIn +\SetKwInput{Aus}{Ausgabe}%KwOut +\SetKwInput{Daten}{Daten}%KwData +\SetKwInput{Ergebnis}{Ergebnis}%KwResult +\SetKw{Bis}{bis}%KwTo +\SetKw{KwZurueck}{zur\"uck}%KwRet +\SetKw{Zurueck}{zur\"uck}%Return +\SetKwBlock{Beginn}{Beginn}{Ende}%Begin +\SetKwRepeat{Wiederh}{wiederhole}{bis}%Repeat +% +\SetKwIF{Wenn}{SonstWenn}{Sonst}{wenn}{dann}{sonst wenn}{sonst}{Ende wenn}%gIf +\SetKwSwitch{Unterscheide}{Fall}{Anderes}{unterscheide}{tue}{Fall}{sonst}{Ende Fall}{Ende Unt.}%Switch +\SetKwFor{Fuer}{f\"ur}{tue}{Ende f\"ur}%For +\SetKwFor{FuerPar}{f\"ur}{tue gleichzeitig}{Ende gleichzeitig}%ForPar +\SetKwFor{FuerJedes}{f\"ur jedes}{tue}{Ende f\"ur}%ForEach +\SetKwFor{FuerAlle}{f\"ur alle}{tue}{Ende f\"ur}%ForAll +\SetKwFor{Solange}{solange}{tue}{Ende solange}%While +}{}% +% +% --- Czech keywords +% +\ifthenelse{\boolean{algocf@localkw@czech}\OR\equal{\algocf@languagechoosen}{czech}}{% +\SetKwInput{Vst}{Vstup}% +\SetKwInput{Vyst}{V\'{y}stup}% +\SetKwInput{Vysl}{V\'{y}sledek}% +}{}% +% +% --- Portuguese keywords +% +\ifthenelse{\boolean{algocf@localkw@portuguese}\OR\equal{\algocf@languagechoosen}{portuguese}}{% +\SetKwInput{Entrada}{Entrada}% +\SetKwInput{Saida}{Sa\'{i}da}% +\SetKwInput{Dados}{Dados}% +\SetKwInput{Resultado}{Resultado}% +\SetKw{Ate}{at\'{e}} +\SetKw{KwRetorna}{retorna}% +\SetKw{Retorna}{retorna}% +\SetKwBlock{Inicio}{in\'{i}cio}{fim}% +\SetKwRepeat{Repita}{repita}{at\'{e}}% +% +\SetKwIF{Se}{SenaoSe}{Senao}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}% +\SetKwSwitch{Selec}{Caso}{Outro}{selecione}{fa\c{c}a}{caso}{sen\~{a}o}{fim caso}{fim selec}% +\SetKwFor{Para}{para}{fa\c{c}a}{fim para}% +\SetKwFor{ParaPar}{para}{fa\c{c}a em paralelo}{fim para} +\SetKwFor{ParaCada}{para cada}{fa\c{c}a}{fim para cada}% +\SetKwFor{ParaTodo}{para todo}{fa\c{c}a}{fim para todo}% +\SetKwFor{Enqto}{enquanto}{fa\c{c}a}{fim enqto}% +}{}% +% +% --- Italian keywords +% +\ifthenelse{\boolean{algocf@localkw@italiano}\OR\equal{\algocf@languagechoosen}{italiano}}{% +\SetKwInput{KwIng}{Ingresso}% +\SetKwInput{KwUsc}{Uscita}% +\SetKwInput{KwDati}{Dati}% +\SetKwInput{KwRisult}{Risultato}% +\SetKw{KwA}{a}% +\SetKw{KwRitorna}{ritorna}% +\SetKw{Ritorna}{ritorna}% +\SetKwBlock{Inizio}{inizio}{fine}% +\SetKwRepeat{Ripeti}{ripeti}{finch\'e}% +% +\SetKwIF{Sea}{AltSe}{Altrimenti}{se}{allora}{altrimenti se}{allora}{fine se}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{endsw}% +\SetKwFor{Per}{per}{fai}{fine per}% +\SetKwFor{PerPar}{per}{fai in parallelo}{fine per}% +\SetKwFor{PerCiascun}{per ciascun}{fai}{fine per ciascun}% +\SetKwFor{PerTutti}{per tutti i}{fai}{fine per tutti}% +\SetKwFor{Finche}{finch\'e}{fai}{fine finch\'e}% +}{}% +% +% --- Spanish keywords +% +\ifthenelse{\boolean{algocf@localkw@spanish}\OR\equal{\algocf@languagechoosen}{spanish}}{% +\SetKwInput{Datos}{Datos} +\SetKwInput{Resultado}{Resultado} +\SetKwInput{Entrada}{Entrada} +\SetKwInput{Salida}{Salida} +\SetKw{KwA}{a} +\SetKw{KwDevolver}{devolver} +\SetKw{Devolver}{devolver} +\SetKwBlock{Inicio}{inicio}{fin} +\SetKwIF{SSi}{EnOtroCasoSi}{EnOtroCaso}{si}{entonces}{sin\'o, si}{sin\'o}{fin si} +\SetKwSwitch{Seleccionar}{Caso}{Otro}{seleccionar}{hacer}{caso}{sin\'o}{fin caso}{fin seleccionar} +\SetKwFor{Para}{para}{hacer}{fin para} +\SetKwFor{ParaPara}{par}{hacer en paralelo}{fin para} +\SetKwFor{EnParalelo}{para}{hacer en paralelo}{fin para} +\SetKwFor{Mientras}{mientras}{hacer}{fin mientras} +\SetKwFor{ParaCada}{para cada}{hacer}{fin para cada} +\SetKwFor{ParaTodo}{para todo}{hacer}{fin para todo} +\SetKwRepeat{Repetir}{repetir}{hasta que} +}{}% +% +% Croatian keywords +% +\ifthenelse{\boolean{algocf@localkw@croatian}\OR\equal{\algocf@languagechoosen}{croatian}}{% +\SetKwInput{KwUlaz}{Ulaz}%KwIn +\SetKwInput{KwIzlaz}{Izlaz}%KwOut +\SetKwInput{KwPodaci}{Podaci}%KwData +\SetKwInput{KwRezultat}{Rezultat}%KwResult +\SetKw{KwDo}{do}%KwTo +\SetKw{KwVrati}{vrati}%KwRet +\SetKw{Vrati}{vrati}%Return +\SetKwBlock{Pocetak}{po\v{c}etak}{kraj}%Begin +\SetKwRepeat{Ponavljaj}{ponavljaj}{dok ne bude}%Repeat +% +\SetKwIF{Ako}{InaceAko}{Inace}{ako}{onda}{ina\v{c}e ako}{ina\v{c}e}{kraj ako}%gIf +\SetKwSwitch{Granaj}{Slucaj}{OstaliSlucajevi}{granaj}{\v{c}ini}{slu\v{c}aj}{ostali slu\v{c}ajevi}{kraj slu\v{c}aj}{kraj granaj}%Switch +\SetKwFor{Za}{za}{\v{c}ini}{kraj za}%For +\SetKwFor{ZaPar}{za}{\v{c}ini paralelno}{kraj za paralelno}%ForPar +\SetKwFor{ZaSvaki}{za svaki}{\v{c}ini}{kraj za svaki}%mForEach +\SetKwFor{ZaSvaku}{za svaku}{\v{c}ini}{kraj za svaku}%fForEach +\SetKwFor{ZaSvako}{za svako}{\v{c}ini}{kraj za svako}%nForEach +\SetKwFor{ZaSve}{za sve}{\v{c}ini}{kraj za sve}%ForAll +\SetKwFor{Dok}{dok}{\v{c}ini}{kraj dok}%While +}{}% + +% +% --- Turkish keywords +% +\ifthenelse{\boolean{algocf@localkw@turkish}\OR\equal{\algocf@languagechoosen}{turkish}}{% +\SetKwInput{KwIn}{Girdi}% +\SetKwInput{KwOut}{\c{C}{\i}kt{\i}}% +\SetKwInput{KwData}{Veri}% +\SetKwInput{KwResult}{Sonu\c{c}}% +\SetKw{KwTo}{to} +\SetKw{KwRet}{return}% +\SetKw{Return}{return}% +\SetKwBlock{Begin}{begin}{end}% +\SetKwRepeat{Repeat}{repeat}{until}% +% % +\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{end switch}% +\SetKwFor{For}{for}{do}{end for}% +\SetKwFor{ForPar}{for}{do in parallel}{end forpar} +\SetKwFor{ForEach}{foreach}{do}{end foreach}% +\SetKwFor{ForAll}{forall}{do}{end forall}% +\SetKwFor{While}{while}{do}{end while}% +}{}% +% +% --- End +%} +% +%\algocf@defaults@common +% +% option onelanguage redefinition +% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{french}}{% +\SetKwInput{KwIn}{Entr\'ees}% +\SetKwInput{KwOutSortie}{Sorties}% +\SetKwInput{KwData}{Donn\'ees}% +\SetKwInput{KwResult}{R\'esultat}% +\SetKw{KwTo}{\`a}% +\SetKw{KwRet}{retourner}% +\SetKw{Return}{retourner}% +\SetKwBlock{Begin}{d\'ebut}{fin}% +\SetKwRepeat{Repeat}{r\'ep\'eter}{jusqu'\`a}% +% +\SetKwIF{If}{ElseIf}{Else}{si}{alors}{sinon si}{sinon}{fin si}% +\SetKwSwitch{Switch}{Case}{Other}{suivant}{faire}{cas o\`u}{autres cas}{fin cas}{fin d'alternative}% +\SetKwFor{For}{pour}{faire}{fin pour}% +\SetKwFor{ForPar}{pour}{faire en parall\`ele}{fin pour}% +\SetKwFor{ForEach}{pour chaque}{faire}{fin pour chaque}% +\SetKwFor{ForAll}{pour tous}{faire}{fin pour tous}% +\SetKwFor{While}{tant que}{faire}{fin tq}% +}{}% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{german}}{% +\SetKwInput{KwIn}{Eingabe}%KwIn +\SetKwInput{KwOut}{Ausgabe}%KwOut +\SetKwInput{KwData}{Daten}%KwData +\SetKwInput{KwResult}{Ergebnis}%KwResult +\SetKw{KwTo}{bis}%KwTo +\SetKw{KwRet}{zur\"uck}%KwRet +\SetKw{Return}{zur\"uck}%Return +\SetKwBlock{Begin}{Beginn}{Ende}%Begin +\SetKwRepeat{Repeat}{wiederhole}{bis}%Repeat +% +\SetKwIF{If}{ElseIf}{Else}{wenn}{dann}{sonst wenn}{sonst}{Ende wenn}%gIf +\SetKwSwitch{Switch}{Case}{Other}{unterscheide}{tue}{Fall}{sonst}{Ende Fall}{Ende Unt.}%Switch +\SetKwFor{For}{f\"ur}{tue}{Ende f\"ur}%For +\SetKwFor{ForPar}{f\"ur}{tue gleichzeitig}{Ende gleichzeitig}%ForPar +\SetKwFor{ForEach}{f\"ur jedes}{tue}{Ende f\"ur}%ForEach +\SetKwFor{ForAll}{f\"ur alle}{tue}{Ende f\"ur}%ForAll +\SetKwFor{While}{solange}{tue}{Ende solange}%While +}{}% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{portuguese}}{% +\SetKwInput{KwIn}{Entrada}% +\SetKwInput{KwOut}{Sa\'{i}da}% +\SetKwInput{KwData}{Dados}% +\SetKwInput{KwResult}{Resultado}% +\SetKw{KwTo}{at\'{e}} +\SetKw{KwRet}{retorna}% +\SetKw{Return}{retorna}% +\SetKwBlock{Begin}{in\'{i}cio}{fim}% +\SetKwRepeat{Repeat}{repita}{at\'{e}}% +% +\SetKwIF{If}{ElseIf}{Else}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}% +\SetKwSwitch{Switch}{Case}{Other}{selecione}{fa\c{c}a}{caso}{sen\~{a}o}{fim caso}{fim selec}% +\SetKwFor{For}{para}{fa\c{c}a}{fim para}% +\SetKwFor{ForPar}{para}{fa\c{c}a em paralelo}{fim para} +\SetKwFor{ForEach}{para cada}{fa\c{c}a}{fim para cada}% +\SetKwFor{ForAll}{para todo}{fa\c{c}a}{fim para todo}% +\SetKwFor{While}{enquanto}{fa\c{c}a}{fim enqto}% +}{}% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{italiano}}{% +\SetKwInput{KwIn}{Ingresso}% +\SetKwInput{KwOut}{Uscita}% +\SetKwInput{KwData}{Dati}% +\SetKwInput{KwResult}{Risultato}% +\SetKw{KwTo}{a}% +\SetKw{KwRet}{ritorna}% +\SetKw{Return}{ritorna}% +\SetKwBlock{Begin}{inizio}{fine}% +\SetKwRepeat{Repeat}{ripeti}{finch\'e}% +% +\SetKwIF{If}{ElseIf}{Else}{se}{allora}{altrimenti se}{allora}{fine se}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end case}{endsw}% +\SetKwFor{For}{per}{fai}{fine per}% +\SetKwFor{ForPar}{per}{fai in parallelo}{fine per}% +\SetKwFor{ForEach}{per ciascun}{fai}{fine per ciascun}% +\SetKwFor{ForAll}{per tutti i}{fai}{fine per tutti}% +\SetKwFor{While}{finch\'e}{fai}{fine finch\'e}% +}{}% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{spanish}}{% +\SetKwInput{KwIn}{Entrada}% +\SetKwInput{KwOut}{Salida}% +\SetKwInput{KwData}{Datos}% +\SetKwInput{KwResult}{Resultado}% +\SetKw{KwTo}{a}% +\SetKw{KwRet}{devolver}% +\SetKw{Return}{devolver}% +\SetKwBlock{Begin}{inicio}{fin}% +\SetKwRepeat{Repeat}{repetir}{hasta que}% +% +\SetKwIF{If}{ElseIf}{Else}{si}{entonces}{si no, si}{en otro caso}{fin si} +\SetKwSwitch{Switch}{Case}{Other}{seleccionar}{hacer}{caso}{si no}{fin caso}{fin seleccionar} +\SetKwFor{For}{para}{hacer}{fin para}% +\SetKwFor{ForPar}{para}{hacer in paralelo}{fin para}% +\SetKwFor{ForEach}{para cada}{hacer}{fin para cada} +\SetKwFor{ForAll}{para todo}{hacer}{fin para todo} +\SetKwFor{While}{mientras}{hacer}{fin mientras} +}{}% +% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{croatian}}{% +\SetKwInput{KwIn}{Ulaz}%KwIn +\SetKwInput{KwOut}{Izlaz}%KwOut +\SetKwInput{KwData}{Podaci}%KwData +\SetKwInput{KwResult}{Rezultat}%KwResult +\SetKw{KwTo}{do}%KwTo +\SetKw{KwRet}{vrati}%KwRet +\SetKw{Return}{vrati}%Return +\SetKwBlock{Begin}{po\v{c}etak}{kraj}%Begin +\SetKwRepeat{Repeat}{ponavljaj}{dok ne bude}%Repeat +% +\SetKwIF{If}{ElseIf}{Else}{ako}{onda}{ina\v{c}e ako}{ina\v{c}e}{kraj ako}%gIf +\SetKwSwitch{Switch}{Case}{Other}{granaj}{\v{c}ini}{slu\v{c}aj}{ostali slu\v{c}ajevi}{kraj slu\v{c}aj}{kraj granaj}%Switch +\SetKwFor{For}{za}{\v{c}ini}{kraj za}%For +\SetKwFor{ForPar}{za}{\v{c}ini paralelno}{kraj za paralelno}%ForPar +\SetKwFor{ForEach}{za svaki}{\v{c}ini}{kraj za svaki}%ForEach +\SetKwFor{ForAll}{za sve}{\v{c}ini}{kraj za sve}%ForAll +\SetKwFor{While}{dok}{\v{c}ini}{kraj dok}%While +}{}% +% +\ifthenelse{\boolean{algocf@optonelanguage}\AND\equal{\algocf@languagechoosen}{turkish}}{% +% +\SetKwInput{KwIn}{Girdi}% +\SetKwInput{KwOut}{\c{C}{\i}kt{\i}}% +\SetKwInput{KwData}{Veri}% +\SetKwInput{KwResult}{Sonu\c{c}}% +\SetKw{KwTo}{to} +\SetKw{KwRet}{return}% +\SetKw{Return}{return}% +\SetKwBlock{Begin}{begin}{end}% +\SetKwRepeat{Repeat}{repeat}{until}% +% +\SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}% +\SetKwSwitch{Switch}{Case}{Other}{switch}{do}{case}{otherwise}{end switch}% +\SetKwFor{For}{for}{do}{end for}% +\SetKwFor{ForPar}{for}{do in parallel}{end forpar} +\SetKwFor{ForEach}{foreach}{do}{end foreach}% +\SetKwFor{ForAll}{forall}{do}{end forall}% +\SetKwFor{While}{while}{do}{end while}% +}{}% +% +% +%%%% old commands compatibility +% +\ifthenelse{\boolean{algocf@oldcommands}}{% +\newcommand{\SetNoLine}{\SetAlgoNoLine}% +\newcommand{\SetNoline}{\SetAlgoNoLine}% +\newcommand{\SetVline}{\SetAlgoVlined}% +\newcommand{\SetLine}{\SetAlgoLined}% +% +\newcommand{\dontprintsemicolon}{\DontPrintSemicolon}% +\newcommand{\printsemicolon}{\PrintSemicolon}% +\newcommand{\incmargin}[1]{\IncMargin{#1}}% +\newcommand{\decmargin}[1]{\DecMargin{-#1}}% +\newcommand{\setnlskip}[1]{\SetNlSkip{#1}}% +\newcommand{\Setnlskip}[1]{\SetNlSkip{#1}}% +\newcommand{\setalcapskip}[1]{\SetAlCapSkip{#1}}% +\newcommand{\setalcaphskip}[1]{\SetAlCapHSkip{#1}}% +\newcommand{\nlSty}[1]{\NlSty{#1}}% +\newcommand{\Setnlsty}[3]{\SetNlSty{#1}{#2}{#3}}% +\newcommand{\linesnumbered}{\LinesNumbered}% +\newcommand{\linesnotnumbered}{\LinesNotNumbered}% +\newcommand{\linesnumberedhidden}{\LinesNumberedHidden}% +\newcommand{\showln}{\ShowLn}% +\newcommand{\showlnlabel}[1]{\ShowLnLabel{#1}}% +\newcommand{\nocaptionofalgo}{\NoCaptionOfAlgo}% +\newcommand{\restorecaptionofalgo}{\RestoreCaptionOfAlgo}% +\newcommand{\restylealgo}[1]{\RestyleAlgo{#1}}% +% +\newcommand{\Titleofalgo}[1]{\TitleOfAlgo{#1}}% +% \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{endif} +\newcommand{\SetKwIf}[6]{\SetKwIF{#1}{#2#1}{#2}{#3}{#4}{#5 #1}{#5}{#6}} +% +\SetKwIF{gSi}{gSinonSi}{gSinon}{si}{alors}{sinon si}{sinon}{fin si}% +\SetKwIF{gIf}{gElsIf}{gElse}{if}{then}{else if}{else}{end if}% +\SetKwIF{gIf}{gElseIf}{gElse}{if}{then}{else if}{else}{end if}% +\SetKwIF{gWenn}{gSonstWenn}{gSonst}{wenn}{dann}{sonst wenn}{sonst}{Ende wenn}%gIf +\SetKwIF{gSe}{gSenaoSe}{gSenao}{se}{ent\~{a}o}{sen\~{a}o se}{sen\~{a}o}{fim se}% +\SetKwIF{gSea}{gAltSe}{gAltrimenti}{se}{allora}{altrimenti se}{allora}{fine se}% +\SetKw{Ret}{return}% +\SetKwInput{Data}{Data}% +\SetKwInput{Result}{Result}% +}{% + \relax% +}% +% +% +% +%% +%%% +%%%% END \ No newline at end of file diff --git a/algorithme.sty b/algorithme.sty new file mode 100644 index 0000000..7eb59ca --- /dev/null +++ b/algorithme.sty @@ -0,0 +1,420 @@ +%%%%%% ************** line 192 + + +%%-------------------------------------------------------------------------------------------------------------- +%% ALGORITHME 1.1 +%%-------------------------------------------------------------------------------------------------------------- +%% Quoi de neuf depuis Algorithm 1.0 / What's new since Algorithm 1.0 +%% +%% Meilleure boîte de cadrage +%% Meilleure gestion des largeurs, permettant l'utilisation du mode multicolonnes, et permettant la césure +%% automatique des longues lignes de pseudo-instructions. +%% Widths are better handled, allowing the use of multicolumn mode, and also allowing auto line splitting into +%% long lines of pseudo-code. +%%-------------------------------------------------------------------------------------------------------------- +%% +%% Copyleft Pierre Chatelier +%% e-mail: pierre.chatelier@club-internet.fr +%% page perso: http://perso.club-internet.fr/ktd +%% +%%Un package pour ecrire du code algorithmique +%%Il propose, dans l'environnement "algorithme", d'utiliser +%% -Des remarques, pour commenter le code ( \Rem{Remarque} ) +%% -Des blocs, pour indenter le code ( \Block{code} ) +%% -Des boucles "Tant Que...faire...Fait" ( \While{condition}{code} ) +%% -Des boucles "Repeter...jusqu'a" ( \Repeat{code}{condition} ou \RepeatUntil{}{} ) +%% -Des boucles "Pour...de...a...faire...Fin Pour" ( \ForFromTo{variable}{valeur début}{valeur fin}{code} ) +%% -Des boucles "Pour...faire...Fin Pour" ( \For{controle de boucle}{code} ) +%% -Des Si...Alors...Fin Si ( \If{condition}{code} ou \IfThen{condition}{code} ) +%% -Des Si...Alors...Sinon...Fin Si ( \IfThenElse{condition}{code de alors}{code de sinon} ) +%% -Des Selon que ... Fin Selon que ( \Switch{code} ) +%% -Des fonctions ( \Function{parametres}{type de retour}{code} ) +%% -Des procédures ( \Procedure{parametres}{code} ) +%% -Une instruction de declaration de type ( \Type{nom ou liste de variable}{nom de type} ) +%% -Quelques mots-clefs d'usage courant : \True, \False, \And, \Or et \Not +%% Les versions étoilées des commandes (\WhileDo*{}, \IfThen*{}, ... ; toutes sauf \Rem, \Block \Switch, +%% \Function et \Procedure) font tout sur la meme ligne +%% +%% Une table des algorithmes est disponible via \listofalgorithms. +%% Pour introduire un algorithme dans cette table, il faut taper la commande "\caption{texte...}" dans un +%% environnemment "algorithme" +%% +%% On peut passer une option au package : [french] ou [english] pour la langue des mots-clef +%% +%%--------------------------------------------------------------------------------------------------------------- +%%This is a package to write some algorithms. +%%It provides, within an "algorithm" environment, to use +%% -Comments ( \Rem{text} ) +%% -Blocks, to indent code ( \Block{text} ) +%% -While ... do ... done ( \While{condition}{code} ) +%% -Repeat ... until ( \Repeat{code}{condition} or \RepeatUntil{}{} ) +%% -Repeat ... until ( \RepeatUntil{code}{condition} ) +%% -For...from...to...do...done ( \ForFromTo{variable}{initial value}{final value}{code} ) +%% -For...do...done ( \For{loop control}{code} ) +%% -If...then...end if ( \If{condition}{code} or \IfThen{condition}{code} ) +%% -If...then...else...end if ( \IfThenElse{condition}{then code}{else code} ) +%% -Switch ( \Switch{code} ) +%% -Function ( \Function{parameters}{return type}{code} ) +%% -Procedure ( \Procedure{parametres}{code} ) +%% -A type declaration instruction ( \Type{name or list of variables}{type name} ) +%% -Some useful keywords: \True, \False, \And, \Or and \Not. +%% Most of these commands have a star-form (\WhileDo*{}, \IfThen*{}, ... ; all but \Rem, \Block \Switch +%% \Function and \Procedure). These star-forms are single-lined. +%% +%% A list of algorithms is provided through \listofalgorithms. +%% To add an entry in this table, the matching algorithm must have a caption, thanks to "\caption{text}". +%% +%% You can specifiy an option to the package : [french] ou [english] for the language of the keywords. +%% +%%--------------------------------------------------------------------------------------------------------------- + + +%%-----------------------------------------------------------------%% +%%---------------------- Identification ---------------------------%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{algorithme} %Nom de la classe / Class name +%%-----------------------------------------------------------------%% +%% +%% +%%-----------------------------------------------------------------%% +%%------------------------ Inclusions -----------------------------%% +\RequirePackage{float, ifthen, calc} +%% +%% +%%-----------------------------------------------------------------%% +%%------------------------ Langage/Language -----------------------%% + +%% Changer le langage dans le contexte de babel /Change langage according to babel +\@ifpackageloaded{babel} +{ + %\iflanguage{french}{\def\alg@language{french}}{} + \iflanguage{english}{\def\alg@language{english}}{} + \iflanguage{american}{\def\alg@language{english}}{} +} +{ + % \def\alg@language{french} %Langage par defaut / Default language +} + +%% Tenir compte de l'option specifiee explicitement / Handle explicit langage option +%\DeclareOption{french}{\def\alg@language{french}} +\DeclareOption{english}{\def\alg@language{english}} +\DeclareOption{american}{\def\alg@language{english}} +\ProcessOptions\relax + + +%% Declaration des commandes / Commands declaration +\ifthenelse{\equal{\alg@language}{french}} +{ + \def\alg@floatname{Algorithme} + \def\alg@listname{Liste des Algorithmes} + + \newcommand{\@TRUE}{\textbf{vrai}}% + \newcommand{\@FALSE}{\textbf{faux}}% + \newcommand{\@AND}{\textbf{ET }}% + \newcommand{\@OR}{\textbf{OU }}% + \newcommand{\@NOT}{\textbf{$\neg$}}% + + \newcommand{\@WHILE}{\textbf{Tant que }}% + \newcommand{\@DO}{\textbf{faire }}% + \newcommand{\@ENDWHILE}{\textbf{Fait}}% + + \newcommand{\@REPEAT}{\textbf{R\'ep\'eter }}% + \newcommand{\@UNTIL}{\textbf{jusqu'\`a ce que }}% + + \newcommand{\@FOR}{\textbf{Pour }}% + \newcommand{\@FROM}{\textbf{de }}% + \newcommand{\@TO}{\textbf{\`a }}% + \newcommand{\@ENDFOR}{\textbf{Fin Pour}}% + + \newcommand{\@IF}{\textbf{Si }}% + \newcommand{\@THEN}{\textbf{Alors }}% + \newcommand{\@ELSE}{\textbf{Sinon }}% + \newcommand{\@ENDIF}{\textbf{Fin Si}}% + + \newcommand{\@SWITCH}{\textbf{Selon que }}% + \newcommand{\@ENDSWITCH}{\textbf{Fin Selon que}}% + + \newcommand{\@FUNCTION}{\textbf{Fonction }}% + \newcommand{\@RETURN}{\textbf{Retourner }}% + \newcommand{\@ENDFUNCTION}{\textbf{Fin}}% + + \newcommand{\@PROCEDURE}{\textbf{Proc\'edure }}% + \newcommand{\@ENDPROCEDURE}{\textbf{Fin}}% +}{} +\ifthenelse{\equal{\alg@language}{english}} +{ + \def\alg@floatname{Algorithm} + \def\alg@listname{List of Algorithms} + + \newcommand{\@TRUE}{\textbf{true}}% + \newcommand{\@FALSE}{\textbf{false}}% + \newcommand{\@AND}{\textbf{AND }}% + \newcommand{\@OR}{\textbf{OR }}% + \newcommand{\@NOT}{\textbf{$\neg$}}% + + \newcommand{\@WHILE}{\textbf{While }}% + \newcommand{\@DO}{\textbf{do }}% + \newcommand{\@ENDWHILE}{\textbf{done}}% + + \newcommand{\@REPEAT}{\textbf{Repeat }}% + \newcommand{\@UNTIL}{\textbf{until }}% + + \newcommand{\@FOR}{\textbf{For }}% + \newcommand{\@FROM}{\textbf{from }}% + \newcommand{\@TO}{\textbf{to }}% + \newcommand{\@ENDFOR}{\textbf{end For}}% + + \newcommand{\@IF}{\textbf{If }}% + \newcommand{\@THEN}{\textbf{then }}% + \newcommand{\@ELSE}{\textbf{else }}% + \newcommand{\@ENDIF}{\textbf{end If}}% + + \newcommand{\@SWITCH}{\textbf{Switch }}% + \newcommand{\@ENDSWITCH}{\textbf{end Switch}}% + + \newcommand{\@FUNCTION}{\textbf{Function }}% + \newcommand{\@RETURN}{\textbf{return }}% + \newcommand{\@ENDFUNCTION}{\textbf{End}}% + + \newcommand{\@PROCEDURE}{\textbf{Procedure }}% + \newcommand{\@ENDPROCEDURE}{\textbf{End}}% +}{} + +%% +%% +%%-----------------------------------------------------------------%% +%%----------------------- Commandes/Commands ----------------------%% + +%% Adequation au package "float" / Match "float" package +\newcommand\floatc@alg[2]{\begin{center}{\bfseries\rmfamily #1:} #2\end{center}} +\newcommand\fs@alg{ + \let\@fs@capt\floatc@alg + \def\@fs@pre{}\def\@fs@post{}\def\@fs@mid{\vspace{3pt}} + \let\@fs@iftopcapt\iftrue} +\newfloat{algorithmfloat}{h}{loa} +\floatname{algorithmfloat}{\alg@floatname} +%\newcommand{\listofalgorithms}{\listof{algorithmfloat}{\alg@listname}} +\newlength{\alglength} + +%% Les commandes disponibles / Provided commands +\newenvironment{algorithme}[1][H] +{ + \setlength{\alglength}{.95\linewidth} + \begin{algorithmfloat}[#1] + + %%Rem{texte} : ecrit une remarque + %%Rem{text} : puts a comment + \newcommand{\@Rem}[1]{\begin{minipage}[t]{\alglength} + \emph{[##1]} + \vspace*{.5ex} + \end{minipage} + }% + + %%Bloc{code} : Encapsule quelques lignes / encapsulate some lines + \newcommand{\@Block}[1]{\begin{minipage}[t]{\alglength} + ##1 + \vspace*{.5ex} + \end{minipage} + }% + + %%WhileDo{condition}{code} + \newcommand{\@WhileDo}[2]{\begin{minipage}[t]{\alglength} + \@WHILE (##1) \@DO \\ + \hspace*{1em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##2\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDWHILE% + \vspace*{.5ex} + \end{minipage} + }% + %%WhileDo{condition}{code} sur une seule ligne / on a single line + \newcommand{\@ShortWhileDo}[2]{\begin{minipage}[t]{\alglength} + \@WHILE (##1) \@DO ##2 \@ENDWHILE + \vspace*{.5ex} + \end{minipage} + }% + + %%RepeatUntil{code}{condition} + \newcommand{\@RepeatUntil}[2]{\begin{minipage}[t]{\alglength} + \@REPEAT \\ + \hspace*{1em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##1\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@UNTIL (##2)% + \vspace*{.5ex} + \end{minipage} + }% + %%RepeatUntil{code}{condition} sur une seule ligne / on a single line + \newcommand{\@ShortRepeatUntil}[2]{\begin{minipage}[t]{\alglength} + \@REPEAT ##1 \@UNTIL (##2)% + \vspace*{.5ex} + \end{minipage} + }% + + %%ForFromToDo{variable}{valeur initiale}{valeur finale}{code} + %%ForFromToDo{variable}{initial value}{final value}{code} + \newcommand{\@ForFromToDo}[4]{\begin{minipage}[t]{\alglength} + \@FOR ##1 \@FROM ##2 \@TO ##3 \@DO \\ + \hspace*{.3em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##4\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDFOR% + \vspace*{.5ex} + \end{minipage} + }% + %%ForFromToDo{variable}{valeur initiale}{valeur finale}{code} sur une seule ligne + %%ForFromToDo{variable}{initial value}{final value}{code} on a single line + \newcommand{\@ShortForFromToDo}[4]{\begin{minipage}[t]{\alglength} + \@FOR ##1 \@FROM ##2 \@TO ##3 \@DO ##4 \@ENDFOR% + \vspace*{.5ex} + \end{minipage} + }% + + %%For{controle de boucle style C}{code} + %%For{C-like loop control}{code} + \newcommand{\@ForDo}[2]{\begin{minipage}[t]{\alglength} + \@FOR ##1 \@DO \vspace*{.5ex}\\ + \hspace*{.3em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##2\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDFOR% + \vspace*{.5ex} + \end{minipage} + }% + %%For{controle de boucle style C}{code} sur une seule ligne + %%For{C-like loop control}{code} on a single line + \newcommand{\@ShortForDo}[2]{\begin{minipage}[t]{\alglength} + \@FOR ##1 \@DO ##2 \@ENDFOR% + \vspace*{.5ex} + \end{minipage} + }% + + %%IfThen{condition}{code} + \newcommand{\@IfThen}[2]{\begin{minipage}[t]{\alglength} + \@IF (##1) \@THEN \\ + \hspace*{.5em} + \addtolength{\alglength}{-1.5em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##2\\ \end{tabular}% + \addtolength{\alglength}{1.5em+\tabcolsep+\arrayrulewidth} + \\ \@ENDIF% + \vspace*{.5ex} + \end{minipage} + }% + %%IfThen{condition}{code} sur une seule ligne / on a single line + \newcommand{\@ShortIfThen}[2]{\begin{minipage}[t]{\alglength} + \@IF (##1) \@THEN ##2 \@ENDIF% + \vspace*{.5ex} + \end{minipage} + }% + + %%IfThenElse{condition}{code du then}{code du else} NE PAS CONFONDRE avec le \ifthenelse de LaTeX + %%IfThenElse{condition}{then-code}{else-code} DO NOT CONFUSE with \ifthenelse from LaTeX + \newcommand{\@IfThenElse}[3]{\begin{minipage}[t]{\alglength} + \@IF (##1) \@THEN \\ + \hspace*{.5em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##2\\ \end{tabular}% + \\ \@ELSE\\ + \hspace*{.5em} + \begin{tabular}{|p{\alglength}} ##3\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDIF% + \vspace*{.5ex} + \end{minipage} + }% + %%IfThenElse{condition}{code du then}{code du else} sur une seule ligne + %%IfThenElse{condition}{then-code}{else-code} on a single line + \newcommand{\@ShortIfThenElse}[3]{\begin{minipage}[t]{\alglength} + \@IF (##1) \@THEN ##2 \@ELSE ##3 \@ENDIF% + \vspace*{.5ex} + \end{minipage} + }% + + %%Switch{code} (C'est le selon que) + \newcommand{\@Switch}[1]{\begin{minipage}[t]{\alglength} + \@SWITCH \\ + \hspace*{1em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##1\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDSWITCH% + \vspace*{.5ex} + \end{minipage} + }% + + %%Function{parametres}{type de retour}{code} + %%Function{parameters}{return type}{code} + \newcommand{\@Function}[4]{\begin{minipage}[t]{\alglength} + \@FUNCTION ##1(##2) : \textbf{##3}\\ + \hspace*{1em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##4\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDFUNCTION% + \vspace*{.5ex} + \end{minipage} + }% + + %%Procedure{parametres}{code} + %%Procedure{parameters}{code} + \newcommand{\@Procedure}[3]{\begin{minipage}[t]{\alglength} + \@PROCEDURE ##1(##2)\\ + \hspace*{1em} + \addtolength{\alglength}{-2em-\tabcolsep-\arrayrulewidth} + \begin{tabular}{|p{\alglength}} ##3\\ \end{tabular}% + \addtolength{\alglength}{2em+\tabcolsep+\arrayrulewidth} + \\ \@ENDPROCEDURE% + \vspace*{.5ex} + \end{minipage} + }% + + %%Type{nom ou liste de variable}{nom de type} + %%Type{name or list of variables}{type name} + \newcommand{\@Type}[2]{##1 : \textbf{##2}} + + %%Definition des macro-commandes pratiques pour l'utilisateur. + %%La forme etoilee de certaines commandes est un alias de leur version courte (sur une seule ligne) + %%Definition of macro-commands useful for the user. + %%The star-from of some commands is an alias towards ther short form (on a single line) + \def\True{ \@TRUE}% + \def\False{ \@FALSE}% + \def\And{ \@AND}% + \def\Or{ \@OR}% + \def\Not{ \@NOT}% + \def\Rem{ \@Rem} + \def\Block{ \@Block} + \def\While{ \@ifstar{\@ShortWhileDo} {\@WhileDo}} + \def\WhileDo{ \@ifstar{\@ShortWhileDo} {\@WhileDo}} + \def\Repeat{ \@ifstar{\@ShortRepeatUntil} {\@RepeatUntil}} + \def\RepeatUntil{\@ifstar{\@ShortRepeatUntil} {\@RepeatUntil}} + \def\ForFromTo{ \@ifstar{\@ShortForFromToDo} {\@ForFromToDo}} + \def\ForFromToDo{\@ifstar{\@ShortForFromToDo} {\@ForFromToDo}} + \def\ForDo{ \@ifstar{\@ShortForDo} {\@ForDo}} + \def\For{ \@ifstar{\@ShortForDo} {\@ForDo}} + \def\If{ \@ifstar{\@ShortIfThen} {\@IfThen}} + \def\IfThen{ \@ifstar{\@ShortIfThen} {\@IfThen}} + \def\IfThenElse{ \@ifstar{\@ShortIfThenElse} {\@IfThenElse}} + \def\Switch{ \@ifstar{\@Switch} {\@Switch}} + \def\Function{ \@ifstar{\@Function} {\@Function}} + \def\Return{ \@RETURN} + \def\Procedure{ \@ifstar{\@Procedure} {\@Procedure}} + \def\Type{ \@Type} + + \begin{minipage}[t]{\alglength} + \begin{center}\begin{tabular}{|c|}\hline\\ + \hspace*{.5em} + \begin{minipage}[t]{\alglength} +} +%% Fin de l'environnement "algorithme" / end of "algorithme" environnment +{ + \end{minipage}\hspace*{.5em} + \\\\\hline\end{tabular}\end{center} + \end{minipage} + \end{algorithmfloat} +} + +%% ----------------------------- FIN / END --------------------------------------- diff --git a/algorithmic.sty b/algorithmic.sty new file mode 100644 index 0000000..26b53f6 --- /dev/null +++ b/algorithmic.sty @@ -0,0 +1,188 @@ +% ALGORITHMIC STYLE for LaTeX version 2e +% +% This style file is free software; you can redistribute it and/or +% modify it under the terms of the GNU Lesser General Public +% License as published by the Free Software Foundation; either +% version 2 of the License, or (at your option) any later version. +% +% This style file is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this style file; if not, write to the +% Free Software Foundation, Inc., 59 Temple Place - Suite 330, +% Boston, MA 02111-1307, USA. +% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{algorithmic}[2005/07/05] +\typeout{Document Style `algorithmic' - environment} +% +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{keyval} +\newboolean{ALC@noend} +\setboolean{ALC@noend}{false} +\newcounter{ALC@line} +\newcounter{ALC@rem} +\newcounter{ALC@depth} +\newlength{\ALC@tlm} +% +\DeclareOption{noend}{\setboolean{ALC@noend}{true}} +% +\ProcessOptions +% +% For keyval-style options +\def\algsetup{\setkeys{ALG}} +% +% For indentation of algorithms +\newlength{\algorithmicindent} +\setlength{\algorithmicindent}{0pt} +\define@key{ALG}{indent}{\setlength{\algorithmicindent}{#1}} +\ifthenelse{\lengthtest{\algorithmicindent=0pt}}% + {\setlength{\algorithmicindent}{1em}}{} +% +% For line numbers' delimiters +\newcommand{\ALC@linenodelimiter}{:} +\define@key{ALG}{linenodelimiter}{\renewcommand{\ALC@linenodelimiter}{#1}} + +% +% For line numbers' size +\newcommand{\ALC@linenosize}{\footnotesize} +\define@key{ALG}{linenosize}{\renewcommand{\ALC@linenosize}{#1}} + +% +% ALGORITHMIC +\newcommand{\algorithmicrequire}{\textbf{Require:}} +\newcommand{\algorithmicensure}{\textbf{Ensure:}} +\newcommand{\algorithmiccomment}[1]{\{#1\}} +\newcommand{\algorithmicend}{\textbf{end}} +\newcommand{\algorithmicif}{\textbf{if}} +\newcommand{\algorithmicthen}{\textbf{then}} +\newcommand{\algorithmicelse}{\textbf{else}} +\newcommand{\algorithmicelsif}{\algorithmicelse\ \algorithmicif} +\newcommand{\algorithmicendif}{\algorithmicend\ \algorithmicif} +\newcommand{\algorithmicfor}{\textbf{for}} +\newcommand{\algorithmicforall}{\textbf{for all}} +\newcommand{\algorithmicdo}{\textbf{do}} +\newcommand{\algorithmicendfor}{\algorithmicend\ \algorithmicfor} +\newcommand{\algorithmicwhile}{\textbf{while}} +\newcommand{\algorithmicendwhile}{\algorithmicend\ \algorithmicwhile} +\newcommand{\algorithmicloop}{\textbf{loop}} +\newcommand{\algorithmicendloop}{\algorithmicend\ \algorithmicloop} +\newcommand{\algorithmicrepeat}{\textbf{repeat}} +\newcommand{\algorithmicuntil}{\textbf{until}} +\newcommand{\algorithmicprint}{\textbf{print}} +\newcommand{\algorithmicreturn}{\textbf{return}} +\def\ALC@setref{% + \def\@currentlabel{\theALC@line}% +} +\def\ALC@item[#1]{% +\if@noparitem \@donoparitem + \else \if@inlabel \indent \par \fi + \ifhmode \unskip\unskip \par \fi + \if@newlist \if@nobreak \@nbitem \else + \addpenalty\@beginparpenalty + \addvspace\@topsep \addvspace{-\parskip}\fi + \else \addpenalty\@itempenalty \addvspace\itemsep + \fi + \global\@inlabeltrue +\fi +\everypar{\global\@minipagefalse\global\@newlistfalse + \if@inlabel\global\@inlabelfalse \hskip -\parindent \box\@labels + \penalty\z@ \fi + \everypar{}}\global\@nobreakfalse +\if@noitemarg \@noitemargfalse \if@nmbrlist \refstepcounter{\@listctr}\fi \fi +\sbox\@tempboxa{\makelabel{#1}}% +\global\setbox\@labels + \hbox{\unhbox\@labels \hskip \itemindent + \hskip -\labelwidth \hskip -\ALC@tlm + \ifdim \wd\@tempboxa >\labelwidth + \box\@tempboxa + \else \hbox to\labelwidth {\unhbox\@tempboxa}\fi + \hskip \ALC@tlm}\ignorespaces} +% +\newenvironment{algorithmic}[1][0]{ +\setcounter{ALC@depth}{\@listdepth}% +\let\@listdepth\c@ALC@depth% +\let\@item\ALC@item + \newcommand{\ALC@lno}{% +\ifthenelse{\equal{\arabic{ALC@rem}}{0}} +{{\ALC@linenosize \arabic{ALC@line}\ALC@linenodelimiter}}{}% +} +\let\@listii\@listi +\let\@listiii\@listi +\let\@listiv\@listi +\let\@listv\@listi +\let\@listvi\@listi +\let\@listvii\@listi + \newenvironment{ALC@g}{ + \begin{list}{\ALC@lno}{ \itemsep\z@ \itemindent\z@ + \listparindent\z@ \rightmargin\z@ + \topsep\z@ \partopsep\z@ \parskip\z@\parsep\z@ + \leftmargin \algorithmicindent%1em + \addtolength{\ALC@tlm}{\leftmargin} + } + } + {\end{list}} + \newcommand{\ALC@it}{\refstepcounter{ALC@line}\refstepcounter{ALC@rem}\ifthenelse{\equal{\arabic{ALC@rem}}{#1}}{\setcounter{ALC@rem}{0}}{}\item\ALC@setref} + \newcommand{\ALC@com}[1]{\ifthenelse{\equal{##1}{default}}% +{}{\ \algorithmiccomment{##1}}} + \newcommand{\REQUIRE}{\item[\algorithmicrequire]} + \newcommand{\ENSURE}{\item[\algorithmicensure]} + \newcommand{\PRINT}{\ALC@it\algorithmicprint{}\ \ } + \newcommand{\RETURN}{\ALC@it\algorithmicreturn{}\ \ } + \newcommand{\STATE}{\ALC@it} + \newcommand{\COMMENT}[1]{\algorithmiccomment{##1}} + \newenvironment{ALC@if}{\begin{ALC@g}}{\end{ALC@g}} + \newenvironment{ALC@for}{\begin{ALC@g}}{\end{ALC@g}} + \newenvironment{ALC@whl}{\begin{ALC@g}}{\end{ALC@g}} + \newenvironment{ALC@loop}{\begin{ALC@g}}{\end{ALC@g}} + \newenvironment{ALC@rpt}{\begin{ALC@g}}{\end{ALC@g}} + \renewcommand{\\}{\@centercr} + \newcommand{\IF}[2][default]{\ALC@it\algorithmicif\ ##2\ \algorithmicthen% +\ALC@com{##1}\begin{ALC@if}} + \newcommand{\ELSE}[1][default]{\end{ALC@if}\ALC@it\algorithmicelse% +\ALC@com{##1}\begin{ALC@if}} + \newcommand{\ELSIF}[2][default]% +{\end{ALC@if}\ALC@it\algorithmicelsif\ ##2\ \algorithmicthen% +\ALC@com{##1}\begin{ALC@if}} + \newcommand{\FOR}[2][default]{\ALC@it\algorithmicfor\ ##2\ \algorithmicdo% +\ALC@com{##1}\begin{ALC@for}} + \newcommand{\FORALL}[2][default]{\ALC@it\algorithmicforall\ ##2\ % +\algorithmicdo% +\ALC@com{##1}\begin{ALC@for}} + \newcommand{\WHILE}[2][default]{\ALC@it\algorithmicwhile\ ##2\ % +\algorithmicdo% +\ALC@com{##1}\begin{ALC@whl}} + \newcommand{\LOOP}[1][default]{\ALC@it\algorithmicloop% +\ALC@com{##1}\begin{ALC@loop}} + \newcommand{\REPEAT}[1][default]{\ALC@it\algorithmicrepeat% +\ALC@com{##1}\begin{ALC@rpt}} + \newcommand{\UNTIL}[1]{\end{ALC@rpt}\ALC@it\algorithmicuntil\ ##1} + \ifthenelse{\boolean{ALC@noend}}{ + \newcommand{\ENDIF}{\end{ALC@if}} + \newcommand{\ENDFOR}{\end{ALC@for}} + \newcommand{\ENDWHILE}{\end{ALC@whl}} + \newcommand{\ENDLOOP}{\end{ALC@loop}} + }{ + \newcommand{\ENDIF}{\end{ALC@if}\ALC@it\algorithmicendif} + \newcommand{\ENDFOR}{\end{ALC@for}\ALC@it\algorithmicendfor} + \newcommand{\ENDWHILE}{\end{ALC@whl}\ALC@it\algorithmicendwhile} + \newcommand{\ENDLOOP}{\end{ALC@loop}\ALC@it\algorithmicendloop} + } + \renewcommand{\@toodeep}{} + \begin{list}{\ALC@lno}{\setcounter{ALC@line}{0}\setcounter{ALC@rem}{0}% + \itemsep\z@ \itemindent\z@ \listparindent\z@% + \partopsep\z@ \parskip\z@ \parsep\z@% + \labelsep 0.5em \topsep 0.2em% +\ifthenelse{\equal{#1}{0}} + {\labelwidth 0.5em } + {\labelwidth 1.2em } +\leftmargin\labelwidth \addtolength{\leftmargin}{\labelsep} + \ALC@tlm\labelsep + } +} +{\end{list}} + diff --git a/bbm.sty b/bbm.sty new file mode 100644 index 0000000..d41a4ed --- /dev/null +++ b/bbm.sty @@ -0,0 +1,40 @@ +%% +%% This is file `bbm.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% bbm.dtx (with options: `package') +%% +%% Copyright (C) 1994,1997 by Torsten Hilbrich +%% +%% This file is part of the BBM package, a support for using the bbm* fonts. +\def\fileversion{1.1} +\def\filedate{1997/07/24} +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bbm}[\filedate\space V\space\fileversion + \space provides fonts for set symbols - TH] +\DeclareMathAlphabet{\mathbbm}{U}{bbm}{m}{n} +\SetMathAlphabet\mathbbm{bold}{U}{bbm}{bx}{n} +\DeclareMathAlphabet{\mathbbmss}{U}{bbmss}{m}{n} +\SetMathAlphabet\mathbbmss{bold}{U}{bbmss}{bx}{n} +\DeclareMathAlphabet{\mathbbmtt}{U}{bbmtt}{m}{n} + +\endinput +%% +%% End of file `bbm.sty'. diff --git a/changemargin.sty b/changemargin.sty new file mode 100644 index 0000000..9919dcb --- /dev/null +++ b/changemargin.sty @@ -0,0 +1,16 @@ +% Change margins on the fly +\newenvironment{changemargin}[2]{% + \begin{list}{}{% + \setlength{\topsep}{0pt}% + \setlength{\leftmargin}{#1}% + \setlength{\rightmargin}{#2}% + \setlength{\listparindent}{\parindent}% + \setlength{\itemindent}{\parindent}% + \setlength{\parsep}{\parskip}% + }% + \item[] ~ \par% + % Get rid of the extra space inserted by the previous line + \vspace*{-2em}% +}{ + \end{list} +} diff --git a/drop.sty b/drop.sty new file mode 100644 index 0000000..f4a5d77 --- /dev/null +++ b/drop.sty @@ -0,0 +1,67 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DROP.DOC +% Macro for dropping and enlarging the first letter(s) of a paragraph. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Macro written by David G. Cantor, and published Fri, 12 Feb 88, in +% TeXhax, 1988 #16. +% Internet: dgc@math.ucla.edu +% UUCP: ...!{ihnp4, randvax, sdcrdcf, ucbvax}!ucla-cs!dgc +% +% Modified for use with LaTeX by Dominik Wujastyk, February 17, 1988 +% Internet: dow@wjh12.harvard.edu +% Bitnet: dow@harvunxw.bitnet +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This LaTeX macro is for dropping and enlarging the first letter(s) of a +% paragraph. The argument may be one or more letters. +% +% Here is an example of its usage: +% +% \documentstyle[drop]{article} +% \begin{document} +% \drop{IN} THE beginning God created the heaven and the earth. Now the +% earth was unformed and void, and darkness was upon the face of the +% deep; and the spirit of God hovered over the face of the waters. +% \end{document} +% +% Which will produce something along these lines: +% +% I I\ I THE beginning God created the heaven and the earth. +% I I \ I Now the earth was unformed and void, and darkness was +% I I \I upon the face of the deep; and the spirit of God hov- +% ered over the face of the waters. +% +% In the first instance the macro will pause during LaTeX processing and +% ask you for the font you wish to use for you drop capital. When you +% have something that looks good, then comment out box one in DROP.STY, +% and comment in box two, replacing "cmr10 scaled \magstep5" with the font +% of your choice. +% +% In my opinion (DW) there are no fonts available in the standard +% TeX/LaTeX set that are ideal for this use, unless you go down to 9pt or +% 8pt for your text face, and this is too small. If you have Metafont you +% should consider generating a cmr17 font at a magstep of two (about 25pt) +% or three (about 30pt), or even more, depending on the point size of your +% main text. Why not go the whole hog and design some really fancy +% capitals from scratch! +% +%%%%%%%%%%%%%%%%%%%%% BOX ONE %%%%%%%%%%%%%%%%%%%%%%%%% +\typein[\dropinitialfont]{Font for Dropped initial:} % +\font\largefont \dropinitialfont % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%%%%%%%%%%%%%%%%%%%%% BOX TWO %%%%%%%%%%%%%%%%%%%%%%%%% +%\font\largefont= cmr10 scaled \magstep5 % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\drop#1#2{{\noindent + \setbox0\hbox{\largefont #1}\setbox1\hbox{#2}\setbox2\hbox{(}% + \count0=\ht0\advance\count0 by\dp0\count1\baselineskip + \advance\count0 by-\ht1\advance\count0by\ht2 + \dimen1=.5ex\advance\count0by\dimen1\divide\count0 by\count1 + \advance\count0 by1\dimen0\wd0 + \advance\dimen0 by.25em\dimen1=\ht0\advance\dimen1 by-\ht1 + \global\hangindent\dimen0\global\hangafter-\count0 + \hskip-\dimen0\setbox0\hbox to\dimen0{\raise-\dimen1\box0\hss}% + \dp0=0in\ht0=0in\box0}#2} diff --git a/dropping.sty b/dropping.sty new file mode 100644 index 0000000..0092ea8 --- /dev/null +++ b/dropping.sty @@ -0,0 +1,137 @@ +%% +%% This is file `dropping.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% dropping.dtx (with options: `paketkod') +%% +%% Copyright (c) 1996-97 by Mats Dahlgren . +%% All rights reserved. See the file `dropping.ins' for information +%% on how you may (re-)distribute the `dropping' package files. +%% +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{dropping}[1997/06/12 v.0.12] +\newcount\bigscale +\newcount\down +\newdimen\saveunitlength +\newdimen\wantedheight +\newif\ifstrtcmmnd \strtcmmndfalse +\DeclareOption{dvips}{% +\newcount\wantedcount +\newcount\actualcount% +\newdimen\actualheight% +\def\findsize#1#2{% +\bigscale=1000% +\font\BIG=#1 scaled \bigscale% +\setbox0=\hbox{\BIG #2\/}% +\actualheight=\ht0% +\wantedcount=\wantedheight \actualcount=\actualheight% +\advance\actualcount by 50% +\divide\actualcount by 100% +\multiply\wantedcount by 10% +\divide\wantedcount by \actualcount% +\font\BIG=#1 scaled \wantedcount% +\setbox0=\hbox{\BIG #2\/}% +\bigscale=\wantedcount}} +\DeclareOption{other}{% +\def\nextmagstep#1#2#3{% +\bigscale=#3% +\font\BIG=#1 scaled \bigscale% +\setbox0=\hbox{\BIG #2\/}}% +\def\findsize#1#2{% +\nextmagstep{#1}{#2}{\magstep0}% +\ifdim\ht0<\wantedheight% +\nextmagstep{#1}{#2}{\magstephalf}% +\ifdim\ht0<\wantedheight% +\nextmagstep{#1}{#2}{\magstep1}% +\ifdim\ht0<\wantedheight% +\nextmagstep{#1}{#2}{\magstep2}% +\ifdim\ht0<\wantedheight% +\nextmagstep{#1}{#2}{\magstep3}% +\ifdim\ht0<\wantedheight% +\nextmagstep{#1}{#2}{\magstep4}% +\ifdim\ht0<\wantedheight% +\nextmagstep{#1}{#2}{\magstep5}% +\fi\fi\fi\fi\fi\fi}} +\DeclareOption{xdvi}{\ExecuteOptions{dvips}} +\DeclareOption{dvipsone}{\ExecuteOptions{other}} +\DeclareOption{dviwindo}{\ExecuteOptions{other}} +\DeclareOption{emtex}{\ExecuteOptions{other}} +\DeclareOption{dviwin}{\ExecuteOptions{other}} +\DeclareOption{oztex}{\ExecuteOptions{dvips}} +\DeclareOption{textures}{\ExecuteOptions{other}} +\DeclareOption{pctexps}{\ExecuteOptions{other}} +\DeclareOption{pctexwin}{\ExecuteOptions{other}} +\DeclareOption{pctexhp}{\ExecuteOptions{other}} +\DeclareOption{dvi2ps}{\ExecuteOptions{other}} +\DeclareOption{dvialw}{\ExecuteOptions{other}} +\DeclareOption{dvilaser}{\ExecuteOptions{other}} +\DeclareOption{dvitops}{\ExecuteOptions{other}} +\DeclareOption{psprint}{\ExecuteOptions{other}} +\DeclareOption{pubps}{\ExecuteOptions{other}} +\DeclareOption{ln}{\ExecuteOptions{other}} +\DeclareOption*{\ExecuteOptions{other}} +\InputIfFileExists{graphics.cfg}{}{% +\PackageWarningNoLine{dropping}{% +You have no `graphics.cfg' file installed.\MessageBreak +I will assume you are using `dvips'} +\ExecuteOptions{dvips}} +\ProcessOptions +\def\bigdrop#1#2#3#4{% +\saveunitlength=\unitlength% +\unitlength=\baselineskip% +\setbox1=\hbox{\the\font I}% +\wantedheight=#2\baselineskip \advance\wantedheight by -\baselineskip% +\advance\wantedheight by \ht1% +\findsize{#3}{#4}% +\hangindent=\wd0 \advance\hangindent by #1% +\hangafter=-#2% +\ifdim\dp0>0.25\baselineskip% + \loop\ifdim\dp0>\baselineskip + \advance\baselineskip by \baselineskip + \advance\hangafter by -1 + \repeat + \advance\hangafter by -1 + \baselineskip=\unitlength +\fi% +\noindent% +\down=-#2 \advance\down by 1% +\begin{picture}(0,0)% +\put(0,\down){\makebox(0,0)[br]{\box0}}% +\end{picture}% +\unitlength=\saveunitlength} +\def\spltatspc#1 #2\spltatspc{#1} +\def\spltstrng#1{\expandafter\@split#1\end} +\def\@split#1 #2\end{\def\strngn{#1}\def\strngtw{#2}} +\def\isit#1{\expandafter\@isit\string#1\@null} +\def\@isit#1#2\@null{% + \ifnum`#1=`\\ + \global\strtcmmndtrue + \else + \global\strtcmmndfalse + \fi +} +\newcommand{\dropping}[3][0pt]{% +\get@external@font% +\edef\n@vf@nt{\expandafter\spltatspc\external@font \spltatspc}% +\setbox8=\hbox{#3\get@external@font% +\global\let\external@font@export\external@font% +\edef\n@vf@ntb@x{\expandafter\spltatspc\external@font \spltatspc}% +\global\let\n@vf@nt\n@vf@ntb@x}% +\let\external@font\external@font@export% +\edef\xprt@rgtr{\expandafter\spltatspc\external@font\expandafter{} +\spltatspc} +\def\spltslsk{#3}% +\isit{#3}% +\ifstrtcmmnd +\spltstrng\spltslsk% +\let\xprt@rgfr\strngtw +\else +\def\xprt@rgfr{#3} +\fi +\protect\bigdrop{#1}{#2}{\xprt@rgtr}{\xprt@rgfr}% +} +\endinput +%% +%% End of file `dropping.sty'. diff --git a/spimbasephdthesis.sty b/spimbasephdthesis.sty new file mode 100644 index 0000000..091165b --- /dev/null +++ b/spimbasephdthesis.sty @@ -0,0 +1,430 @@ +% Document class for the PhD thesis +% +% Copyright (c) 2012-14 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. + +%%-------------------- +%% Declare the LaTeX class +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{spimbasephdthesis}[2014/11/06] + +\RequirePackage{lettrine} + +%%-------------------- +%% Check for the correct version of tex-upmethodology +\@ifclasslater{UPMVERSION}{2014/07/09}{}{\@latex@error{You must install a version of tex-upmethodology greater or equal to 20140710}\@eha} + +%%-------------------- +%% Underlining if the author's name (in bibliography) +\newcommand{\underlineifauthor}[2]{% + \ifdocumentauthor{#1}{\underline{#2}}{#2}% +} + +%%-------------------- +%% Utility functions +\gdef\edspim@phdthesis@class@firstword#1 #2\@nil{#1} +\gdef\edspim@phdthesis@class@nextwords#1 #2\@nil{#2} +\gdef\edspim@phdthesis@class@firstcolumn#1,#2\@nil{#1} +\gdef\edspim@phdthesis@class@nextcolumns#1,#2\@nil{#2} +\gdef\edspim@phdthesis@class@makejury{} +\gdef\edspim@phdthesis@class@addjury#1#2{% + \addjury% + {\expandafter\edspim@phdthesis@class@firstword\edspim@phdthesis@class@firstcolumn#2\@nil\@nil}% + {\expandafter\edspim@phdthesis@class@nextwords\edspim@phdthesis@class@firstcolumn#2\@nil\@nil}% + {#1}% + {\edspim@phdthesis@class@nextcolumns#2\@nil}% +} + +%%-------------------- +% Define the PhD thesis document +%\declarethesis[subtitle]{title}{defense date}{ID} +\newcommand{\declarethesis}[4][] { + \declaredocument{#2}{#1}{#4}% + \Set{defensedate}{#3}% + \initialversion{\makedate{11}{04}{2006}}{PhD Thesis}{\upmpublic}% +} + +%%-------------------- +% Add menber of the jury +%\addjury[email]{firstname}{lastname}{type}{position} +\newcommand{\upm@phdthesis@protectnl}[1]{% + \begingroup% + \let\\\newline% + \nohyphens{\Get{jurystyle}#1}% + \endgroup% +} +\gdef\upm@phdthesis@jurylist{} +\global\let\thejurytab\relax +\newcommand{\addjury}[5][]{% + \global\protected@edef\upm@phdthesis@jurylist{\upm@phdthesis@jurylist\protect\protect\Get{jurystyle}\protect\protect\upmmakename{#2}{#3}{~} & \protect\upm@phdthesis@protectnl{#4} & \protect\upm@phdthesis@protectnl{#5} \protect\\}% + \global\protected@edef\thejurytab{\protect\noindent\protect\begin{tabularx}{\Get{jurytabwidth}}{@{}llX@{}}\upm@phdthesis@jurylist\protect\end{tabularx}}% +} + +%%-------------------- +% Add affiliation +%\addlaboratory{lab description} +\newif\ifphdthesishaslaboratory +\global\phdthesishaslaboratoryfalse +\newif\ifphdthesishaslaboratorymulti +\global\phdthesishaslaboratorymultifalse +\gdef\thethesislaboratories{} +\newcommand{\addlaboratory}[1]{% + \ifphdthesishaslaboratory% + \phdthesishaslaboratorymultitrue% + \global\protected@edef\thethesislaboratories{\thethesislaboratories,\protect\\\protect{#1}}% + \else% + \phdthesishaslaboratorytrue% + \global\protected@edef\thethesislaboratories{\thethesislaboratories\protect{#1}}% + \fi% +} +%%-------------------- +% Reset affiliation +%\resetlaboratories +\newcommand{\resetlaboratories}{% + \global\phdthesishaslaboratoryfalse% + \global\phdthesishaslaboratorymultifalse% + \gdef\thethesislaboratories{}% +} + +%%-------------------- +%% Add partner logo +%\addpartner[picture_options]{logo_picture} +\newif\ifpartnerlist +\global\partnerlistfalse +\gdef\thepartnerlist{} +\newcommand{\addpartner}[2][height=1cm]{% + \ifpartnerlist% + \protected@xdef\thepartnerlist{\thepartnerlist\protect\hfill\protect\includegraphics[#1]{#2}}% + \else% + \global\partnerlisttrue% + \protected@xdef\thepartnerlist{\thepartnerlist\protect\includegraphics[height=1cm]{#2}}% + \fi% +} + +%%-------------------- +%% Reset the list of the partner logos +%\resetpartners +\newif\ifpartnerlist +\newcommand{\resetpartners}{% + \global\partnerlistfalse% + \gdef\thepartnerlist{}% +} + +%%-------------------- +% Change the color of the TOC +\let\upm@phdthesis@l@contentsline\contentsline +\renewcommand{\contentsline}[4]{% + %{subsection}{\numberline {1.1.2}Extension de la plateforme \textsc {JaSIM}\xspace et Application}{18}{subsection.1.1.2} + \ifthenelse + {\equal{#1}{part}} + {\upm@phdthesis@l@contentsline{#1}{\textcolor{parttitlecolor}{#2}}{\textcolor{parttitlecolor}{#3}}{#4}}% + {\ifthenelse + {\equal{#1}{chapter}} + {\upm@phdthesis@l@contentsline{#1}{\textcolor{chaptertitlecolor}{#2}}{\textcolor{chaptertitlecolor}{#3}}{#4}}% + {\upm@phdthesis@l@contentsline{#1}{#2}{#3}{#4}}}% +} + +%%-------------------- +% Set the abstract of the thesis +% \thesisabstract [lang]{text} +\newif\ifphdthesismainabstract +\phdthesismainabstractfalse +\newif\ifphdthesisminorabstract +\phdthesisminorabstractfalse +\gdef\phdthesismainabstract{} +\gdef\phdthesisminorabstract{} +\gdef\phdthesismainabstracttitle{R\'esum\'e~:} +\gdef\phdthesisminorabstracttitle{Abstract:} +\newcommand{\thesisabstract}[2][\upmcurrentlang]{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \global\phdthesismainabstracttrue% + \gdef\phdthesismainabstract{#2}% + \setdocabstract{#2}% + \ifthenelse{\equal{english}{#1}}{% + \gdef\phdthesismainabstracttitle{Abstract:} + }{% + \gdef\phdthesismainabstracttitle{R\'esum\'e~:} + }% + }{% + \global\phdthesisminorabstracttrue% + \gdef\phdthesisminorabstract{#2}% + \ifthenelse{\equal{english}{#1}}{% + \gdef\phdthesisminorabstracttitle{Abstract:} + }{% + \gdef\phdthesisminorabstracttitle{R\'esum\'e~:} + }% + }% +} + +%%-------------------- +% Set the keywords of the thesis +% \thesiskeywords [lang]{keywords} +\newif\ifphdthesismainkeywords +\phdthesismainkeywordsfalse +\newif\ifphdthesisminorkeywords +\phdthesisminorkeywordsfalse +\gdef\phdthesismainkeywords{} +\gdef\phdthesisminorkeywords{} +\gdef\phdthesismainkeywordstitle{} +\gdef\phdthesisminorkeywordstitle{} +\newcommand{\thesiskeywords}[2][\upmcurrentlang]{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \global\phdthesismainkeywordstrue% + \gdef\phdthesismainkeywords{#2}% + \ifthenelse{\equal{english}{#1}}{% + \gdef\phdthesismainkeywordstitle{Keywords:} + }{% + \gdef\phdthesismainkeywordstitle{Mots-cl\'es~:} + }% + }{% + \global\phdthesisminorkeywordstrue% + \gdef\phdthesisminorkeywords{#2}% + \ifthenelse{\equal{english}{#1}}{% + \gdef\phdthesisminorkeywordstitle{Keywords:} + }{% + \gdef\phdthesisminorkeywordstitle{Mots-cl\'es~:} + }% + }% +} + +%%-------------------- +% Utility function that is looping on the character of a text +% \foreachchar {for first char}{for the rest of the chars} +\gdef\@endfe{} +\def\upm@foreachchar#1#2\@endfe{% + \def\thechar{#1}% + \upm@foreach@do% + \renewcommand{\onfirstchar}[1]{}% + \renewcommand{\onnextchar}[1]{##1}% + \ifthenelse{\equal{{#2}}{{\@endfe}}}{}{ + \expandafter\upm@foreachchar#2\@endfe% + }% +} + +\newcommand{\foreachchar}[2]{% + \begingroup% + \newcommand{\upm@foreach@do}{#2}% + \newcommand{\onfirstchar}[1]{##1}% + \newcommand{\onnextchar}[1]{}% + {\expandafter\upm@foreachchar#1\@endfe\@endfe}% + \endgroup% +} + +%%-------------------- +% Build card with the PhD thesis reference ID inside. +% This ID is given by the SPIM doctoral school. +\newcommand{\thespimthesisdocrefcard}{% + \gdef\upm@spimthesis@reserveda{|}% + \gdef\upm@spimthesis@reservedb{}% + \foreachchar{\theupmdocref}{% + \protected@xdef\upm@spimthesis@reserveda{|c\upm@spimthesis@reserveda}% + \protected@xdef\upm@spimthesis@reservedb{\upm@spimthesis@reservedb \onnextchar{\protect&} \thechar}% + }% + \protected@xdef\upm@spimthesis@reserveda{% + \protect\tabular[c]{\upm@spimthesis@reserveda}}% + N\ensuremath{^{\circ}}~\upm@spimthesis@reserveda% + \upm@spimthesis@reservedb \\ \hline\endtabular% +} + +%%-------------------- +%% Define emphazing macros +\renewcommand{\Emph}[1]{\textcolor{emphemphtextcolor}{\textbf{#1}}} +\renewcommand{\emph}[1]{\textcolor{emphtextcolor}{#1}} + +%%-------------------- +%% Macros for formating the bibliography +\newcommand{\phdthesisbibemph}[1]{\textit{#1}} +\newcommand{\phdthesisbibEmph}[1]{\textcolor{bibemphemphtextcolor}{\textbf{#1}}} +\newcommand{\phdthesisbibkeyemph}[1]{\textbf{#1}} + +\ifthenelse{\equal{french}{\upmcurrentlang}}{ + \gdef\phdthesisbiband{et\xspace} + \gdef\phdthesisbibetal{et~al.} + \gdef\phdthesisbibeditors{\'editeurs\xspace} + \gdef\phdthesisbibeditor{\'editeur\xspace} + \gdef\phdthesisbibvolume{volume\xspace} + \gdef\phdthesisbibVolume{Volume\xspace} + \gdef\phdthesisbibof{de\xspace} + \gdef\phdthesisbibvolumenumber{volume et num\'ero\xspace} + \gdef\phdthesisbibnumber{num\'ero\xspace} + \gdef\phdthesisbibNumber{Num\'ero\xspace} + \gdef\phdthesisbibin{dans\xspace} + \gdef\phdthesisbibIn{Dans\xspace} + \gdef\phdthesisbibedition{\'edition\xspace} + \gdef\phdthesisbibpages{pages\xspace} + \gdef\phdthesisbibpage{page\xspace} + \gdef\phdthesisbibchapter{chapitre\xspace} + \gdef\phdthesisbibtechnicalreport{Rapport technique\xspace} + \gdef\phdthesisbibJanuary{Janvier\xspace} + \gdef\phdthesisbibFebruary{F\'evrier\xspace} + \gdef\phdthesisbibMarch{Mars\xspace} + \gdef\phdthesisbibApril{Avril\xspace} + \gdef\phdthesisbibMay{Mai\xspace} + \gdef\phdthesisbibJune{Juin\xspace} + \gdef\phdthesisbibJuly{Juillet\xspace} + \gdef\phdthesisbibAugust{Ao\^ut\xspace} + \gdef\phdthesisbibSeptember{Septembre\xspace} + \gdef\phdthesisbibOctober{Octobre\xspace} + \gdef\phdthesisbibNovember{Novembre\xspace} + \gdef\phdthesisbibDecember{D\'ecembre\xspace} +}{% + \gdef\phdthesisbiband{et\xspace} + \gdef\phdthesisbibetal{et~al.} + \gdef\phdthesisbibeditors{editors\xspace} + \gdef\phdthesisbibeditor{editor\xspace} + \gdef\phdthesisbibvolume{volume\xspace} + \gdef\phdthesisbibVolume{Volume\xspace} + \gdef\phdthesisbibof{of\xspace} + \gdef\phdthesisbibvolumenumber{volume and number\xspace} + \gdef\phdthesisbibnumber{number\xspace} + \gdef\phdthesisbibNumber{Number\xspace} + \gdef\phdthesisbibin{in\xspace} + \gdef\phdthesisbibIn{In\xspace} + \gdef\phdthesisbibedition{edition\xspace} + \gdef\phdthesisbibpages{pages\xspace} + \gdef\phdthesisbibpage{page\xspace} + \gdef\phdthesisbibchapter{chapter\xspace} + \gdef\phdthesisbibtechnicalreport{Technical Report\xspace} + \gdef\phdthesisbibJanuary{January\xspace} + \gdef\phdthesisbibFebruary{February\xspace} + \gdef\phdthesisbibMarch{March\xspace} + \gdef\phdthesisbibApril{April\xspace} + \gdef\phdthesisbibMay{May\xspace} + \gdef\phdthesisbibJune{June\xspace} + \gdef\phdthesisbibJuly{July\xspace} + \gdef\phdthesisbibAugust{August\xspace} + \gdef\phdthesisbibSeptember{September\xspace} + \gdef\phdthesisbibOctober{October\xspace} + \gdef\phdthesisbibNovember{November\xspace} + \gdef\phdthesisbibDecember{December\xspace} +} + +%%-------------------- +%% Force the name of the bibliography and other sections for French +\AtBeginDocument{ + \ifthenelse{\equal{\edspimphdthesisclasslanguage}{french}}{% + \renewcommand{\refname}{Bibliographie}% + \renewcommand{\listtablename}{Liste des tables}% + \renewcommand{\contentsname}{Sommaire}% + }{} +} + +%%-------------------- +%% Format the keys in the bibliography section +\global\let\upm@phdthesis@old@biblabel\@biblabel +\gdef\@biblabel#1{\phdthesisbibkeyemph{\upm@phdthesis@old@biblabel{#1}}} + + +%%-------------------- +% Lettrine + +% The following macro put its parameter into a lettrine with the +% proper layout +\gdef\upm@phdthesis@MakeLettrine@lettrine#1{% + \lettrine[findent=.5mm,nindent=0pt]{\uppercase{#1}}{}% +} + +% Macro that contains the string "the letter" +\gdef\upm@phdthesis@MakeLettrine@letterstr{\string t\string h\string e\space\string l\string e\string t\string t\string e\string r} + +% Macro that contains the string "the character" +\gdef\upm@phdthesis@MakeLettrine@characterstr{\string t\string h\string e\space\string c\string h\string a\string r\string a\string c\string t\string e\string r} + +% Macro to search for the first letter in its second parameter +% and put it in a lettrine. +% First parameter: are the macros to ignore and put back before +% the lettrine. The value of this parameter will +% evolve during the recursive calls. +% Second parameter: TeX give the token following the macro in +% this parameter (because the macros is always +% invoked with only one explicit parameter). +\newcommand{\upm@phdthesis@MakeLettrine}[2]{% + % Detect the meaning of the second parameter. + \edef\upm@phdthesis@reserveda{\meaning#2}% + % Test if the meaning string contains "the letter" + \edef\upm@phdthesis@reservedb{\noexpand\in@{\upm@phdthesis@MakeLettrine@letterstr}{\upm@phdthesis@reserveda}}% + \upm@phdthesis@reservedb% + \ifin@% + % The meaning indicates that the second parameter + % is a letter. It may be put in the lettrine. + % The macro \upm@phdthesis@reserveda is defined to avoid + % to consume the tokens written in this recursive + % macro. This temp macro is invoked at the end of + % this recursive macro. In this way it will consume + % the token that are available in the document core. + \gdef\upm@phdthesis@reserveda{#1\upm@phdthesis@MakeLettrine@lettrine{#2}}% + \else% + % Test if the meaning string contains "the character" + \edef\upm@phdthesis@reservedb{\noexpand\in@{\upm@phdthesis@MakeLettrine@characterstr}{\upm@phdthesis@reserveda}}% + \upm@phdthesis@reservedb% + \ifin@% + % The meaning indicates that the second parameter + % is a character. It may be put in the lettrine. + % The macro \upm@phdthesis@reserveda is defined to avoid + % to consume the tokens written in this recursive + % macro. This temp macro is invoked at the end of + % this recursive macro. In this way it will consume + % the token that are available in the document core. + \gdef\upm@phdthesis@reserveda{#1\upm@phdthesis@MakeLettrine@lettrine{#2}}% + \else% + % The meaning indicates that the second parameter + % is not a letter nor a character. + % It may be put back before the lettrine without + % change. + % The macro \upm@phdthesis@reserveda is defined to avoid + % to consume the tokens written in this recursive + % macro. This temp macro is invoked at the end of + % this recursive macro. In this way it will consume + % the token that are available in the document core. + \gdef\upm@phdthesis@reserveda{\upm@phdthesis@MakeLettrine{#1#2}}% + \fi% + \fi% + \upm@phdthesis@reserveda% +} + +%%-------------------- +%% Macro for starting a chapter with a standard format +\global\long\def\upm@phdthesis@chapterintro@toc#1\section{% + \@ifundefined{minitoc}{}{% + \begin{figure}[bt]% + \minitoc% + \end{figure}% + }% + \ignorespaces\upm@phdthesis@MakeLettrine{}#1% + \expandafter\section} +\global\long\def\upm@phdthesis@chapterintro@notoc#1\section{% + \ignorespaces\upm@phdthesis@MakeLettrine{}#1% + \expandafter\section} +\gdef\chapterintro{\@ifstar\upm@phdthesis@chapterintro@notoc\upm@phdthesis@chapterintro@toc} + +%%-------------------- +%% Add a small message on the backcover. +\Set{backcovermessage}{% + \begin{center}\tiny + \ifthenelse{\equal{french}{\upmcurrentlang}}{ + Document r\'ealis\'e avec \LaTeX\ et : \\ + le style \LaTeX\ pour Th\`ese de Doctorat cr\'e\'e par S. Galland --- \url{http://www.multiagent.fr/ThesisStyle} \\ + la collection de paquets \texttt{tex-upmethodology} --- \url{http://www.arakhne.org/tex-upmethodology/}\\[.25cm] + }{ + Document generated with \LaTeX\ and: \\ + the \LaTeX\ style for PhD Thesis created by S. Galland --- \url{http://www.multiagent.fr/ThesisStyle} \\ + the \texttt{tex-upmethodology} package suite --- \url{http://www.arakhne.org/tex-upmethodology/}\\[.25cm] + } + \end{center} +} + +\endinput diff --git a/upmethodology-backpage.sty b/upmethodology-backpage.sty new file mode 100644 index 0000000..32df29b --- /dev/null +++ b/upmethodology-backpage.sty @@ -0,0 +1,81 @@ +% Back page for Unified Process Methodology +% +% Copyright (c) 2009-2013 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. + +\global\edef\upm@package@bp@ver{2013/12/14} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-backpage}[\upm@package@bp@ver] + +\RequirePackage{upmethodology-p-common} + +%----- +% Locales +\def\upm@back@lang@english{ + \gdef\upm@lang@@{\message{**** upmethodology-backpage is using English language ****}}% +} +\def\upm@back@lang@french{ + \gdef\upm@lang@@{\message{**** upmethodology-backpage is using French language ****}}% +} +%---------------------------------------- +% OPTIONS +%---------------------------------------- +\DeclareOption{french}{% + \upm@back@lang@french +} +\DeclareOption{francais}{% + \upm@back@lang@french +} +\DeclareOption{english}{% + \upm@back@lang@english +} +\ExecuteOptions{english} +\ProcessOptions +\upm@lang@@ + +\RequirePackage{upmethodology-extension} + +%---- +% Set the back page layout as the classic layout theme +%\setbackcover{layout_name} +\newcommand{\setbackcover}[1]{% + \ifthenelse{\equal{#1}{none}}{% + \global\let\makebackcover\relax% + }{% + \errmessage{invalid back layout theme: #1}% + }% +} +\newcommand{\setbacklayout}[1]{\errmessage{\string\setbacklayout\ is deprecated. Use \string\setbackcover}} + +\setbackcover{none} + +\AtEndDocument{ + \Ifdefined{backpage}{ + \gdef\makebackcover{ + \ifupmarticleformat\clearpage% + \else + \cleardoublepage% + \if@twoside\thispagestyle{empty}\mbox{}% + \vfill{\Get{backcovermessage}}\clearpage\fi + \fi + \thispagestyle{empty}\Get{backpage} + } + } +} + +\endinput diff --git a/upmethodology-code.sty b/upmethodology-code.sty new file mode 100644 index 0000000..470a1d3 --- /dev/null +++ b/upmethodology-code.sty @@ -0,0 +1,143 @@ +% Source Code Description for Unified Process Methodology +% +% Copyright (c) 2006-2007 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% +% Creation date: 2006-04-27 +% Modifications: +% 2009-10-30 Clean code. +% + +\global\edef\upm@package@code@ver{2009/10/30} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-code}[\upm@package@code@ver] + +\RequirePackage{upmethodology-p-common} + +\def\upm@code@eat@spaces#1{#1} +\def\upm@code@makemul#1{\upm@code@eat@spaces{#1}\bgroup\textbf{s}\egroup\xspace} + +%----- +%Language +%0: UML +%1: java +%2: C++ +\newcount\upm@code@current@lang + +\DeclareOption{uml}{\upm@code@current@lang=0} +\DeclareOption{java}{\upm@code@current@lang=1} +\DeclareOption{cpp}{\upm@code@current@lang=2} + +\ExecuteOptions{uml} +\ProcessOptions + +%----- +%Language changes +\newcommand{\upmcodelang}[1]{% + \ifthenelse{\equal{#1}{java}}{% + \upm@code@current@lang=1% + }{% + \ifthenelse{\equal{#1}{cpp}}{% + \upm@code@current@lang=2% + }{% + \upm@code@current@lang=0% + }% + }% + \upm@code@declarations% +} + +\def\upm@code@declarations { +%----- +%PROTOTYPES +\gdef\jclass##1{\mbox{\textsc{##1}}\xspace} +\gdef\jinterface##1{\mbox{\textit{##1}}\xspace} +\gdef\jpackage##1{\mbox{\textsc{##1}}\xspace} +\gdef\jfunc##1{\texttt{##1}\xspace} + +%----- +%TYPES +\if\the\upm@code@current@lang 1 + %Java + \gdef\jclazz{\textbf{Class}\xspace} + \gdef\jvoid{\textbf{void}\xspace} + \gdef\jint{\textbf{int}\xspace} + \gdef\jlong{\textbf{long}\xspace} + \gdef\jfloat{\textbf{float}\xspace} + \gdef\jboolean{\textbf{boolean}\xspace} + \gdef\jdouble{\textbf{double}\xspace} + \gdef\jchar{\textbf{char}\xspace} + \gdef\jstring{\jclass{String}\xspace} + \gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace} + \gdef\jcollection##1{{\jclass{Collection}\textless{##1}\bgroup\textgreater\egroup}\xspace} + \gdef\jset##1{{\jclass{Set}\textless{##1}\bgroup\textgreater\egroup}\xspace} +\else\if\the\upm@code@current@lang 2 + %C++ + \gdef\jclazz{\textbf{class}\xspace} + \gdef\jvoid{\textbf{void}\xspace} + \gdef\jint{\textbf{int}\xspace} + \gdef\jlong{\textbf{long}\xspace} + \gdef\jfloat{\textbf{float}\xspace} + \gdef\jboolean{\textbf{bool}\xspace} + \gdef\jdouble{\textbf{double}\xspace} + \gdef\jchar{\textbf{char}\xspace} + \gdef\jstring{\jclass{std\string:\string:string}\xspace} + \gdef\jarray##1{{{##1}\bgroup\textbf{\string[\string]}\egroup}\xspace} + \gdef\jcollection##1{{\jclass{std\string:\string:vector}\textless{##1}\bgroup\textgreater\egroup}\xspace} + \gdef\jset##1{{\jclass{std\string:\string:set}\textless{##1}\bgroup\textgreater\egroup}\xspace} +\else + %UML + \gdef\jclazz{\textbf{class}\xspace} + \gdef\jvoid{\textbf{void}\xspace} + \gdef\jint{\textbf{integer}\xspace} + \gdef\jlong{\textbf{long integer}\xspace} + \gdef\jfloat{\textbf{float}\xspace} + \gdef\jboolean{\textbf{boolean}\xspace} + \gdef\jdouble{\textbf{double}\xspace} + \gdef\jchar{\textbf{character}\xspace} + \gdef\jstring{\textbf{string}\xspace} + \gdef\jcollection##1{{\textbf{collection of} \upm@code@makemul{##1}\bgroup\egroup}\xspace} + \gdef\jarray##1{{\textbf{array of} \upm@code@makemul{##1}\bgroup\egroup}\xspace} + \gdef\jset##1{{\textbf{set of} \upm@code@makemul{##1}\bgroup\egroup}\xspace} +\fi\fi + +%----- +%CONSTANTS +\if\the\upm@code@current@lang 1 + %Java + \gdef\jtrue{\textsc{true}\xspace} + \gdef\jfalse{\textsc{false}\xspace} +\else\if\upm@code@current@lang 2 + %C++ + \gdef\jtrue{\textsc{true}\xspace} + \gdef\jfalse{\textsc{false}\xspace} +\else + \gdef\jtrue{\textsc{true}\xspace} + \gdef\jfalse{\textsc{false}\xspace} +\fi\fi + +%----- +%OPERATIONS +\gdef\jop##1{\bgroup\jcode{##1}\egroup} +\gdef\jcall##1##2{\mbox{\jfunc{##1}\bgroup\texttt{\string({##2}\string)}\egroup}\xspace} +\gdef\jcode##1{\texttt{##1}\xspace} + +} + +\upm@code@declarations + +\endinput diff --git a/upmethodology-document.sty b/upmethodology-document.sty new file mode 100644 index 0000000..9c47c8b --- /dev/null +++ b/upmethodology-document.sty @@ -0,0 +1,560 @@ +% Package for Unified Process Methodology's documents +% +% Copyright (c) 2006-2013 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. + +\global\edef\upm@package@doc@ver{2013/09/29} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-document}[\upm@package@doc@ver] + +\RequirePackage{upmethodology-p-common} + +%---------------------------------------- +% LOCALES +%---------------------------------------- +\def\upm@document@lang@english{% + \gdef\upm@lang@@{\message{**** upmethodology-document is using English language ****}}% + \gdef\upmcurrentlang{english}% + \gdef\upmcurrentlangforbabel{english}% + \gdef\upm@lang@project{Project}% + \gdef\upm@lang@document{Document}% + \gdef\upm@lang@docref{Reference}% + \gdef\upm@lang@lastupdate{Last Update}% + \gdef\upm@lang@lastupdate@short{Updated}% + \gdef\upm@lang@document@summary{Document Summary}% + \gdef\upm@lang@status{Status}% + \gdef\upm@lang@document@authors{Authors}% + \gdef\upm@lang@document@informed{Informed People}% + \gdef\upm@lang@document@validators{Validators}% + \gdef\upm@lang@document@names{Names}% + \gdef\upm@lang@document@comments{Comments}% + \gdef\upm@lang@document@emails{Emails}% + \gdef\upm@lang@document@initials{Initials}% + \gdef\upm@lang@document@abstract{Abstract}% + \gdef\upm@lang@document@keywords{Key-words}% + \gdef\upm@lang@document@copyright@purpose{This document describes the \theupmproject\ project\Ifnotempty{\theupmsubproject}{ and its \theupmsubproject\ subproject}.}% + \gdef\upm@lang@document@copyright@tex{\TeX\ is a trademark of the American Mathematical Society.}% + \gdef\upm@lang@document@copyright@upmethodology{\texttt{tex-upmethodology} is owned by St\'ephane Galland, \arakhneorg, France.}% + \gdef\upm@lang@document@copyright@madewith{This document was realised with \LaTeX\ and \texttt{tex-upmethodology}.}% + \gdef\upm@lang@document@copyright@trademarks{This document is published by the \theupmformattedpublisher. All right reserved. No part of this publication may be reproduced, stored in a retreival system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publishers.} + \gdef\upm@lang@document@copyright@printedin{Printed in \theupmprintedin.} +} +\def\upm@document@lang@french{% + \gdef\upm@lang@@{\message{**** upmethodology-document is using French language ****}}% + \gdef\upmcurrentlang{french}% + \gdef\upmcurrentlangforbabel{frenchb}% + \gdef\upm@lang@project{Projet}% + \gdef\upm@lang@document{Document}% + \gdef\upm@lang@docref{R\'ef\'erence}% + \gdef\upm@lang@lastupdate{Derni\`ere modification}% + \gdef\upm@lang@lastupdate@short{Modifi\'e}% + \gdef\upm@lang@document@summary{Synoptique}% + \gdef\upm@lang@status{Statut}% + \gdef\upm@lang@document@authors{Auteurs}% + \gdef\upm@lang@document@comments{Commentaires}% + \gdef\upm@lang@document@informed{Pour information}% + \gdef\upm@lang@document@validators{Validateurs}% + \gdef\upm@lang@document@names{Noms}% + \gdef\upm@lang@document@emails{Emails}% + \gdef\upm@lang@document@initials{Initiales}% + \gdef\upm@lang@document@abstract{R\'esum\'e}% + \gdef\upm@lang@document@keywords{Mots-cl\'es}% + \gdef\upm@lang@document@copyright@purpose{Ce document d\'ecrit le projet \theupmproject\Ifnotempty{\theupmsubproject}{ et son sous-projet \theupmsubproject}.}% + \gdef\upm@lang@document@copyright@tex{\TeX\ et \LaTeX\ sont des marques de la Soci\'et\'e Am\'ericaine de Math\'ematiques.}% + \gdef\upm@lang@document@copyright@upmethodology{\texttt{tex-upmethodology} est la propri\'et\'e de St\'ephane Galland, \arakhneorg, France.}% + \gdef\upm@lang@document@copyright@madewith{Ce document a \'et\'e r\'ealis\'e avec \LaTeX\ et \texttt{tex-upmethodology}.}% + \gdef\upm@lang@document@copyright@trademarks{Ce document est publi\'e par \theupmformattedpublisher. Tous droits r\'eserv\'es. \par Le Code de la propri\'et\'e intellectuelle n'autorisant, aux termes de l'article L.122-5, 2\textdegree et 3\textdegree a), d'une part, que les ``copies ou reproductions strictement r\'eserv\'ees \`a l'usage priv\'e du copiste et non destin\'ees \`a une utilisation collective'' et, d'autre part, que les analyses et les courtes citations dans un but d'exemple et d'illustation, ``toute repr\'esentation ou reproduction int\'egrale ou partielle faite sans le consentement de l'auteur ou de ses ayants droit ou ayants cause est illicite'' (art. L.122-4). \par Cette repr\'esentation ou reproduction, par quelque proc\'ed\'e que ce soit, constiturait donc une contrefa\c{c}on sanctionn\'ee par les articles L.335-2 et suivants du Code de la propri\'et\'e intellectuelle.} + \gdef\upm@lang@document@copyright@printedin{Imprim\'e en \theupmprintedin.} + +} + +%---------------------------------------- +% OPTIONS +%---------------------------------------- +\DeclareOption{french}{% + \upm@document@lang@french +} +\DeclareOption{francais}{% + \upm@document@lang@french +} +\DeclareOption{english}{% + \upm@document@lang@english +} +\ExecuteOptions{english} +\ProcessOptions + +{\upm@lang@@} + +\RequirePackage[\upmcurrentlangforbabel]{babel} +\RequirePackage{vmargin} + +\RequirePackage{upmethodology-extension} +\RequirePackage{upmethodology-fmt} +\RequirePackage{upmethodology-version} + +%---------------------------------------- +% Ensure that frenchb (included by babel) +% does not use compact versions of lists +% in french mode. +%---------------------------------------- + +\newlength\listendskip +\listendskip=\parskip +\iflanguage{french}{% + \addto\extrasfrench{% + \let\upm@document@enditemizeFB\enditemizeFB% + \def\enditemizeFB{\upm@document@enditemizeFB\vspace{\listendskip}}% + \let\upm@document@enditemizeORI\enditemizeORI% + \def\enditemizeFB{\upm@document@enditemizeORI\vspace{\listendskip}}% + }% + \addto\noextrasfrench{% + \let\upm@document@enditemizeFB\enditemizeFB% + \def\enditemizeFB{\upm@document@enditemizeFB\vspace{\listendskip}}% + \let\upm@document@enditemizeORI\enditemizeORI% + \def\enditemizeFB{\upm@document@enditemizeORI\vspace{\listendskip}}% + }% +} + +%---------------------------------------- +% DOCUMENT MANAGEMENT +%---------------------------------------- + +%----- +% Declare a project's document +%\declaredocument{project}{name}{ref} +\newcommand{\declaredocument}[3]{% + \gdef\theupmproject{#1}% + \gdef\theupmsubproject{}% + \gdef\theupmdocname{#2}% + \gdef\theupmdocref{#3}% +} + +%----- +% Declare a project's document +%\declaredocumentex{project}{subproject}{name}{ref} +\newcommand{\declaredocumentex}[4]{% + \gdef\theupmproject{#1}% + \gdef\theupmsubproject{#2}% + \gdef\theupmdocname{#3}% + \gdef\theupmdocref{#4}% +} + +%----- +% Display the summary of the document +%\upmdocumentsummary[width] +\newcommand{\upmdocumentsummary}[1][\linewidth]{% + \noindent\begin{mtabular}[#1]{2}{|l|X|}% + \tabulartitle{\upm@lang@document@summary}% + \upm@lang@project & \theupmproject\Ifnotempty{\theupmsubproject}{ -- \theupmsubproject} \\ + \upm@lang@document & \theupmdocname \\ + \upm@lang@docref & \theupmdocref \\ + \upm@lang@version & \theupmversion \\ + \upm@lang@lastupdate & \theupmdate \\ + \hline + \end{mtabular}\par\vspace{.5cm}% +} + +%----- +% Display the the document information on a page +%\upmpublicationpage +\newcommand{\upmdocinfopage}{ + \thispagestyle{plain} + \upmdocumentsummary\upmdocumentauthors\upmdocumentvalidators\upmdocumentinformedpeople\vfill\upmhistory\clearpage% +} + +%----- +% Display the publication pag for the document +%\upmpublicationpage +\newcommand{\upmpublicationpage}{ + \thispagestyle{empty}% + \upmpublicationminipage% +} +\newcommand{\upmpublicationminipage}{ + \if@twoside\ifodd\c@page\clearpage\fi\fi% + \mbox{}\vfill\small% + \par\noindent + \upm@lang@document@copyright@purpose + \vspace{.5cm} + \par\noindent + \upm@lang@document@copyright@tex + \par\noindent + \upm@lang@document@copyright@upmethodology + \vspace{.5cm} + \par\noindent + \Get{trademarks} + \vspace{4cm} + \par\noindent + \upm@lang@document@copyright@madewith + \vspace{.15cm} + \par\noindent + Copyright~\copyright~\upmcopyrightdate~\theupmformattedcopyrighter. + \vspace{.15cm} + \par\noindent + \upm@lang@document@copyright@trademarks \Ifdefined{printed}{\upm@lang@document@copyright@printedin} + \vspace{.25cm} + \par\noindent + \upm@lang@docref~: \theupmdocref \\ + \Ifnotempty{\theupmisbn}{ISBN~:~\theupmisbn\\} + \Ifnotempty{\theupmissn}{ISSN~:~\theupmissn\\} + \Ifnotempty{\theupmdoi}{DOI~:~\theupmdoi\\} + \clearpage% +} + +%----- +%Name of the project for which this document was written +\def\theupmproject{Arakhn\^e Project} + +%----- +%Name of the sub-project for which this document was written +\def\theupmsubproject{} + +%----- +%Name of the document +\def\theupmdocname{Arakhn\^e Document} + +%----- +%Reference of the document +\def\theupmdocref{XXX} + + +%----- +%Name of the logo +\newcommand{\theupmsmalldoclogo}{\Get{smalllogo}} +\newcommand{\theupmdoclogo}{\Get{logo}} + +%----- +% Define the name of the logo picture to use +\newcommand{\defupmsmalllogo}[1]{\Set{smalllogo}{#1}} +\newcommand{\defupmlogo}[1]{\Set{logo}{#1}} + +%----- +%Full name of the document +\def\theupmfulldocname{% + \theupmproject% + \Ifnotempty{\theupmsubproject}{/\theupmsubproject}% + \Ifnotempty{\theupmdocname}{ -- \theupmdocname}% +} + +%----- +% Declare a document's abstract +%\setdocabstract[lang]{text} +\newcommand{\setdocabstract}[2][\upmcurrentlang]{% + \ifthenelse{\equal{#1}{\upmcurrentlang}}{ + \gdef\theupmdocabstract{#2}}{}% + \global\@namedef{theupmdocabstract#1}{#2}% +} + +%----- +% Declare a document's key-words +%\setdockeywords[lang]{words} +\newcommand{\setdockeywords}[2][\upmcurrentlang]{% + \ifthenelse{\equal{#1}{\upmcurrentlang}}{ + \gdef\theupmdockeywords{#2}}{}% + \global\@namedef{theupmdockeywords#1}{#2}% +} + +%----- +%Abstract of the document +\def\theupmdocabstract{} + +%----- +%Key-words of the document +\def\theupmdockeywords{} + +%---------------------------------------- +% AUTHOR MANAGEMENT +%---------------------------------------- + +\newif\ifupm@document@author@tab@hascomment +\upm@document@author@tab@hascommentfalse +\def\upm@document@author@tab{} +\def\upm@document@author@tab@commented{} + +%----- +\def\theauthorlist{} + +%----- +\newif\ifupm@document@author@isauthor +\gdef\upm@document@author@authornames{} +\newcommand{\ifdocumentauthor}[3]{% + \upm@document@author@isauthorfalse% + \@for\upm@document@author@isauthor@tmp:=\upm@document@author@authornames\do{% + \ifupm@document@author@isauthor% + \else% + \ifthenelse{\equal{#1}{\upm@document@author@isauthor@tmp}}{% + \upm@document@author@isauthortrue% + }{}% + \fi% + }% + \ifupm@document@author@isauthor{#2}\else{#3}\fi% +} + +%----- +%Add an author +%\addauthor[email]{firstname}{name} +%\addauthor*[email]{firstname}{name}{comment} +\def\addauthor{\@ifstar\upm@document@addauthorstar\upm@document@addauthor} +\newcommand{\upm@document@addauthor}[3][]{% + \lowercase{\xdef\upm@document@author@authornames{#3,\upm@document@author@authornames}}% + \protected@xdef\theauthorlist{\theauthorlist\protect\Ifnotempty{\theauthorlist}{,} \protect\upmmakename{#2}{#3}{~}} + + \global\protected@edef\upm@document@author@tab@commented{\upm@document@author@tab@commented \protect\upmmakename{#2}{#3}{~} & + & \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} \protect\\} + + \ifupm@document@author@tab@hascomment\else + \global\protected@edef\upm@document@author@tab{\upm@document@author@tab \protect\upmmakename{#2}{#3}{~} & + \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} \protect\\} + \fi +} +\newcommand{\upm@document@addauthorstar}[4][]{% + \lowercase{\xdef\upm@document@author@authornames{#3,\upm@document@author@authornames}}% + \global\protected@edef\theauthorlist{\theauthorlist\protect\Ifnotempty{\theauthorlist}{,} \protect\upmmakename{#2}{#3}{~}} + + \global\let\upm@document@author@tab\relax + + \global\protected@edef\upm@document@author@tab@commented{\upm@document@author@tab@commented \protect\upmmakename{#2}{#3}{~} & + #4 & \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} \protect\\} + + \upm@document@author@tab@hascommenttrue +} + +%----- +% Display the summary of the authors +%\upmdocumentauthors[width] +\newcommand{\upmdocumentauthors}[1][\linewidth]{% + \ifupm@document@author@tab@hascomment% + \Ifnotempty{\upm@document@author@tab@commented}{% + \noindent\expandafter\begin{mtabular}[#1]{3}{|X|l|c|}% + \tabulartitle{\upm@lang@document@authors}% + \tabularheader{\upm@lang@document@names}{\upm@lang@document@comments}{\upm@lang@document@emails}% + \upm@document@author@tab@commented + \hline% + \expandafter\end{mtabular}\par\vspace{.5cm}}% + \else% + \Ifnotempty{\upm@document@author@tab}{% + \noindent\expandafter\begin{mtabular}[#1]{2}{|X|c|}% + \tabulartitle{\upm@lang@document@authors}% + \tabularheader{\upm@lang@document@names}{\upm@lang@document@emails}% + \upm@document@author@tab + \hline% + \expandafter\end{mtabular}\par\vspace{.5cm}}% + \fi% +} + +%---------------------------------------- +% VALIDATOR MANAGEMENT +%---------------------------------------- + +\newif\ifupm@document@validator@tab@hascomment +\upm@document@validator@tab@hascommentfalse +\def\upm@document@validator@tab{} +\def\upm@document@validator@tab@commented{} + +%----- +\def\thevalidatorlist{} + +%----- +%Add a validator +%\addvalidator[email]{firstname}{name} +%\addvalidator*[email]{firstname}{name}{comment} +\def\addvalidator{\@ifstar\upm@document@addvalidatorstar\upm@document@addvalidator} +\newcommand{\upm@document@addvalidator}[3][]{% + \global\protected@edef\thevalidatorlist{\thevalidatorlist\protect\Ifnotempty{\thevalidatorlist}{,} \protect\upmmakename{#2}{#3}{~}} + + \global\protected@edef\upm@document@validator@tab@commented{\upm@document@validator@tab@commented \protect\upmmakename{#2}{#3}{~} & + & \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} & \protect\\} + + \ifupm@document@validator@tab@hascomment\else + \global\protected@edef\upm@document@validator@tab{\upm@document@validator@tab \protect\upmmakename{#2}{#3}{~} & + \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} & \protect\\} + \fi +} +\newcommand{\upm@document@addvalidatorstar}[4][]{% + \global\protected@edef\thevalidatorlist{\thevalidatorlist\protect\Ifnotempty{\thevalidatorlist}{,} \protect\upmmakename{#2}{#3}{~}} + + \global\let\upm@document@validator@tab\relax + + \global\protected@edef\upm@document@validator@tab@commented{\upm@document@validator@tab@commented \protect\upmmakename{#2}{#3}{~} & + #4 & \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} & \protect\\} + + \upm@document@validator@tab@hascommenttrue +} + +%----- +% Display the summary of the validators +%\upmdocumentvalidators[width] +\newcommand{\upmdocumentvalidators}[1][\linewidth]{% + \ifupm@document@validator@tab@hascomment% + \Ifnotempty{\upm@document@validator@tab@commented}{% + \noindent\expandafter\begin{mtabular}[#1]{4}{|X|l|c|p{3cm}|}% + \tabulartitle{\upm@lang@document@validators}% + \tabularheader{\upm@lang@document@names}{\upm@lang@document@comments}{\upm@lang@document@emails}{\upm@lang@document@initials}% + \upm@document@validator@tab@commented + \hline% + \expandafter\end{mtabular}\par\vspace{.5cm}}% + \else% + \Ifnotempty{\upm@document@validator@tab}{% + \noindent\expandafter\begin{mtabular}[#1]{3}{|X|c|p{3cm}|}% + \tabulartitle{\upm@lang@document@validators}% + \tabularheader{\upm@lang@document@names}{\upm@lang@document@emails}{\upm@lang@document@initials}% + \upm@document@validator@tab + \hline% + \expandafter\end{mtabular}\par\vspace{.5cm}}% + \fi% +} + + +%----- +%Add an author/validator +%\addauthorvalidator[email]{firstname}{name} +%\addauthorvalidator*[email]{firstname}{name}{comment} +\def\addauthorvalidator{\@ifstar\upm@document@addauthorvalidatorstar\upm@document@addauthorvalidator} +\newcommand{\upm@document@addauthorvalidator}[3][]{% + \addauthor[#1]{#2}{#3}\addvalidator[#1]{#2}{#3}% +} +\newcommand{\upm@document@addauthorvalidatorstar}[4][]{% + \addauthor*[#1]{#2}{#3}{#4}\addvalidator*[#1]{#2}{#3}{#4}% +} + +%---------------------------------------- +% INFORMED MANAGEMENT +%---------------------------------------- + +\newif\ifupm@document@informed@tab@hascomment +\upm@document@informed@tab@hascommentfalse +\def\upm@document@informed@tab{} +\def\upm@document@informed@tab@commented{} + +%----- +\def\theinformedlist{} + +%----- +%Add an informed +%\addinformed[email]{firstname}{name} +%\addinformed*[email]{firstname}{name}{comment} +\def\addinformed{\@ifstar\upm@document@addinformedstar\upm@document@addinformed} +\newcommand{\upm@document@addinformed}[3][]{% + \global\protected@edef\theinformedlist{\theinformedlist\protect\Ifnotempty{\theinformedlist}{,} \protect\upmmakename{#2}{#3}{~}} + + \global\protected@edef\upm@document@informed@tab@commented{\upm@document@informed@tab@commented \protect\upmmakename{#2}{#3}{~} & + & \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} \protect\\} + + \ifupm@document@informed@tab@hascomment\else + \global\protected@edef\upm@document@informed@tab{\upm@document@informed@tab \protect\upmmakename{#2}{#3}{~} & + \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} \protect\\} + \fi +} +\newcommand{\upm@document@addinformedstar}[4][]{% + \global\protected@edef\theinformedlist{\theinformedlist\protect\Ifnotempty{\theinformedlist}{,} \protect\upmmakename{#2}{#3}{~}} + + \global\let\upm@document@informed@tab\relax + + \global\protected@edef\upm@document@informed@tab@commented{\upm@document@informed@tab@commented \protect\upmmakename{#2}{#3}{~} & + #4 & \protect\Ifnotempty{#1}{\protect\href{mailto:#1}{#1}} \protect\\} + + \upm@document@informed@tab@hascommenttrue +} + +%----- +% Display the summary of the informed people +%\upmdocumentinformedpeople[width] +\newcommand{\upmdocumentinformedpeople}[1][\linewidth]{% + \ifupm@document@validator@tab@hascomment% + \Ifnotempty{\upm@document@informed@tab@commented}{% + \noindent\expandafter\begin{mtabular}[#1]{3}{|X|l|c|}% + \tabulartitle{\upm@lang@document@informed}% + \tabularheader{\upm@lang@document@names}{\upm@lang@document@comments}{\upm@lang@document@emails}% + \upm@document@informed@tab@commented + \hline% + \expandafter\end{mtabular}\par\vspace{.5cm}}% + \else% + \Ifnotempty{\upm@document@informed@tab}{% + \noindent\expandafter\begin{mtabular}[#1]{2}{|X|c|}% + \tabulartitle{\upm@lang@document@informed}% + \tabularheader{\upm@lang@document@names}{\upm@lang@document@emails}% + \upm@document@informed@tab + \hline% + \expandafter\end{mtabular}\par\vspace{.5cm}}% + \fi% +} + +%---------------------------------------- +% PUBLISHER, COPYRIGHT, PRINTING... +%---------------------------------------- + +\gdef\theupmcopyrighter{\Get{copyrighter}} +\gdef\theupmpublisher{\Get{publisher}} +\gdef\theupmprintedin{\Get{printedin}} +\gdef\theupmisbn{} +\gdef\theupmissn{} +\gdef\theupmdoi{} +\gdef\theupmpublishingdate{} + +\newcommand{\theupmformattedpublisher}{\Ifelsedefined{publisher}{\theupmpublisher}{\textcolor{red}{???}}} +\newcommand{\theupmformattedcopyrighter}{\Ifelsedefined{copyrighter}{\theupmcopyrighter}{\textcolor{red}{???}}} + +%----- +%Set the publisher identity +%\setpublisher{name} +\newcommand{\setpublisher}[1]{\Set{publisher}{#1}} + +%----- +%Set the copyrighter identity +%\setcopyrighter{name} +\newcommand{\setcopyrighter}[1]{\Set{copyrighter}{#1}} + +%----- +%Set the address where this document is printed +%\setprintingaddress{address} +\newcommand{\setprintingaddress}[1]{\Set{printedin}{#1}} + +%----- +%Set the ISBN +%\setisbn{isbn} +\newcommand{\setisbn}[1]{% + \gdef\theupmisbn{#1}% +} + +%----- +%Set the ISSN +%\setisbn{issn} +\newcommand{\setissn}[1]{% + \gdef\theupmissn{#1}% +} + +%----- +%Set the DOI +%\setdoi{doi} +\newcommand{\setdoi}[1]{% + \gdef\theupmdoi{#1}% +} + +%---------------------------------------- +% WATERMARK +%---------------------------------------- + +\AtBeginDocument{ + \ifthenelse{\equal{\theupmstatus}{\upmrestricted}}{ + \edef\upm@doc@tmp@watermark{\uppercase{\upm@lang@restricted}} + \RequirePackage{draftwatermark} + \SetWatermarkText{\upm@doc@tmp@watermark} + \SetWatermarkScale{\Get{watermarksize}} + }{} +} + +\endinput diff --git a/upmethodology-extension.sty b/upmethodology-extension.sty new file mode 100644 index 0000000..0ffe448 --- /dev/null +++ b/upmethodology-extension.sty @@ -0,0 +1,123 @@ +% Package for Unified Process Methodology's extensions +% +% Copyright (c) 2006-2009 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% +% Creation date: 2009-10-24 +% Modifications: +% 2012-09-21 "(c)" -> "\copyright" +% 2009-11-03 \If* are marked as \long. +% 2006-10-30 Bug fix: provides "upmethodology-extension" insteed of "upmethodology-document". +% 2006-10-29 Allow to override the default font. +% 2006-10-27 Clean the API +% + +\global\edef\upm@package@ext@ver{2012/09/21} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-extension}[\upm@package@ext@ver] + +\RequirePackage{upmethodology-p-common} + +%---------------------------------------- +% TEST MACROS +%---------------------------------------- +\long\def\Ifdefined#1#2{\@ifundefined{upmext@extension@value@#1}{}{#2}} +\long\def\Ifelsedefined#1#2#3{\@ifundefined{upmext@extension@value@#1}{#3}{#2}} +\long\def\Ifundefined#1#2{\@ifundefined{upmext@extension@value@#1}{#2}{}} +\long\def\Ifelseundefined#1#2#3{\@ifundefined{upmext@extension@value@#1}{#2}{#3}} + +%---------------------------------------- +% EXTENSION MANAGEMENT +%---------------------------------------- + +\newif\ifupm@extension@savealllang\upm@extension@savealllangfalse + +\newcommand{\Get}[1]{\@nameuse{upmext@extension@value@#1}} +\newcommand{\GetLang}[2]{\@nameuse{upmext@extension@value@#1@#2}} + +\newcommand{\upm@extension@Set}[3][\upmcurrentlang]{% + % PREDEFINED FRONT PAGE + \ifthenelse{\equal{#2}{frontpage}}{% + \gdef\upmext@extension@value@frontpage{#3}% + \global\let\upmext@extension@value@frontpage@custom\relax% + }{% + % CUSTOM BACK PAGE + \ifthenelse{\equal{#2}{backpage}}{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \gdef\upmext@extension@value@backpage{#3}% + }{}% + }{% + % CUSTOM FRONT PAGE + \ifthenelse{\equal{#2}{cfrontpage}}{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \gdef\upmext@extension@value@frontpage{custom}% + \gdef\upmext@extension@value@frontpage@custom{#3}% + }{}% + }{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \message{*** define extension value #2 ****}% + \global\@namedef{upmext@extension@value@#2}{#3}% + }{}% + \ifupm@extension@savealllang% + \global\@namedef{upmext@extension@value@#2@#1}{#3}% + \fi + }}}% +} +\let\Set\upm@extension@Set + +\newcommand{\Unset}[2][\upmcurrentlang]{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \message{*** undefine extension value #2 ****}% + \global\expandafter\let\csname upmext@extension@value@#2\endcsname\@undefined% + \ifupm@extension@savealllang% + \global\expandafter\let\csname upmext@extension@value@#2@#1\endcsname\@undefined% + \fi% + }{}% +} + +\newcommand{\DeclareCopyright}[5][\upmcurrentlang]{% + \ifthenelse{\equal{\upmcurrentlang}{#1}}{% + \Set{copyright}{Copyright {(c)} #3 #4.}% + \message{*** style extension #2, \Get{copyright} ****}% + \Set{trademarks}{#5}% + }{}% +} + +\newlength{\upmext@tmp@putx} +\def\Put(#1,#2){% + \setlength{\upmext@tmp@putx}{#1\unitlength}% + \if@twoside\ifodd\c@page\else\addtolength{\upmext@tmp@putx}{28\unitlength}\fi\fi% + \put(\strip@pt\upmext@tmp@putx,#2)} + +%----- +% Use the specified extension +%\UseExtension{extension_name} +\newcommand{\UseExtension}[1]{% + \message{**** including upm extension #1 (upmext-#1.cfg) ****}% + \input{upmext-#1.cfg}% +} + +%------------ +% Default declarations +\Set{frontillustrationsize}{1} +\Set{watermarksize}{1} +\Unset{publisher} +\Unset{copyrighter} +\Unset{printedin} + +\endinput diff --git a/upmethodology-fmt.sty b/upmethodology-fmt.sty new file mode 100644 index 0000000..98d34aa --- /dev/null +++ b/upmethodology-fmt.sty @@ -0,0 +1,1498 @@ +% Layout and Pagraph Format for Unified Process Methodology +% +% Copyright (c) 2006-2009, 2012-2014 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. + +\global\edef\upm@package@fmt@ver{2015/02/27} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-fmt}[\upm@package@fmt@ver] + +\RequirePackage{upmethodology-p-common} + +\gdef\upm@fmt@force@single@spacing#1{{\begin{singlespace}#1\end{singlespace}}} +\gdef\upm@date@head#1/#2\@nil{#1} +\gdef\upm@date@tail#1/#2\@nil{#2} +\gdef\upm@date@first#1{{\expandafter\upm@date@head#1\expandafter\@nil}} +\gdef\upm@date@second#1{{\expandafter\expandafter\expandafter\upm@date@head\expandafter\upm@date@tail#1\expandafter\@nil\expandafter\expandafter\expandafter\@nil}} +\gdef\upm@date@third#1{{\expandafter\expandafter\expandafter\upm@date@tail\expandafter\upm@date@tail#1\expandafter\@nil\expandafter\expandafter\expandafter\@nil}} + +\newif\ifupm@use@override@standard@lists +\global\upm@use@override@standard@liststrue + +%---------------------------------------- +% LOCALES +%---------------------------------------- +\global\let\upm@format@lang@extractyear\upm@date@first% +\def\upm@format@lang@english{% + \gdef\upm@lang@@{\message{**** upmethodology-fmt is using English language ****}}% + \global\renewcommand{\upm@format@lang@makedate}[3]{##3\string/\two@digits{##2}\string/\two@digits{##1}}% + \global\let\upm@format@lang@extractyear\upm@date@first% + \global\let\upm@format@lang@extractmonth\upm@date@second% + \gdef\upm@format@lang@professor{Pr.}% + \gdef\upm@format@lang@doctor{Dr.}% + \gdef\upm@format@lang@phdoctor{Ph.D.}% + \gdef\upm@format@lang@scdoctor{Sc.D.}% + \gdef\upm@format@lang@mdoctor{M.D.}% + \gdef\upm@format@lang@professionalengineer{CEng.}% + \gdef\upm@format@lang@incorporatedengineer{IEng.}% +} +\def\upm@format@lang@french{% + \gdef\upm@lang@@{\message{**** upmethodology-fmt is using French language ****}}% + \global\renewcommand{\upm@format@lang@makedate}[3]{\two@digits{##1}\string/\two@digits{##2}\string/##3}% + \global\let\upm@format@lang@extractyear\upm@date@third% + \global\let\upm@format@lang@extractmonth\upm@date@second% + \global\let\upm@format@lang@extractday\upm@date@first% + \gdef\upm@format@lang@professor{Pr.}% + \gdef\upm@format@lang@doctor{Dr.}% + \gdef\upm@format@lang@phdoctor{Ph.D.}% + \gdef\upm@format@lang@scdoctor{Sc.D.}% + \gdef\upm@format@lang@mdoctor{M.D.}% + \gdef\upm@format@lang@professionalengineer{Ing.}% + \gdef\upm@format@lang@incorporatedengineer{Ing.}% +} +\global\providecommand{\upm@format@lang@makedate}[3]{}% + +%---------------------------------------- +% OPTIONS +%---------------------------------------- +\DeclareOption{french}{% + \upm@format@lang@french + \PassOptionsToPackage{french}{varioref} +} +\DeclareOption{francais}{% + \upm@format@lang@french + \PassOptionsToPackage{french}{varioref} +} +\DeclareOption{english}{% + \upm@format@lang@english + \PassOptionsToPackage{english}{varioref} +} +\DeclareOption{standardlists}{% + \global\upm@use@override@standard@listsfalse +} +\ExecuteOptions{english} +\ProcessOptions +\upm@lang@@ + + +\RequirePackage{graphicx} +\RequirePackage{subfigure} +\RequirePackage{tabularx} +\RequirePackage{multicol} +\RequirePackage{colortbl} +\RequirePackage{picinpar} +\RequirePackage{amsmath} +\RequirePackage{amsthm} +\RequirePackage{thmtools} +\RequirePackage{pifont} +\RequirePackage{setspace} +\RequirePackage{varioref} +\RequirePackage{txfonts} +\RequirePackage{relsize} +\RequirePackage{xkeyval} +\RequirePackage{hyphenat} +\RequirePackage{bbm} +\RequirePackage{environ}% for advanced environment declaration + +%---------------------------------------- +% Exponent and indice +%---------------------------------------- +% Exponent +%\newcommand{\textsup}[1]{\ensuremath{^{\text{#1}}}\xspace} +\newcommand{\textsup}[1]{\upm@textsuperscript{#1}\xspace} +% Indice +%\newcommand{\textsub}[1]{\ensuremath{_{\text{#1}}}\xspace} +\newcommand{\textsub}[1]{\upm@textsubscript{#1}\xspace} + +%---------------------------------------- +% Major Emphazing +%---------------------------------------- +\newcommand{\Emph}[1]{\textbf{#1}\xspace} + +%---------------------------------------- +% SYMBOLS +%---------------------------------------- +\renewcommand{\copyright}{\Pisymbol{psy}{211}\xspace} +\newcommand{\trademark}{\Pisymbol{psy}{228}\xspace} +\newcommand{\regmark}{\Pisymbol{psy}{226}\xspace} +\newcommand{\smalltrade}{{\tiny\trademark}\xspace} +\newcommand{\smallreg}{{\tiny\regmark}\xspace} +\newcommand{\smallcopy}{{\tiny\copyright}\xspace} +\newcommand{\ust}{\textsup{st}} +\newcommand{\und}{\textsup{nd}} +\newcommand{\urd}{\textsup{rd}} +\newcommand{\uth}{\textsup{th}} + +%---------------------------------------- +% MATH SYMBOLS +%---------------------------------------- +\newcommand{\R}{\ensuremath{\mathbb{R}}} +\newcommand{\N}{\ensuremath{\mathbb{N}}} +\newcommand{\Z}{\ensuremath{\mathbb{Z}}} +\newcommand{\C}{\ensuremath{\mathbb{C}}} +\newcommand{\Q}{\ensuremath{\mathbb{Q}}} +\newcommand{\powerset}{\ensuremath{\mathcal{P}}} + +\DeclareMathOperator{\sgn}{sgn} + +%---------------------------------------- +% DEFAULT GRAPHICX CONFIGURATION +%---------------------------------------- + +\ifpdf + \DeclareGraphicsExtensions{.pdf,.png,.jpg,.jpeg,.gif} +\else + \DeclareGraphicsExtensions{.eps,.png,.jpg,.jpeg,.gif} +\fi +\graphicspath{{./}} + +%---------------------------------------- +% FIGURES +%---------------------------------------- + +\newcommand{\upm@mfigure}[5][ht]{ + \begin{figure}[#1]% + \begin{center}% + \includegraphics[#2]{#3}% + \caption{#4}% + \label{fig:#5}% + \end{center}% + \end{figure}% +} +\newcommand{\upm@mfigurestar}[5][ht]{ + \begin{figure*}[#1]% + \begin{center}% + \includegraphics[#2]{#3}% + \caption{#4}% + \label{fig:#5}% + \end{center}% + \end{figure*}% +} +%----- +%\mfigure[position]{options}{filename}{caption}{label} +\def\mfigure{\@ifstar\upm@mfigurestar\upm@mfigure} +%----- +%\figref{label} +\newcommand{\figref}[1]{\ref{fig:#1}} +%----- +%\figpageref{label} +\newcommand{\figpageref}[1]{\pageref{fig:#1}} + +%----- +% Multi-figures + +\newcounter{upm@subfigure@count} + +\newcommand{\upm@beginsubfigure}[4]{ + \let\upm@mfiguresaved\mfigure + %options,filename,caption,label + \renewcommand{\mfigure}[5][]{ + \xdef\upm@tmp@subfigure@label{\alph{upm@subfigure@count}}% + \subfigure[##4]{% + \includegraphics[##2]{##3}% + \label{fig:##5}% + \label{fig:#4:\upm@tmp@subfigure@label}% + }% + \addtocounter{upm@subfigure@count}{1}% + } + %options,filename,caption + \newcommand{\msubfigure}[3]{ + \xdef\upm@tmp@subfigure@label{\alph{upm@subfigure@count}}% + \subfigure[##3]{% + \includegraphics[##1]{##2}% + \label{fig:#4:\upm@tmp@subfigure@label}% + }% + \addtocounter{upm@subfigure@count}{1}% + } + \setcounter{upm@subfigure@count}{1} + \gdef\upm@mfigurescaption{#3}% + \gdef\upm@mfigureslabel{fig:#4}% + \begin{#1}[#2]\centering % +} + +\newcommand{\upm@endsubfigure}[1]{ + \caption{\upm@mfigurescaption}% + \label{\upm@mfigureslabel}% + \end{#1}% + \let\mfigure\upm@mfiguresaved +} + +%----- +%\mfigures[position]{caption}{label} +\newenvironment{mfigures}[3][ht]{ + \upm@beginsubfigure{figure}{#1}{#2}{#3}% +}{% + \upm@endsubfigure{figure}% +} +%----- +%\mfigures*[position]{caption}{label} +\newenvironment{mfigures*}[3][ht]{ + \upm@beginsubfigure{figure*}{#1}{#2}{#3}% +}{% + \upm@endsubfigure{figure*}% +} + +%---------------------------------------- +% IMAGES INCLUDING TeX EXPRESSIONS +%---------------------------------------- + +% +% This section is copied from the AutoLaTeX package +% http://www.arakhne.org/autolatex +% + +%----- +%\DeclareGraphicsExtensionsWtex{coma separated extensions} +\providecommand{\DeclareGraphicsExtensionsWtex}[1]{% + \xdef\@autolatex@wtfig@extensions{\zap@space#1 \@empty}% +} +\ifpdf + \DeclareGraphicsExtensionsWtex{.pdftex_t,.pdf_tex} +\else + \DeclareGraphicsExtensionsWtex{.pstex_t,.ps_tex} +\fi + +\providecommand{\@autolatex@wtfig@searchinpath}[1]{% + \IfFileExists{#1}{% + \protected@edef\@autolatex@wtfig@tmp{\protect\resizebox{\@autolatex@wtfig@width}{\@autolatex@wtfig@height}{\protect\input{#1}}}% + }{% + \@for\@autolatex@wtfig@pathtmp:=\Ginput@path\do{% + \ifx\@autolatex@wtfig@tmp\relax% + \IfFileExists{\@autolatex@wtfig@pathtmp#1}{% + \protected@edef\@autolatex@wtfig@tmp{\protect\resizebox{\@autolatex@wtfig@width}{\@autolatex@wtfig@height}{\protect\input{\@autolatex@wtfig@pathtmp#1}}}% + }{}% + \fi% + }% + }% +} + +\define@key[autolatex]{withtex}{width}{% + \gdef\@autolatex@wtfig@width{#1}% +} +\define@key[autolatex]{withtex}{height}{% + \gdef\@autolatex@wtfig@height{#1}% +} + +%----- +%\includefigurewtex[width=xx,height=yy]{filename} +\providecommand{\includefigurewtex}[2][width=\linewidth]{% + \begingroup% + \gdef\@autolatex@wtfig@width{!}% + \gdef\@autolatex@wtfig@height{!}% + \setkeys[autolatex]{withtex}{#1}% + % + \global\let\@autolatex@wtfig@tmp\relax% + \global\let\@autolatex@wtfig@ext\relax% + \global\let\@autolatex@wtfig@path\relax% + \filename@parse{#2}% + \ifx\filename@ext\relax% + \@for\@autolatex@wtfig@exttmp:=\@autolatex@wtfig@extensions\do{% + \@autolatex@wtfig@searchinpath{#2\@autolatex@wtfig@exttmp}% + }% + \else% + \@autolatex@wtfig@searchinpath{#2\@autolatex@wtfig@exttmp}% + \fi% + % + \ifx\@autolatex@wtfig@tmp\relax% + \errmessage{Package upmethodology-fmt: File not found '#2', needed for figure inclusion}% + \else% + \@autolatex@wtfig@tmp% + \fi% + % + \endgroup% +} + +\global\let\includegraphicswtex\includefigurewtex + +%---------------------------------------- +% ENVIRONMENT FOR IMAGES INCLUDING TeX EXPRESSIONS +%---------------------------------------- + +\gdef\upm@figtex@dyncaption@remove{} +\gdef\upm@figtex@figremove#1{% + \global\expandafter\let\csname FIG#1\endcsname\relax% +} +\gdef\upm@figtex@restore{% + \upm@figtex@dyncaption@remove% + \gdef\upm@figtex@dyncaption@remove{} +} +%----- +%\figmath{id}{content} +\def\figmath#1#2{% + \expandafter\gdef\csname FIG#1\endcsname{\ensuremath{#2}}% + \global\protected@edef\upm@figtex@dyncaption@remove{\upm@figtex@dyncaption@remove\protect\upm@figtex@figremove{#1}}% +} +%----- +%\figtext{id}{content} +\def\figtext#1#2{% + \expandafter\gdef\csname FIG#1\endcsname{#2}% + \global\protected@edef\upm@figtex@dyncaption@remove{\upm@figtex@dyncaption@remove\protect\upm@figtex@figremove{#1}}% +} + +\let\upm@fmt@figtex@nil\@nil +\def\upm@fmt@figtex@parseparams#1=#2\upm@fmt@figtex@nil{\gdef\@tmp{#2}} + +\newcommand{\upm@mfigurewtex}[5][ht]{ + \begin{figure}[#1]% + \begin{center}% + % Providing an ascendent compatibility on the second parameter: + % - Prefered value of the parameter: a list of key/value pairs; + % - Old fashion value of the parameter: the value for the "width" key. + {\upm@fmt@figtex@parseparams #2====\upm@fmt@figtex@nil}% + \ifthenelse{\equal{\@tmp}{===}}{% + \includegraphicswtex[width=#2]{#3}% + }{% + \includegraphicswtex[#2]{#3}% + }% + \caption{#4}% + \label{fig:#5}% + \end{center}% + \end{figure}% + \upm@figtex@restore% +} +\newcommand{\upm@mfigurewtexstar}[5][ht]{ + \begin{figure*}[#1]% + \begin{center}% + % Providing an ascendent compatibility on the second parameter: + % - Prefered value of the parameter: a list of key/value pairs; + % - Old fashion value of the parameter: the value for the "width" key. + {\upm@fmt@figtex@parseparams #2====\upm@fmt@figtex@nil}% + \ifthenelse{\equal{\@tmp}{===}}{% + \includegraphicswtex[width=#2]{#3}% + }{% + \includegraphicswtex[#2]{#3}% + }% + \caption{#4}% + \label{fig:#5}% + \end{center}% + \end{figure*}% + \upm@figtex@restore% +} +%----- +%\mfigurewtex[position]{options}{filename}{caption}{label} +\def\mfigurewtex{\@ifstar\upm@mfigurewtexstar\upm@mfigurewtex} + + + +%---------------------------------------- +% TABLES +%---------------------------------------- + +%table's colors +\definecolor{backtableheader}{rgb}{0.92,0.94,1} +\definecolor{fronttableheader}{rgb}{0.23,0.33,0.48} +%title of a table +\def\upm@fmt@table@title#1{\color{fronttableheader} \cellcolor{backtableheader} {\bfseries #1}} +%title of columns +\def\upm@fmt@table@column@title#1{\hfil{\color{fronttableheader} \cellcolor{backtableheader} {\itshape#1}}\hfil} + +% Utility functions for mtabular +\newcounter{upm@fmt@mtabular@columnnumber} + +\gdef\upm@fmt@mtabular@expandtitle#1#2{% + \multicolumn{#1}{|c|}{\upm@fmt@table@title{\ignorespaces#2\ignorespaces}}% +} + +\newcommand{\tabulartitlespec}[1]{% + \gdef\upm@fmt@mtabular@expandtitle##1##2{% + \multicolumn{##1}{#1}{\upm@fmt@table@title{\ignorespaces##2\ignorespaces}}% + } +} + +%----- +%\mtabular[width]{ncolumns}{columns} +\newenvironment{mtabular}[3][\linewidth]{% + \newcommand{\tabulartitle}[1]{% + \hline% + \upm@fmt@mtabular@expandtitle{#2}{##1} \\% + \hline% + }% + \newcommand{\tabulartitleinside}[1]{% + \hline\hline% + \upm@fmt@mtabular@expandtitle{#2}{##1} \\% + \hline% + }% + \newcommand*{\upm@fmt@mtabular@column@next}[1]{% + & \upm@fmt@table@column@title{\ignorespaces##1\ignorespaces}% + \addtocounter{upm@fmt@mtabular@columnnumber}{-1}% + \ifnum0<\value{upm@fmt@mtabular@columnnumber}% + \let\upm@fmt@mtabular@column@continue\upm@fmt@mtabular@column@next% + \else% + \\ \hline \let\upm@fmt@mtabular@column@continue\relax% + \fi% + \upm@fmt@mtabular@column@continue% + } + \newcommand*{\upm@fmt@mtabular@column@first}[1]{% + \upm@fmt@table@column@title{\ignorespaces##1\ignorespaces}% + \addtocounter{upm@fmt@mtabular@columnnumber}{-1}% + \ifnum0<\value{upm@fmt@mtabular@columnnumber}% + \let\upm@fmt@mtabular@column@continue\upm@fmt@mtabular@column@next% + \else% + \\ \hline \let\upm@fmt@mtabular@column@continue\relax% + \fi% + \upm@fmt@mtabular@column@continue% + } + \newcommand{\tabularheader}{% + \setcounter{upm@fmt@mtabular@columnnumber}{#2}% + \upm@fmt@mtabular@column@first% + }% + \newcommand{\tabularrowheader}[1]{% + \centering\upm@fmt@table@column@title{\ignorespaces##1}% + }% + \begingroup\tabularx{#1}{#3}% +}{% + \endtabularx\endgroup% +} + +%----- +%\mtable[options]{width}{ncolumns}{columns}{caption}{label} +% size= +\define@key[autolatex]{mtable}{size}{\gdef\@autolatex@mtable@size{#1}} +% position: h t b p H ! +\define@key[autolatex]{mtable}{h}[\relax]{\gdef\@autolatex@mtable@position{h}} +\define@key[autolatex]{mtable}{t}[\relax]{\gdef\@autolatex@mtable@position{t}} +\define@key[autolatex]{mtable}{b}[\relax]{\gdef\@autolatex@mtable@position{b}} +\define@key[autolatex]{mtable}{p}[\relax]{\gdef\@autolatex@mtable@position{p}} +\define@key[autolatex]{mtable}{H}[\relax]{\gdef\@autolatex@mtable@position{H}} +\define@key[autolatex]{mtable}{ht}[\relax]{\gdef\@autolatex@mtable@position{ht}} +\define@key[autolatex]{mtable}{hb}[\relax]{\gdef\@autolatex@mtable@position{hb}} +\define@key[autolatex]{mtable}{hp}[\relax]{\gdef\@autolatex@mtable@position{hp}} +\define@key[autolatex]{mtable}{hH}[\relax]{\gdef\@autolatex@mtable@position{hH}} +\define@key[autolatex]{mtable}{h!}[\relax]{\gdef\@autolatex@mtable@position{h!}} +\define@key[autolatex]{mtable}{tb}[\relax]{\gdef\@autolatex@mtable@position{tb}} +\define@key[autolatex]{mtable}{tp}[\relax]{\gdef\@autolatex@mtable@position{tp}} +\define@key[autolatex]{mtable}{tH}[\relax]{\gdef\@autolatex@mtable@position{tH}} +\define@key[autolatex]{mtable}{t!}[\relax]{\gdef\@autolatex@mtable@position{t!}} +\define@key[autolatex]{mtable}{bp}[\relax]{\gdef\@autolatex@mtable@position{bp}} +\define@key[autolatex]{mtable}{bH}[\relax]{\gdef\@autolatex@mtable@position{bH}} +\define@key[autolatex]{mtable}{b!}[\relax]{\gdef\@autolatex@mtable@position{b!}} +\define@key[autolatex]{mtable}{pH}[\relax]{\gdef\@autolatex@mtable@position{pH}} +\define@key[autolatex]{mtable}{p!}[\relax]{\gdef\@autolatex@mtable@position{p!}} +\define@key[autolatex]{mtable}{H!}[\relax]{\gdef\@autolatex@mtable@position{H!}} +\define@key[autolatex]{mtable}{htb}[\relax]{\gdef\@autolatex@mtable@position{htb}} +\define@key[autolatex]{mtable}{htp}[\relax]{\gdef\@autolatex@mtable@position{htp}} +\define@key[autolatex]{mtable}{htH}[\relax]{\gdef\@autolatex@mtable@position{htH}} +\define@key[autolatex]{mtable}{ht!}[\relax]{\gdef\@autolatex@mtable@position{ht!}} +\define@key[autolatex]{mtable}{tbp}[\relax]{\gdef\@autolatex@mtable@position{tbp}} +\define@key[autolatex]{mtable}{tbH}[\relax]{\gdef\@autolatex@mtable@position{tbH}} +\define@key[autolatex]{mtable}{tb!}[\relax]{\gdef\@autolatex@mtable@position{tb!}} +\define@key[autolatex]{mtable}{bpH}[\relax]{\gdef\@autolatex@mtable@position{bpH}} +\define@key[autolatex]{mtable}{bp!}[\relax]{\gdef\@autolatex@mtable@position{bp!}} +\define@key[autolatex]{mtable}{pH!}[\relax]{\gdef\@autolatex@mtable@position{pH!}} +\define@key[autolatex]{mtable}{htbp}[\relax]{\gdef\@autolatex@mtable@position{htbp}} +\define@key[autolatex]{mtable}{htbH}[\relax]{\gdef\@autolatex@mtable@position{htbH}} +\define@key[autolatex]{mtable}{htb!}[\relax]{\gdef\@autolatex@mtable@position{htb!}} +\define@key[autolatex]{mtable}{tbpH}[\relax]{\gdef\@autolatex@mtable@position{tbpH}} +\define@key[autolatex]{mtable}{tbp!}[\relax]{\gdef\@autolatex@mtable@position{tbp!}} +\define@key[autolatex]{mtable}{bpH!}[\relax]{\gdef\@autolatex@mtable@position{bph!}} +\define@key[autolatex]{mtable}{htbpH}[\relax]{\gdef\@autolatex@mtable@position{htbpH}} +\define@key[autolatex]{mtable}{htbp!}[\relax]{\gdef\@autolatex@mtable@position{htbp!}} +\define@key[autolatex]{mtable}{htbpH!}[\relax]{\gdef\@autolatex@mtable@position{htbpH!}} +% +\newenvironment{mtable}[6][ht]{% + \global\let\@autolatex@mtable@position\relax% + \gdef\@autolatex@mtable@size{\normalsize}% + \setkeys[autolatex]{mtable}{#1}% + \ifx\@autolatex@mtable@position\relax% + \gdef\@autolatex@mtable@position{ht}% + \fi + % + \gdef\upm@table@caption{#5}% + \xdef\upm@table@label{tab:#6}% + \gdef\upm@table@note{}% + \newcommand{\captionastitle}{\tabulartitle{\upm@table@caption}}% + \newcommand{\tablenote}[1]{\gdef\upm@table@note{\bgroup ##1\egroup}}% + \expandafter\table[\@autolatex@mtable@position]% + \center\@autolatex@mtable@size% + \mtabular[#2]{#3}{#4}% +}{% + \endmtabular\relax% + \caption{\upm@table@caption}% + \label{\upm@table@label}% + \endcenter% + \upm@table@note% + \endtable% + \global\let\upm@table@caption\relax% + \global\let\upm@table@label\relax% + \global\let\upm@table@note\relax% +} + +%----- +%\tabref{label} +\newcommand{\tabref}[1]{\ref{tab:#1}} +%----- +%\tabpageref{label} +\newcommand{\tabpageref}[1]{\pageref{tab:#1}} + +%---------------------------------------- +% PARAGRAPHS +%---------------------------------------- +\setlength{\parindent}{0pt} +\setlength{\parskip}{.2cm} + +%---------------------------------------- +% COLORIZED SECTION'S TITLES +%---------------------------------------- + +% PRIVATE COLORS +\definecolor{sectiontitlecolor}{rgb}{0.93,0.41,0} +\definecolor{chaptertitlecolor}{rgb}{0.24,0.33,0.48} +\definecolor{parttitlecolor}{rgb}{0.24,0.33,0.48} + +% PRIVATE FORMATTING MACROS +\newcounter{upm@format@section@sectionlevel} +\setcounter{upm@format@section@sectionlevel}{0} + +\gdef\upm@format@partnum#1{\textcolor{parttitlecolor}{\expandafter\fontsize{40pt}{60pt}\selectfont#1\normalfont}} +\gdef\upm@format@parttitle#1{\textcolor{parttitlecolor}{\huge\scshape #1}} +\gdef\upm@format@chapternum#1{\textcolor{chaptertitlecolor}{\expandafter\fontsize{40pt}{60pt}\selectfont#1\normalfont}} +\gdef\upm@format@chaptertitle#1{\textcolor{chaptertitlecolor}{\Huge\scshape #1}} +\gdef\upm@format@sectionnum#1#2{\textcolor{sectiontitlecolor}{#2}} +\gdef\upm@format@sectiontitle#1#2{\textcolor{sectiontitlecolor}{#2}} + +% PART +\ifupmbookformat + \gdef\@part[#1]#2{% + \ifnum \c@secnumdepth >-2\relax + \refstepcounter{part}% + \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% + \else + \addcontentsline{toc}{part}{#1}% + \fi + \markboth{}{}% + {\huge\centering + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >-2\relax + \upm@format@partnum{\thepart} + \par + \vskip 20\p@ + \fi + \upm@format@parttitle{\nohyphens{#2}}\par}% + \@endpart} + \gdef\@spart#1{% + {\centering + \interlinepenalty \@M + \normalfont + \upm@format@parttitle{\nohyphens{#1}}\par}% + \@endpart} +\fi + +% CHAPTER +\ifupmarticleformat\else + \newcommand{\upm@format@makechapterhead}[2]{% + %\vspace*{50\p@}% + {\parindent \z@ \Huge \raggedleft \normalfont + \ifx\@empty#1\ifnum \c@secnumdepth >\m@ne + \upm@format@chapternum{\thechapter} + \par\nobreak + \vskip 20\p@ + \fi\fi + \interlinepenalty\@M + %\ifupmbookformat\doublespacing\fi + \upm@format@chaptertitle{\nohyphens{#2}}\par\nobreak + \vskip 80\p@ + } + } + %internal implementation of \chapter + \gdef\@makechapterhead#1{\upm@format@makechapterhead{\@empty}{#1}} + %internal implementation of \chapter* + \gdef\@makeschapterhead#1{\upm@format@makechapterhead{\relax}{#1}} +\fi + +% SECTIONS +\let\upm@format@sect@old\@sect +\let\upm@format@ssect@old\@ssect + +% public implementation of sections. +\renewcommand{\section}{\setcounter{upm@format@section@sectionlevel}{1}\@startsection{section}{1}{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus.2ex}{\normalfont\Large\scshape}} +\renewcommand{\subsection}{\setcounter{upm@format@section@sectionlevel}{2}\@startsection{subsection}{2}{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\large\scshape}} +\renewcommand{\subsubsection}{\setcounter{upm@format@section@sectionlevel}{3}\@startsection{subsubsection}{3}{\z@}{-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}{\normalfont\normalsize\scshape}} + +% internal implementations for sections. +\gdef\@sect#1#2#3#4#5#6[#7]#8{\upm@format@sect@old{#1}{#2}{#3}{#4}{#5}{#6}[#7]{\upm@format@sectiontitle{\theupm@format@section@sectionlevel}{#8}}} +\gdef\@ssect#1#2#3#4#5{\upm@format@ssect@old{#1}{#2}{#3}{#4}{\upm@format@sectiontitle{\theupm@format@section@sectionlevel}{#5}}} +\gdef\@seccntformat#1{\upm@format@sectionnum{\theupm@format@section@sectionlevel}{\csname the#1\endcsname/}\quad} + +%---------------------------------------- +% PAGE LAYOUT +%---------------------------------------- + +% Change the factors for determining the element positions +\renewcommand{\topfraction}{.99} % max fraction of floats at top +\renewcommand{\bottomfraction}{.99} % max fraction of floats at bottom +\renewcommand{\textfraction}{.5} % allow minimal text w. figs +\renewcommand{\dbltopfraction}{.66} % fit big float above 2-col. text +\renewcommand{\floatpagefraction}{0.99} % require fuller float pages | N.B.: floatpagefraction MUST be less than topfraction !! +\renewcommand{\dblfloatpagefraction}{.66} % fit big float above 2-col. text + +% Update the format of the saved pages and sections +\renewcommand{\sectionmark}[1]{\markright{\thesection\ \textsc{#1}}} +\ifupmarticleformat\else +\renewcommand{\chaptermark}[1]{\markboth{\textsc{#1}}{}} +\renewcommand{\@mkboth}[2]{% + \let\upm@doc@MakeUppercase\MakeUppercase% + \gdef\MakeUppercase##1{##1}% + \chaptermark{#1}% + \let\MakeUppercase\upm@doc@MakeUppercase% + \let\upm@doc@MakeUppercase\relax% +} +\fi +% Make sure that the page before a part or +% a chapter title was empty +\renewcommand{\cleardoublepage}{% + \clearpage% + \if@twoside\ifodd\c@page% + \else% + \thispagestyle{facingtochapter}% + \hbox{}\newpage% + \if@twocolumn\hbox{}\newpage% + \fi\fi\fi% +} +\newcommand{\ps@facingtochapter}{\ps@empty} + +%---------------------------------------- +% ADDITIONAL SECTIONS +%---------------------------------------- + +\gdef\upm@format@newsection@alignment{} + +%----- +% Part without number but inside the TOC +%\parttoc [toctitle]{title} % left-alignment inside TOC +%\parttoc*[toctitle]{title} % right-alignment inside TOC +\def\parttoc{\@ifstar% + {\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@part}% + {\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@part}} +\def\upm@format@newsection@part{\@ifnextchar [% + {\expandafter\upm@format@newsection@part@opt}% + {\expandafter\upm@format@newsection@part@nopt}} +\def\upm@format@newsection@part@opt[#1]#2{% + \part*{#2\addcontentsline{toc}{part}{\upm@format@newsection@alignment{#1}}}% + \chaptermark{}% +} +\def\upm@format@newsection@part@nopt#1{% + \part*{#1\addcontentsline{toc}{part}{\upm@format@newsection@alignment{#1}}}% + \chaptermark{}% +} + +%----- +% Chapter without number but inside the TOC +%\chaptertoc [toctitle]{title} % left-alignment inside TOC +%\chaptertoc*[toctitle]{title} % right-alignment inside TOC +\def\chaptertoc{\@ifstar% + {\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@chapter}% + {\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@chapter}} + +\def\upm@format@newsection@chapter{\@ifnextchar[% + {\upm@format@newsection@chapter@a}% + {\upm@format@newsection@chapter@b}% +} + +\def\upm@format@newsection@chapter@a[#1]#2{% + \expandafter\chapter*[#1]{#2}% + \addcontentsline{toc}{chapter}{\upm@format@newsection@alignment{#1}}% + \@ifundefined{minitoc}{}{% + \global\addtocounter{mtc}{1}% + }% +} + +\def\upm@format@newsection@chapter@b#1{% + \expandafter\chapter*{#1}% + \addcontentsline{toc}{chapter}{\upm@format@newsection@alignment{#1}}% + \@ifundefined{minitoc}{}{% + \global\addtocounter{mtc}{1}% + }% +} + +%----- +% Section without number but inside the TOC +%\sectiontoc [toctitle]{title} % left-alignment inside TOC +%\sectiontoc*[toctitle]{title} % right-alignment inside TOC +\def\sectiontoc{\@ifstar% + {\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@section}% + {\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@section}} +\def\upm@format@newsection@section{\@ifnextchar [% + {\expandafter\upm@format@newsection@section@opt}% + {\expandafter\upm@format@newsection@section@nopt}} +\def\upm@format@newsection@section@opt[#1]#2{% + \section*{#2\addcontentsline{toc}{section}{\upm@format@newsection@alignment{#1}}}% +} +\def\upm@format@newsection@section@nopt#1{% + \section*{#1\addcontentsline{toc}{section}{\upm@format@newsection@alignment{#1}}}% +} + +%----- +% Subsection without number but inside the TOC +%\subsectiontoc [toctitle]{title} % left-alignment inside TOC +%\subsectiontoc*[toctitle]{title} % right-alignment inside TOC +\def\subsectiontoc{\@ifstar% + {\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@subsection}% + {\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@subsection}} +\def\upm@format@newsection@subsection{\@ifnextchar [% + {\expandafter\upm@format@newsection@subsection@opt}% + {\expandafter\upm@format@newsection@subsection@nopt}} +\def\upm@format@newsection@subsection@opt[#1]#2{% + \subsection*{#2\addcontentsline{toc}{subsection}{\upm@format@newsection@alignment{#1}}}% +} +\def\upm@format@newsection@subsection@nopt#1{% + \subsection*{#1\addcontentsline{toc}{subsection}{\upm@format@newsection@alignment{#1}}}% +} + +%----- +% Subsubsection without number but inside the TOC +%\subsubsectiontoc [toctitle]{title} % left-alignment inside TOC +%\subsubsectiontoc*[toctitle]{title} % right-alignment inside TOC +\def\subsubsectiontoc{\@ifstar% + {\gdef\upm@format@newsection@alignment{\protect\numberline{}}\expandafter\upm@format@newsection@subsubsection}% + {\gdef\upm@format@newsection@alignment{}\expandafter\upm@format@newsection@subsubsection}} +\def\upm@format@newsection@subsubsection{\@ifnextchar [% + {\expandafter\upm@format@newsection@subsubsection@opt}% + {\expandafter\upm@format@newsection@subsubsection@nopt}} +\def\upm@format@newsection@subsubsection@opt[#1]#2{% + \subsubsection*{#2\addcontentsline{toc}{subsubsection}{\upm@format@newsection@alignment{#1}}}% +} +\def\upm@format@newsection@subsubsection@nopt#1{% + \subsubsection*{#1\addcontentsline{toc}{subsubsection}{\upm@format@newsection@alignment{#1}}}% +} + +%----- +% Chapter with different titles for in the TOC, the headers and on the pages +%\chapterfull[in toc]{on page}{in header} % with number +%\chapterfull*[in toc]{on page}{in header} % without number +\def\chapterfull{\@ifstar% + {\gdef\upm@format@newsection@thesectionmacro{\chapter*}\upm@format@newsection@chapterfull}% + {\gdef\upm@format@newsection@thesectionmacro{\chapter}\upm@format@newsection@chapterfull}% +} + +\def\upm@format@newsection@chapterfull{\@ifnextchar[% + \upm@format@newsection@chapterfull@a% + \upm@format@newsection@chapterfull@b% +} + +\def\upm@format@newsection@chapterfull@a[#1]#2#3{% + \upm@format@newsection@thesectionmacro[#1]{#2}% + \chaptermark{#3}% +} + +\def\upm@format@newsection@chapterfull@b#1#2{% + \upm@format@newsection@thesectionmacro{#1}% + \chaptermark{#2}% +} + +%----- +% Section with different titles for in the TOC, the headers and on the pages +%\sectionfull[in toc]{on page}{in header} % with number +%\sectionfull*[in toc]{on page}{in header} % without number +\def\sectionfull{\@ifstar% + {\gdef\upm@format@newsection@thesectionmacro{\section*}\upm@format@newsection@sectionfull}% + {\gdef\upm@format@newsection@thesectionmacro{\section}\upm@format@newsection@sectionfull}% +} + +\def\upm@format@newsection@sectionfull{\@ifnextchar[% + \upm@format@newsection@sectionfull@a% + \upm@format@newsection@sectionfull@b% +} + +\def\upm@format@newsection@sectionfull@a[#1]#2#3{% + \upm@format@newsection@thesectionmacro[#1]{#2}% + \global\sectionmark{#3}% +} + +\def\upm@format@newsection@sectionfull@b#1#2{% + \upm@format@newsection@thesectionmacro{#1}% + \global\sectionmark{#2}% +} + +%---------------------------------------- +% BIBLIOGRAPHY +%---------------------------------------- + +%----- +%\bibsize{size} +\newcommand{\bibsize}[1]{\gdef\upm@bibsize{#1}} + +\gdef\upm@bibsize{\small} + +\gdef\@biblabel#1{{\upm@bibsize{[#1]}}} + +\gdef\@lbibitem[#1]#2{\item[\@biblabel{#1}\hfill]\upm@bibsize\if@filesw{% + \let\protect\noexpand\immediate\write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces} + +\gdef\@bibitem#1{\item\upm@bibsize\if@filesw% + \immediate\write\@auxout{\string\bibcite{#1}{\the\value{\@listctr}}}\fi\ignorespaces} + + +%---------------------------------------- +% TABLE OF CONTENT +%---------------------------------------- +\setcounter{secnumdepth}{3} +\setcounter{tocdepth}{3} + +% Change the color of the TOC for the "dotted" lines +%\let\upm@format@dottedtocline@old\@dottedtocline +%\gdef\@dottedtocline#1#2#3#4#5{% +% %{depth}{left margin}{right margin}{text}{page number} +% \upm@format@dottedtocline@old{#1}{#2}{#3}{#4}{#5}% +%} + +% Change the color of the TOC for the parts +\@ifundefined{l@part}{}{ +\let\upm@format@l@part@old\l@part +\renewcommand*\l@part[2]{% + %{text}{page number} + \upm@format@l@part@old{\textcolor{parttitlecolor}{#1}}{\textcolor{parttitlecolor}{#2}}% +} +} + +% Change the color of the TOC for the chapters +\@ifundefined{l@chapter}{}{ +\let\upm@format@l@chapter@old\l@chapter +\renewcommand*\l@chapter[2]{% + %{text}{page number} + \upm@format@l@chapter@old{\textcolor{chaptertitlecolor}{#1}}{\textcolor{chaptertitlecolor}{#2}}% +} +} + +% Overide the color and font configurations of the MINITOC package +\AtBeginDocument{ + \@ifundefined{minitoc}{}{% + % Chapter + \gdef\mtifont{\normalfont\large\upshape\bfseries\color{chaptertitlecolor}} + % Section + \gdef\mtcSfont{\normalfont\small\upshape\bfseries\color{sectiontitlecolor}} + % Sub-Section and SubSub-Section + \gdef\mtcSSfont{\normalfont\small\upshape\mdseries\normalcolor} + \global\let\mtcSSSfont\mtcSSfont + } +} + +%---------------------------------------- +% ENUMERATIONS +%---------------------------------------- +\newcounter{upm@fmt@savedcounter} + +\newcommand{\savecounter}[1]{% + \setcounter{upm@fmt@savedcounter}{\value{#1}}% +} +\newcommand{\restorecounter}[1]{% + \setcounter{#1}{\theupm@fmt@savedcounter}% +} +\newcommand{\saveenumcounter}{\savecounter{\@enumctr}} +\newcommand{\restoreenumcounter}{\restorecounter{\@enumctr}} +\newcommand{\setenumcounter}[1]{\setcounter{\@enumctr}{#1}\addtocounter{\@enumctr}{-1}} +\newcommand{\getenumcounter}{\value{\@enumctr}} + +%---------------------------------------- +% FOOTNOTE +%---------------------------------------- + +\gdef\upm@footnoteref#1{\upm@textsuperscript{#1}} +\gdef\upm@footnotepageref#1#2{\upm@textsuperscript{{#1\tiny(#2)}}} + +\def\upm@savefootnote#1#2{% + \footnote{#1\label{\upm@protect{footnote:#2}}}% + \upm@nameundef{footnote:#2:cmd}% +} +\def\upm@savefootnotestar#1#2{% + \upm@namedef{footnote:#2:cmd}{\upm@savefootnote{#1}{#2}}% +} + +\DeclareRobustCommand\savefootnote{\@ifstar\upm@savefootnotestar\upm@savefootnote} + +\def\upm@reffootnote#1{% + \upm@ifdefinedname{footnote:#1:cmd}{% + \upm@nameuse{footnote:#1:cmd}}{% + \upm@footnoteref{\upm@getref{\upm@protect{footnote:#1}}}% + }% + \xspace% +} +\def\upm@reffootnotestar#1{% + \upm@ifdefinedname{footnote:#1:cmd}{% + \upm@nameuse{footnote:#1:cmd}}{% + \xdef\upm@tmp@tmp{\upm@protect{footnote:#1}}% + \upm@footnotepageref{\expandafter\upm@getref{\upm@tmp@tmp}}{\expandafter\upm@getpageref{\upm@tmp@tmp}}% + \global\let\upm@tmp@tmp\relax% + }% + \xspace% +} + +\DeclareRobustCommand\reffootnote{\@ifstar\upm@reffootnotestar\upm@reffootnote} + +%---------------------------------------- +% IMAGES IN PARAGRAPHS +%---------------------------------------- + +\newenvironment{umlinpar}[2][width=.45\linewidth]{% +\begin{window}[0,r,{\mbox{\hspace{.5cm}\includegraphics[#1]{#2}\vspace{.5cm}}},{}] +}{% +\end{window}} + +%---------------------------------------- +% DATE +%---------------------------------------- + +%Build a date this a supported format +%\makedate{day}{month}{year} +\let\makedate\upm@format@lang@makedate + +%----- +%Replies the year corresponding to the given supported date +%\extractyear{date} +\let\extractyear\upm@format@lang@extractyear + +%----- +%Replies the month corresponding to the given supported date +%\extractmonth{date} +\let\extractmonth\upm@format@lang@extractmonth + +%----- +%Replies the day corresponding to the given supported date +%\extractday{date} +\let\extractday\upm@format@lang@extractday + +% Redefine the today function +\AtBeginDocument{\global\edef\today{\makedate{\the\day}{\the\month}{\the\year}}} + +%---------------------------------------- +% PEOPLE NAME +%---------------------------------------- + +\def\makenamespacing#1{% + \upm@format@makenamespacing{#1}\xspace% +} + +\def\upm@format@makenamespacing#1{% + \upm@foreach.\in#1\do{% + \ignorespaces\upm@foreach@term.\,% + }{% + \ignorespaces\upm@foreach@term% + }% +} + +\gdef\upm@format@people@title#1{\textsc{#1}} +\def\upm@format@firstname@format#1{% + {\smaller\textsc{\upm@format@makenamespacing{#1}}}% +} +\def\upm@format@von@format#1{\mbox{\smaller\ignorespaces#1}} +\def\upm@format@lastname@format#1{\textsc{\ignorespaces#1}} + +%\upmmakename[von]{firstname}{lastname}{separator} +\newcommand{\upmmakename}[4][\relax]{% + \ifx#1\relax% + {\upm@format@firstname@format{#2}#4\upm@format@lastname@format{#3}}% + \else% + {\upm@format@firstname@format{#2}#4\upm@format@von@format{#1}#4\upm@format@lastname@format{#3}}% + \fi% + \xspace% +} + +%\makename[von]{firstname}{lastname} +\newcommand{\makename}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }% +} + +%\makelastname[von]{lastname} +\newcommand{\makelastname}[2][\relax]{% + \ifx#1\relax% + \upm@format@lastname@format{#2}% + \else% + \upm@format@von@format{#1}\ \upm@format@lastname@format{#2}% + \fi% + \xspace% +} + +%\makefirstname{firstname} +\newcommand{\makefirstname}[1]{% + \upm@format@firstname@format{#1}\xspace% +} + +%\prname[von]{firstname}{lastname} +%\prname*[von]{firstname}{lastname} +\def\prname{\@ifstar\upm@prnamestar\upm@prname} +\newcommand{\upm@prname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@professor}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@prnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@professor}% +} + +%\drname[von]{firstname}{lastname} +%\drname*[von]{firstname}{lastname} +\def\drname{\@ifstar\upm@drnamestar\upm@drname} +\newcommand{\upm@drname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@doctor}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@drnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@doctor}% +} + +%\phdname[von]{firstname}{lastname} +%\phdname*[von]{firstname}{lastname} +\def\phdname{\@ifstar\upm@phdnamestar\upm@phdname} +\newcommand{\upm@phdname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@phdoctor}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@phdnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@phdoctor}% +} + +%\scdname[von]{firstname}{lastname} +%\scdname*[von]{firstname}{lastname} +\def\scdname{\@ifstar\upm@scdnamestar\upm@scdname} +\newcommand{\upm@scdname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@scdoctor}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@scdnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@scdoctor}% +} + +%\mdname[von]{firstname}{lastname} +%\mdname*[von]{firstname}{lastname} +\def\mdname{\@ifstar\upm@mdnamestar\upm@mdname} +\newcommand{\upm@mdname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@mdoctor}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@mdnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@mdoctor}% +} + +%\pengname[von]{firstname}{lastname} +%\pengname*[von]{firstname}{lastname} +\def\pengname{\@ifstar\upm@pengnamestar\upm@pengname} +\newcommand{\upm@pengname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@professionalengineer}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@pengnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@professionalengineer}% +} + +%\iengname[von]{firstname}{lastname} +%\iengname*[von]{firstname}{lastname} +\def\iengname{\@ifstar\upm@iengnamestar\upm@iengname} +\newcommand{\upm@iengname}[3][\relax]{% + \upm@format@people@title{\upm@format@lang@incorporatedengineer}\,\upmmakename[#1]{#2}{#3}{\ }% +} +\newcommand{\upm@iengnamestar}[3][\relax]{% + \upmmakename[#1]{#2}{#3}{\ }, \upm@format@people@title{\upm@format@lang@incorporatedengineer}% +} + +%---------------------------------------- +% INLINE ENUMERATION +%---------------------------------------- + +\newcounter{@@upm@fmt@inlineenumeration} +\newcommand{\inlineenumerationlabel}[1]{(#1)} +\let\upm@fmt@inlineenum@numberformat\roman +\newenvironment{inlineenumeration}{% + \begingroup% + \let\upm@fmt@inlineenum@currentlabel\@currentlabel% + \renewcommand{\item}{\xdef\@currentlabel{\upm@fmt@inlineenum@numberformat{@@upm@fmt@inlineenumeration}}{\inlineenumerationlabel{\@currentlabel}{\addtocounter{@@upm@fmt@inlineenumeration}{1}}}~}% + \setcounter{@@upm@fmt@inlineenumeration}{1}% +}{% + \global\let\@currentlabel\upm@fmt@inlineenum@currentlabel% + \endgroup% +} + +%---------------------------------------- +% DESCRIPTION LIST WITH NUMBERS +%---------------------------------------- + +\newcounter{@upm@fmt@enumdescription@cnt@} +\gdef\upm@fmt@enumdescription@savedlabel{} +\gdef\upm@fmt@enumdescription@savedcounter{} +\newcommand{\upm@fmt@enumdescription@fmt@}[1]{} +\newcommand{\enumdescriptionlabel}[1]{\textbf{#1}} +\newcommand{\enumdescriptioncounterseparator}{~-~} +\newcommand{\enumdescriptionlabelseparator}{\upm@column@char} +% #1: counter style. +% #2: text before the counter. +% #3: text after the counter. +% #4: text between the counter and the description. +% #5: text between the description and the rest of the text. +% #6: text between the counter (no description) and the rest of the text. +\newenvironment{upm@fmt@enumdescription}[6]{% + \begin{list}{}{% + \renewcommand{\upm@fmt@enumdescription@savedlabel}{\@currentlabel}% + \edef\upm@fmt@enumdescription@savedcounter{\the@upm@fmt@enumdescription@cnt@}% + \setcounter{@upm@fmt@enumdescription@cnt@}{1}% + \ifthenelse{\equal{#1}{a}}{% + \renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\alph{##1}#3}% + }{% + \ifthenelse{\equal{#1}{A}}{% + \renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\Alph{##1}#3}% + }{% + \ifthenelse{\equal{#1}{i}}{% + \renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\roman{##1}#3}% + }{% + \ifthenelse{\equal{#1}{I}}{% + \renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\Roman{##1}#3}% + }{% + \renewcommand{\upm@fmt@enumdescription@fmt@}[1]{#2\arabic{##1}#3}% + }% + }% + }% + }% + \renewcommand{\makelabel}[1]{% + \xdef\@currentlabel{\upm@fmt@enumdescription@fmt@{@upm@fmt@enumdescription@cnt@}}% + \enumdescriptionlabel{\@currentlabel#4##1\ifthenelse{\equal{a##1}{a}}{#6}{#5}}{\addtocounter{@upm@fmt@enumdescription@cnt@}{1}}}% + \expandafter\settowidth{\labelwidth}{#2iii#3}% + } +}{% + \global\let\@currentlabel\upm@fmt@enumdescription@savedlabel% + \setcounter{@upm@fmt@enumdescription@cnt@}{\upm@fmt@enumdescription@savedcounter}% + \end{list}% +} +\newenvironment{enumdescriptionx}[3][i]{% + \begin{upm@fmt@enumdescription}{#1}{#2}{#3}{\enumdescriptioncounterseparator}{\enumdescriptionlabelseparator}{\enumdescriptionlabelseparator}% +}{% + \end{upm@fmt@enumdescription}% +} +\newenvironment{enumdescription}[1][i]{% + \begin{upm@fmt@enumdescription}{#1}{}{}{\enumdescriptioncounterseparator}{\enumdescriptionlabelseparator}{\enumdescriptionlabelseparator}% +}{% + \end{upm@fmt@enumdescription}% +} + +%% Issue #14: enumerate behaves as enumdescription +\ifupm@use@override@standard@lists + + \AtBeginDocument{ + \message{*** Overriding the 'enumerate' environment. Pass option 'standardlists' for avoiding this override.} + \global\let\enumerate\@undefined + \global\let\endenumerate\@undefined + \global\NewEnviron{enumerate}[1][1\string.~]{% + % Parse the parameter for extracting the type of the enumeration, the prefix and the postfix + \in@{a}{#1}\ifin@ + \gdef\upm@fmt@enumerate@style{a}% + \def\reserved@a##1a##2\@nil{% + \def\upm@fmt@enumerate@prefix{##1}% + \def\upm@fmt@enumerate@postfix{##2}% + }% + \reserved@a#1\@nil% + \else\in@{1}{#1}\ifin@ + \gdef\upm@fmt@enumerate@style{1}% + \def\reserved@a##11##2\@nil{% + \def\upm@fmt@enumerate@prefix{##1}% + \def\upm@fmt@enumerate@postfix{##2}% + }% + \reserved@a#1\@nil% + \else\in@{A}{#1}\ifin@ + \gdef\upm@fmt@enumerate@style{A}% + \def\reserved@a##1A##2\@nil{% + \def\upm@fmt@enumerate@prefix{##1}% + \def\upm@fmt@enumerate@postfix{##2}% + }% + \reserved@a#1\@nil% + \else\in@{i}{#1}\ifin@ + \gdef\upm@fmt@enumerate@style{i}% + \def\reserved@a##1i##2\@nil{% + \def\upm@fmt@enumerate@prefix{##1}% + \def\upm@fmt@enumerate@postfix{##2}% + }% + \reserved@a#1\@nil% + \else\in@{I}{#1}\ifin@ + \gdef\upm@fmt@enumerate@style{I}% + \def\reserved@a##1I##2\@nil{% + \def\upm@fmt@enumerate@prefix{##1}% + \def\upm@fmt@enumerate@postfix{##2}% + }% + \reserved@a#1\@nil% + \else% + \errmessage{Invalid format of the enumerate counter} + \fi\fi\fi\fi\fi% + \protected@xdef\upm@tmp{\protect\protect\protect\begin{upm@fmt@enumdescription}{\upm@fmt@enumerate@style}{\upm@fmt@enumerate@prefix}{\upm@fmt@enumerate@postfix}{}{\protect\enumdescriptionlabelseparator}{}}% + % + \upm@tmp% + %\protect\begin{upm@fmt@enumdescription}{#1}{}{\string.~}{}{\enumdescriptionlabelseparator}{}% + \BODY% + \protect\end{upm@fmt@enumdescription}% + } + } +\fi + +%---------------------------------------- +% DESCRIPTION LIST WITH BULLETS +%---------------------------------------- +\ifupm@use@override@standard@lists + \gdef\upm@fmt@itemizeddescription@separator{\iflanguage{french}{ :}{:}\ } + \newcommand{\upm@fmt@itemizeddescription@formatdescription}[1]{\textbf{#1}} + \newcommand{\upm@fmt@itemizeddescription@desc}[2]{% + \upm@fmt@itemizeddescription@formatdescription{#1#2}% + } + \let\upm@fmt@olditem\item + \let\upm@item@param\upm@fmt@olditem + \let\upm@item@noparam\upm@fmt@olditem + \def\item{\@ifnextchar[\upm@item@param\upm@item@noparam} + \AtBeginDocument{ + \message{*** Overriding the 'description' environment. Pass option 'standardlists' for avoiding this override.} + \global\let\description\@undefined + \global\let\enddescription\@undefined + \global\NewEnviron{description}[1][\upm@fmt@itemizeddescription@separator]{ + \begin{itemize}% + \renewcommand{\upm@item@param}[1][]{\upm@fmt@olditem \upm@fmt@itemizeddescription@desc{##1}{#1}}% + \renewcommand{\upm@item@noparam}{\upm@fmt@olditem }% + \BODY% + \end{itemize}% + } + } +\fi + +%---------------------------------------- +% SIZE MANAGEMENT +%---------------------------------------- +\newenvironment{upmfontsize}[1]{% + \begingroup% + \let\upm@Huge\Huge% + \let\upm@huge\huge% + \let\upm@normalsize\normalsize% + \let\upm@small\small% + \let\upm@scriptsize\scriptsize% + \let\upm@footnotesize\footnotesize% + \let\upm@tiny\tiny% + % + \ifx#1\Huge% + \let\Huge\upm@Huge% + \let\huge\upm@Huge% + \let\small\upm@huge% + \let\scriptsize\upm@normalsize% + \let\footnotesize\upm@small% + \let\tiny\upm@scriptsize% + \else\ifx#1\huge% + \let\Huge\upm@Huge% + \let\huge\upm@Huge% + \let\small\upm@normalsize% + \let\scriptsize\upm@small% + \let\footnotesize\upm@scriptsize% + \let\tiny\upm@footnotesize% + \else\ifx#1\small% + \let\Huge\upm@huge% + \let\huge\upm@normalsize% + \let\small\upm@scriptsize% + \let\scriptsize\upm@footnotesize% + \let\footnotesize\upm@tiny% + \let\tiny\upm@tiny% + \else\ifx#1\scriptsize% + \let\Huge\upm@normalsize% + \let\huge\upm@small% + \let\small\upm@footnotesize% + \let\scriptsize\upm@tiny% + \let\footnotesize\upm@tiny% + \let\tiny\upm@tiny% + \else\ifx#1\footnotesize% + \let\Huge\upm@small% + \let\huge\upm@scriptsize% + \let\small\upm@tiny% + \let\scriptsize\upm@tiny% + \let\footnotesize\upm@tiny% + \let\tiny\upm@tiny% + \else\ifx#1\tiny% + \let\Huge\upm@scriptsize% + \let\huge\upm@footnotesize% + \let\small\upm@tiny% + \let\scriptsize\upm@tiny% + \let\footnotesize\upm@tiny% + \let\tiny\upm@tiny% + \fi% + \fi% + \fi% + \fi% + \fi% + \fi% + #1% +}{\endgroup} + +%---------------------------------------- +% FRAMED MINIPAGE +%---------------------------------------- + +\newsavebox{\upm@framed@minipage} +%\begin{framedminipage}{width}...\end{framedminipage} +\newenvironment{framedminipage}[1]{% + \begin{lrbox}{\upm@framed@minipage}\begin{minipage}{#1}% + }{% + \end{minipage}\end{lrbox}\fbox{\usebox{\upm@framed@minipage}}} + +%\begin{framedcolorminipage}{width}{border}{background}...\end{framedcolorminipage} +\newenvironment{framedcolorminipage}[3]{% + \newcommand{\upm@framed@minipage@border}{#2}% + \newcommand{\upm@framed@minipage@background}{#3}% + \begin{lrbox}{\upm@framed@minipage}\begin{minipage}{#1}% + }{% + \end{minipage}\end{lrbox}\fcolorbox{\upm@framed@minipage@border}{\upm@framed@minipage@background}{\usebox{\upm@framed@minipage}}} + +%---------------------------------------- +% HIGHLIGH BOXES +%---------------------------------------- + +\newsavebox{\upm@highlight@box@save} + +\newenvironment{upm@highligh@box}[2]{% + \par + \vspace{.5cm} + \begin{tabular}{|p{#1}|} + \hline + \begin{window}[0,l,{\mbox{\includegraphics[width=1cm]{#2}}},{}] +}{% + \end{window}\\ \hline \end{tabular} + \vspace{.5cm} + \par +} + +\newenvironment{upmcaution}[1][\linewidth]{% + \upm@highligh@box{#1}{caution.png}% +}{% + \endupm@highligh@box% +} + +\newenvironment{upminfo}[1][\linewidth]{% + \upm@highligh@box{#1}{info.png}% +}{% + \endupm@highligh@box% +} + +\newenvironment{upmquestion}[1][\linewidth]{% + \upm@highligh@box{#1}{question.png}% +}{% + \endupm@highligh@box% +} + +%---------------------------------------- +% PROVIDE URL MACROS, WHICH WILL BE +% OVERRIDDEN BY THE DOCUMENT CLASS +%---------------------------------------- + +\newcommand{\url}[2][]{\texttt{#2}} +\newcommand{\href}[3][]{\texttt{#3}} + +%---------------------------------------- +% Exponents and Indices +%---------------------------------------- +\renewcommand{\textup}[1]{\textsuperscript{#1}\xspace} +\def\@textsubscript#1{% + {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}} +\newcommand{\textsubscript}[1]{\@textsubscript{\selectfont#1}} +\newcommand{\textdown}[1]{\textsubscript{#1}\xspace} + + +%---------------------------------------- +% UNDERLINE +%---------------------------------------- + +\let\upm@oldunderline\underline +\renewcommand{\underline}[1]{\upm@oldunderline{\smash{#1}}} + +%---------------------------------------- +% ENVIRONMENT FOR DEFINITIONS +%---------------------------------------- + +%----- +% Defining the style for the definitions +\colorlet{definitionbackground}{backtableheader} +\colorlet{definitionheaderforeground}{fronttableheader} +\colorlet{definitionborder}{fronttableheader} +\colorlet{definitiontextforeground}{fronttableheader} + +\iflanguage{french}{ + \gdef\definitionname{D\'efinition} + \gdef\listdefinitionname{Liste des d\'efinitions} +}{ + \gdef\definitionname{Definition} + \gdef\listdefinitionname{List of Definitions} +} + +\gdef\upm@definition@width{.9\linewidth} +\gdef\upm@definition@rule@width{\linewidth} +\gdef\upm@definition@rule@height{0.4pt} + +\newtheoremstyle{upmdefinition}% name of the style to be used + {}% measure of space to leave above the theorem. E.g.: 3pt + {}% measure of space to leave below the theorem. E.g.: 3pt + {\normalfont}% name of font to use in the body of the theorem + {}% measure of space to indent the head + {\normalfont\bfseries}% name of head font + {\\[-1em]{\textcolor{definitionborder}{\rule{\upm@definition@rule@width}{\upm@definition@rule@height}}}}% punctuation between head and body + {\newline}% space after theorem head + {\textcolor{definitionheaderforeground}{\thmname{#1}\thmnumber{~#2}\upm@column@char\thmnote{ #3}}\vspace{.25em}}% Manually specify head + +%----- +% Declare a theorem with the standard UPM style +% \declareupmtheorem[theorem_style]{name}{label}{list_label} +\newcommand{\declareupmtheorem}[4][upmdefinition]{% + \global\declaretheorem[name={#3},style=#1]{upm#2}% + \global\newenvironment{#2}[1][]{% + \par\vspace{\parsep}\centering\begin{framedcolorminipage}{\upm@definition@width}{definitionborder}{definitionbackground}% + \color{definitiontextforeground}% + \begin{upm#2}[##1]% + }{% + \end{upm#2}% + \end{framedcolorminipage}\vspace{\parsep}\par% + }% + % Check the version of the thmtools because the TeXLive distribution + % gives a too old version. + \@ifpackagelater{thm-listof}{2012/05/03}{% + \global\@namedef{listof#2s}{% + \global\let\upm@definition@old@listtheoremname\listtheoremname% + \global\let\upm@definition@old@upmtheoremopt\upm@definition@upmtheoremopt% + \gdef\listtheoremname{#4}% + \renewcommand{\upm@definition@upmtheoremopt}[1]{}% + \expandafter\listoftheorems[ignoreall,show={upm#2}]% + \global\let\listtheoremname\upm@definition@old@listtheoremname% + \global\let\upm@definition@upmtheoremopt\upm@definition@old@upmtheoremopt% + }% + }{% + \@latex@warning{Your version of the thmtools is too old. I recommend you to install the version 2012/05/04, or later.} + \global\@namedef{listof#2s}{% + \global\let\upm@tmp\listtheoremname% + \gdef\listtheoremname{#4}% + \listoftheorems% + \global\let\listtheoremname\upm@tmp% + }% + } +} +\@onlypreamble\declareupmtheorem + +\gdef\thmtformatoptarg#1{\upm@column@char\ #1}% + +% Permits to define an part of the definition's name that is +% rendered only in core part of the document, not in the +% list of theorems +\gdef\upm@definition@upmtheoremopt#1{#1} +\gdef\upmtheoremopt#1{\protect\upm@definition@upmtheoremopt{#1}} + +%----- +% Declare the definition environment +\declareupmtheorem{definition}{\definitionname}{\listdefinitionname} + +%---------------------------------------- +% ENVIRONMENT FOR EMPHBOX +%---------------------------------------- + +%----- +% Defining the style for the emphbox +\colorlet{emphboxbackground}{backtableheader} +\colorlet{emphboxborder}{fronttableheader} +\colorlet{emphboxtext}{fronttableheader} + +\NewEnviron{emphbox}[1][\linewidth]{% + \begin{framedcolorminipage}{#1}{emphboxborder}{emphboxbackground}% + \centering\color{emphboxtext}\BODY% + \end{framedcolorminipage}% +} + +\endinput diff --git a/upmethodology-frontpage.sty b/upmethodology-frontpage.sty new file mode 100644 index 0000000..133786f --- /dev/null +++ b/upmethodology-frontpage.sty @@ -0,0 +1,230 @@ +% Front page for Unified Process Methodology +% +% Copyright (c) 2006-2009 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% + +\global\edef\upm@package@fp@ver{2009/10/30} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-frontpage}[\upm@package@fp@ver] + +\RequirePackage{upmethodology-p-common} + +%----- +% Locales +\def\upm@front@lang@english{ + \gdef\upm@lang@@{\message{**** upmethodology-frontpage is using English language ****}}% + \gdef\upm@lang@front@authors{\upm@lang@document@authors} +} +\def\upm@front@lang@french{ + \gdef\upm@lang@@{\message{**** upmethodology-frontpage is using French language ****}}% + \gdef\upm@lang@front@authors{\upm@lang@document@authors} +} +%---------------------------------------- +% OPTIONS +%---------------------------------------- +\DeclareOption{french}{% + \upm@front@lang@french +} +\DeclareOption{francais}{% + \upm@front@lang@french +} +\DeclareOption{english}{% + \upm@front@lang@english +} +\ExecuteOptions{english} +\ProcessOptions +\upm@lang@@ + +\RequirePackage{upmethodology-extension} +\RequirePackage{upmethodology-document} + +% Declare the temporary dimensions +\newdimen\upm@front@tmpa +\newdimen\upm@front@tmpb + +%----- +% String format +\def\upm@front@force@single@spacing#1{{\begin{singlespace}#1\end{singlespace}}} +\def\upm@front@maintitle@fmt#1{\Huge \scshape #1} +\def\upm@front@project@fmt#1{\textbf{\Large #1}} +\def\upm@front@subproject@fmt#1{\textbf{\large #1}} +\def\upm@front@document@fmt#1{\textbf{\normalsize #1}} +\def\upm@front@info@fmt#1{{\normalsize #1}} +\def\upm@front@author@fmt#1{% + \begin{upmfontsize}{\small}#1\end{upmfontsize}% + } + +%----- +% Define the command to put the title with a classic layout +\newcommand{\upm@front@layout@classic}{% + \message{************ USE CLASSIC FRONT COVER} + \begin{titlepage}% + \begin{center} + + % Illustration picture + \Ifelsedefined{frontillustration}{% + \noindent\expandafter\includegraphics[width=\Get{frontillustrationsize}\expandafter\linewidth]{\Get{frontillustration}} + }{% + \Ifdefined{logo}{\noindent\vfill\expandafter\includegraphics[width=.4\linewidth]{\Get{logo}}}% + }% + + % Project name + \vspace{1cm} + \upm@front@force@single@spacing{\upm@front@maintitle@fmt{\theupmproject}} + \vspace{1cm} + + % Document title + \noindent\rule{\linewidth}{1mm} \\ + \noindent\raggedleft\upm@front@project@fmt{\theupmproject} \\ + \Ifnotempty{\theupmsubproject}{\noindent\raggedleft\upm@front@subproject@fmt{\theupmsubproject}\\} + \vspace{.5cm} + \noindent\raggedleft\upm@front@document@fmt{\theupmdocname} \\ + \noindent\rule{\linewidth}{1mm} \\ + + \vspace{1cm} + + % Document information + \noindent\raggedleft\begin{tabular}{rr} + \upm@front@info@fmt{\upm@lang@docref:} & \upm@front@info@fmt{\theupmdocref} \\ + \upm@front@info@fmt{\upm@lang@version:} & \upm@front@info@fmt{\theupmversion} \\ + \upm@front@info@fmt{\upm@lang@lastupdate@short:} & \upm@front@info@fmt{\theupmdate} \\ + \upm@front@info@fmt{\upm@lang@status:} & \upm@front@info@fmt{\theupmstatus} \\ + \end{tabular} + + \vfill + \Ifelsedefined{frontillustration}{% + \Ifelsedefined{logo}{% + \noindent\begin{tabularx}{\linewidth}{l>{\raggedleft}X}% + \expandafter\includegraphics[width=.3\linewidth]{\Get{logo}} & % + \upm@front@author@fmt{\upm@lang@front@authors:~\theauthorlist} \\% + \end{tabularx}% + }{% + \noindent\raggedleft\upm@front@author@fmt{\upm@lang@front@authors:~\theauthorlist} \\% + }% + }{% + \noindent\raggedleft\upm@front@author@fmt{\upm@lang@front@authors:~\theauthorlist} \\% + }% + + \end{center} + \end{titlepage} +} + + +%----- +% Define the command to put the title with a classic layout +\newcommand{\upm@front@layout@modern}{% + \message{************ USE MODERN FRONT COVER} + \begin{titlepage}% + % Project name + \upm@front@maintitle@fmt{\theupmproject} \\ + \noindent\rule{\linewidth}{.5mm} \\ + + % Document title + \Ifnotempty{\theupmsubproject}{\noindent\raggedright\upm@front@subproject@fmt{\theupmsubproject}\\} + \vspace{.5cm} + \noindent\raggedright\upm@front@force@single@spacing{\upm@front@document@fmt{\theupmdocname}} + + \vfill + + \vbox{ + \begin{picture}(0,0) + \Ifelsedefined{frontillustration}{% + \put(-110,-100){% + \includegraphics[width=\Get{frontillustrationsize}\expandafter\linewidth]{\Get{frontillustration}}% + }% + }{% + } + \upm@front@tmpa=\linewidth + \advance\upm@front@tmpa-.4\linewidth + \put(\strip@pt\upm@front@tmpa,75){ + \begin{tabular*}{.4\linewidth}{lr} + \upm@front@info@fmt{\upm@lang@docref:} & \upm@front@info@fmt{\theupmdocref} \\ + \upm@front@info@fmt{\upm@lang@version:} & \upm@front@info@fmt{\theupmversion} \\ + \upm@front@info@fmt{\upm@lang@lastupdate@short:} & \upm@front@info@fmt{\theupmdate} \\ + \upm@front@info@fmt{\upm@lang@status:} & \upm@front@info@fmt{\theupmstatus} \\ + \end{tabular*} + } + \upm@front@tmpa=\linewidth + \advance\upm@front@tmpa-.3\linewidth + \Ifdefined{logo}{ + \put(\strip@pt\upm@front@tmpa,-50){ + \expandafter\includegraphics[width=.3\linewidth]{\Get{logo}}% + } + } + \end{picture} + + } + \end{titlepage} +} + +\newcommand{\upm@front@setfrontlayout}[2]{% + \ifthenelse{\equal{#1}{classic}}{% + \Set{frontillustrationsize}{.6}% + \global\let\upm@front@layout\upm@front@layout@classic% + }{% + \ifthenelse{\equal{#1}{modern}}{% + \Set{frontillustrationsize}{1} + \global\let\upm@front@layout\upm@front@layout@modern% + }{% + \ifthenelse{\equal{#1}{custom}}{#2}{\errmessage{invalid front layout theme: #1}}% + }% + }% +} + +%---- +% Set the front page layout as the classic layout theme +%\setfrontcover{layout_name} +\newcommand{\setfrontcover}[1]{% + \upm@front@setfrontlayout{#1}{\errmessage{invalid front layout theme: #1}}% +} +\newcommand{\setfrontlayout}[1]{\errmessage{"\string\setfrontlayout" is deprecated. Use "\string\setfrontcover" insteed}} + +\setfrontcover{classic} + +\renewcommand{\maketitle}{% + \Ifdefined{frontpage}{ + \upm@front@setfrontlayout{\Get{frontpage}}{% + \message{************ USE CUSTOM FRONT COVER} + \gdef\upm@front@layout{% + \begin{titlepage}% + \Get{frontpage@custom}% + \end{titlepage}% + }% + }% + }% + \upm@front@layout}% +\newcommand{\makefrontcover}{\maketitle} + +%---- +% Set the illustration figure on the front page +%\setfrontillustration[size_factor]{filename} +\newcommand{\setfrontillustration}[2][1]{% + \Set{frontillustrationsize}{#1}% + \Set{frontillustration}{#2}% +} + +%---- +% Clear the illustration figure on the front page +%\clearfrontillustration +\newcommand{\clearfrontillustration}{% + \Set{frontillustrationsize}{1}% + \Unset{frontillustration}% +} + +\endinput diff --git a/upmethodology-p-common.sty b/upmethodology-p-common.sty new file mode 100644 index 0000000..28391df --- /dev/null +++ b/upmethodology-p-common.sty @@ -0,0 +1,230 @@ +% Copyright (c) 2009-13 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% + +\global\edef\upm@package@private@doctype@ver{2014/03/03} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-p-common}[\upm@package@private@doctype@ver] + +\RequirePackage{ifthen} +\RequirePackage{xspace} +\RequirePackage{xcolor} +\RequirePackage{ifpdf} + +%---------------------------------------- +% UPMVERSION MACRO +%---------------------------------------- +\input UPMVERSION.def +\def\upm@common@parseversion@to@tex#1#2#3#4#5#6#7#8#9\@nil{#1#2#3#4/#5#6/#7#8} +\def\upm@common@parseversion@major#1#2#3#4#5#6#7#8#9\@nil{#1#2#3#4#5#6#7#8} +\edef\ver@UPMVERSION@major{\expandafter\upm@common@parseversion@major\UPMVERSION-\relax\@nil} +\edef\ver@UPMVERSION{\expandafter\upm@common@parseversion@to@tex\UPMVERSION\@nil} +\expandafter\let\csname ver@UPMVERSION.sty\endcsname\ver@UPMVERSION +\expandafter\let\csname ver@UPMVERSION.cls\endcsname\ver@UPMVERSION + +\gdef\UPMVERSIONTEST{\ver@UPMVERSION\\\ver@UPMVERSION@major} + +%---------------------------------------- +% ARAKHNE.ORG MACRO +%---------------------------------------- +\providecommand{\arakhneorg}{{\begingroup% + {\usefont{T1}{pzc}{m}{it}\selectfont Arakhn\^e}% + {\usefont{T1}{phv}{bc}{sc}\selectfont\tiny.org}\endgroup}\xspace} + +%---------------------------------------- +% CURRENT LANGUAGE +%---------------------------------------- +\def\upmcurrentlang{english} + +%---------------------------------------- +% TEST MACROS +%---------------------------------------- +\long\def\Ifnotempty#1{\ifthenelse{\equal{#1}{\@empty}}{}} +\long\def\Ifempty#1#2{\ifthenelse{\equal{#1}{\@empty}}{#2}{}} +\long\def\Ifelseempty#1#2#3{\ifthenelse{\equal{#1}{\@empty}}{#2}{#3}} + +%---------------------------------------- +% TOC MACROS +%---------------------------------------- +\newcommand{\newpageintoc}{\addtocontents{toc}{\protect\newpage}} + +%---------------------------------------- +% DOCUMENT TYPE +%---------------------------------------- +\newif\ifupmbookformat +\newif\ifupmreportformat +\newif\ifupmarticleformat + +\upmbookformatfalse +\upmreportformattrue +\upmarticleformatfalse + +%---------------------------------------- +% PDF COLORS +%---------------------------------------- +\newcommand{\setpdfcolor}[1]{} + +%---------------------------------------- +% CREATE COMMAND WITH ID AS NAME +%---------------------------------------- +\def\upm@protect#1{\upm@p@protect #1\relax} +\def\upm@p@protect#1#2\relax{% + \ifx\relax #1% + \relax + \else% + \string #1% + \ifx\relax #2% + \relax + \else + \upm@p@protect #2\relax% + \fi + \fi} + +\def\upm@namedef#1#2{% + \@namedef{\upm@protect{#1}}{#2}% +} + +\def\upm@nameuse#1{% + \@nameuse{\upm@protect{#1}}% +} + +\def\upm@nameundef#1{% + \expandafter\let\csname\upm@protect{#1}\endcsname\relax% +} + +\def\upm@namelet@ext#1#2{% + \expandafter\expandafter\let\expandafter\upm@tmp\csname#2\endcsname% + \global\expandafter\let\csname#1\endcsname\upm@tmp% +} + +\def\upm@ifdefinedname#1#2#3{% + \expandafter\ifx\csname\upm@protect{#1}\endcsname\relax% + #3% + \else% + #2% + \fi% +} + +\newcommand{\upm@column@char}{\iflanguage{french}{ :}{:}} + +%---------------------------------------- +% GET THE REFERENCE ID WITHOUT \REF +%---------------------------------------- +\gdef\upm@getref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + \nfss@text{\reset@font\bfseries ??}% + \else + \expandafter\expandafter\expandafter\@car\csname r@#1\endcsname\@nil + \fi +} + +\gdef\upm@getpageref@filter#1#2#3#4#5{#2} + +\gdef\upm@getpageref#1{% + \expandafter\ifx\csname r@#1\endcsname\relax + \nfss@text{\reset@font\bfseries ??}% + \else% + \protected@xdef\upm@p@tmp@tmp{\protect\upm@getpageref@filter\csname r@#1\endcsname}% + \upm@p@tmp@tmp% + \global\let\upm@p@tmp@tmp\relax% + \fi +} + +%---------------------------------------- +% INTERNAL COMMAND FOR TEXT SUPPER/SUB SCRIPT +%---------------------------------------- + +\let\upm@textsuperscript\textsuperscript + +\def\upm@textsubscript#1{% + {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}} + + +%---------------------------------------- +% MACRO THAT PERMITS TO LOOP ON A SEPARATOR +%---------------------------------------- + +\newif\ifupm@foreach@hasseparator +\newif\ifupm@foreach@oneseparator + +\let\upm@foreach@end\relax + +\def\upm@foreach@rec#1{% + {\upm@foreach@searchseparator#1\upm@foreach@end\@nil}% + \ifupm@foreach@hasseparator% + \protected@xdef\upm@foreach@continue{\protect\upm@foreach@rec{\upm@foreach@rest}}% + \upm@foreach@body% + \upm@foreach@continue% + \else% + \ifupm@foreach@oneseparator\else% + \upm@foreach@lastbody% + \fi% + \fi% +} + +% Loop on parts of a text given a specific separator. +% In the bodies, the macros \upm@foreach@term is the current data. +% #1: is the separator to consider +% #2: is the data set +% #3: is the body to run for each loop, except the last. +% #4: is the body to run for the last loop. +\def\upm@foreach#1\in#2\do#3#4{% + \global\upm@foreach@oneseparatorfalse% + \gdef\upm@foreach@searchseparator##1#1##2\@nil{% + \gdef\upm@foreach@term{##1}% + \ifx\upm@foreach@end##2% + \global\upm@foreach@hasseparatorfalse% + \else% + \gdef\upm@foreach@rest{##2}% + \global\upm@foreach@hasseparatortrue% + \global\upm@foreach@oneseparatortrue% + \fi% + }% + \gdef\upm@foreach@body{#3}% + \gdef\upm@foreach@lastbody{#4}% + \upm@foreach@rec{#2#1}% +} + +%---------------------------------------- +% MACRO THAT PERMITS TO FIND A STRING +%---------------------------------------- +\def\upm@ifin#1#2{\begingroup\edef\upm@tmp{\endgroup\noexpand\in@{#1}{#2}}\upm@tmp\ifin@} + +%----------------------------------------- +% Option parameters +\newif\ifupm@common@optlist@needdefault +\gdef\upm@common@optlist@parseparams#1=#2\@nil{% + \ifthenelse{\equal{#2}{===}}{% + \global\upm@common@optlist@needdefaulttrue% + }{% + \global\upm@common@optlist@needdefaultfalse% + }% +} +\DeclareRobustCommand{\upm@common@optlist}[1]{% + {\upm@common@optlist@parseparams #1====\@nil}% +} +\newcommand{\upm@setkeys}[3]{% + \upm@common@optlist{#3}% + \ifupm@common@optlist@needdefault% + \expandafter\setkeys{#1}{#2=#3}% + \else% + \expandafter\setkeys{#1}{#3}% + \fi% +} + +\endinput diff --git a/upmethodology-spec.sty b/upmethodology-spec.sty new file mode 100644 index 0000000..0ad4132 --- /dev/null +++ b/upmethodology-spec.sty @@ -0,0 +1,457 @@ +% Specification Description for Unified Process Methodology +% +% Copyright (c) 2006-2007 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% +% Creation date: 2006-04-27 +% Modifications: +% 2009-10-30 Clean code. +% 2007-03-19 Add localization. +% + +\global\edef\upm@package@spec@ver{2009/10/30} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-spec}[\upm@package@spec@ver] + +\RequirePackage{upmethodology-p-common} + +\RequirePackage[normalem]{ulem} + +\RequirePackage{upmethodology-fmt} +\RequirePackage{upmethodology-code} + +%------------------------------------ +% LOCALIZATION +%------------------------------------ +\def\upm@spec@lang@english { + \gdef\upm@lang@@{\message{**** upmethodology-spec is using English language ****}}% + \gdef\upm@spec@lang@description{Description} + \gdef\upm@spec@lang@returned@values{returned value(s)} + \gdef\upm@spec@lang@except@for{Except for} + \gdef\upm@spec@lang@modifier@public{{\tiny+}} + \gdef\upm@spec@lang@modifier@protected{{\tiny\#}} + \gdef\upm@spec@lang@modifier@private{{\tiny--}} + \gdef\upm@spec@lang@modifier@static##1{{\uline{##1}}} + \gdef\upm@spec@lang@modifier@const{query} + \gdef\upm@spec@lang@modifier@final{isLeaf} + \gdef\upm@spec@lang@modifier@abstract{abstract} + \gdef\upm@spec@lang@modifier@root{isRoot} + \gdef\upm@spec@lang@modifier@inout{\ensuremath{\leftrightarrow}} + \gdef\upm@spec@lang@modifier@in{\ensuremath{\rightarrow}} + \gdef\upm@spec@lang@modifier@out{\ensuremath{\leftarrow}} +} +\def\upm@spec@lang@french { + \gdef\upm@lang@@{\message{**** upmethodology-spec is using French language ****}}% + \gdef\upm@spec@lang@description{Description} + \gdef\upm@spec@lang@returned@values{valeur(s) retourn\'ee(s)} + \gdef\upm@spec@lang@except@for{Except\'e pour} + \gdef\upm@spec@lang@modifier@public{{\tiny+}} + \gdef\upm@spec@lang@modifier@protected{{\tiny\#}} + \gdef\upm@spec@lang@modifier@private{{\tiny--}} + \gdef\upm@spec@lang@modifier@static##1{{\uline{##1}}} + \gdef\upm@spec@lang@modifier@const{requ\^ete} + \gdef\upm@spec@lang@modifier@final{estFeuille} + \gdef\upm@spec@lang@modifier@abstract{abstra\^{\i}t} + \gdef\upm@spec@lang@modifier@root{estRacine} + \gdef\upm@spec@lang@modifier@inout{\ensuremath{\leftrightarrow}} + \gdef\upm@spec@lang@modifier@in{\ensuremath{\rightarrow}} + \gdef\upm@spec@lang@modifier@out{\ensuremath{\leftarrow}} +} + +%---------------------------------------- +% OPTIONS +%---------------------------------------- +\DeclareOption{french}{% + \upm@spec@lang@french +} +\DeclareOption{francais}{% + \upm@spec@lang@french +} +\DeclareOption{english}{% + \upm@spec@lang@english +} +\ExecuteOptions{english} +\ProcessOptions +\upm@lang@@ + +%------------------------------------ +% DETAILLED SPECIFICATION +%------------------------------------ + +\newlength{\upm@spec@detailspec@description@width} +\setlength{\upm@spec@detailspec@description@width}{3cm} + +\newsavebox{\upm@spec@detailspec@savebox} +\newlength{\upm@spec@detailspec@itrn@width} + +\newcounter{upm@detailspec@return@counter} +\newcounter{upm@detailspec@function@counter} + +\newif\ifupm@spec@showdescription +\newif\ifupm@spec@showparams +\newif\ifupm@spec@showreturns +\newif\ifupm@spec@firstparam +\newif\ifupm@spec@modifier@has@static +\newif\ifupm@spec@modifier@has@const +\newif\ifupm@spec@modifier@has@final +\newif\ifupm@spec@modifier@has@abstract +\newif\ifupm@spec@modifier@has@root +\newif\ifupm@spec@modifier@has@public +\newif\ifupm@spec@modifier@has@protected +\newif\ifupm@spec@modifier@has@private +\newif\ifupm@spec@tmp@a + +\newcommand{\upm@spec@head}[2]{#1} +\newcommand{\upm@spec@tail}[2]{#2} + +%----- +%\upm@spec@func@modifiers{modifiers} +\newcommand{\upm@spec@func@modifiers}[1]{% + \global\upm@spec@modifier@has@staticfalse% + \global\upm@spec@modifier@has@constfalse% + \global\upm@spec@modifier@has@finalfalse% + \global\upm@spec@modifier@has@abstractfalse% + \global\upm@spec@modifier@has@rootfalse% + \global\upm@spec@modifier@has@publicfalse% + \global\upm@spec@modifier@has@protectedfalse% + \global\upm@spec@modifier@has@privatefalse% + \upm@spec@func@modifiers@scan{#1}% +} +\newcommand{\upm@spec@func@modifiers@scan}[1]{% + \upm@ifnotempty{#1}{% + \edef\upm@reserved@a{\upm@spec@head #1\@empty\@empty}% + \edef\upm@reserved@b{\upm@spec@tail #1\@empty\@empty}% + \ifthenelse{\equal{\upm@reserved@a}{+}}{% + %public + \global\upm@spec@modifier@has@publictrue% + \global\upm@spec@modifier@has@protectedfalse% + \global\upm@spec@modifier@has@privatefalse% + }{% + \ifthenelse{\equal{\upm@reserved@a}{=}}{% + %protected + \global\upm@spec@modifier@has@publicfalse% + \global\upm@spec@modifier@has@protectedtrue% + \global\upm@spec@modifier@has@privatefalse% + }{% + \ifthenelse{\equal{\upm@reserved@a}{\#}}{% + %protected + \global\upm@spec@modifier@has@publicfalse% + \global\upm@spec@modifier@has@protectedtrue% + \global\upm@spec@modifier@has@privatefalse% + }{% + \ifthenelse{\equal{\upm@reserved@a}{-}}{% + %protected + \global\upm@spec@modifier@has@publicfalse% + \global\upm@spec@modifier@has@protectedfalse% + \global\upm@spec@modifier@has@privatetrue% + }{% + \ifthenelse{\equal{\upm@reserved@a}{s}}{% + %static + \global\upm@spec@modifier@has@statictrue% + }{% + \ifthenelse{\equal{\upm@reserved@a}{c}}{% + %query / const + \global\upm@spec@modifier@has@consttrue% + }{% + \ifthenelse{\equal{\upm@reserved@a}{l}}{% + %isLeaf + \global\upm@spec@modifier@has@finaltrue% + }{% + \ifthenelse{\equal{\upm@reserved@a}{a}}{% + %abstract + \global\upm@spec@modifier@has@abstracttrue% + }{% + \ifthenelse{\equal{\upm@reserved@a}{r}}{% + %isRoot + \global\upm@spec@modifier@has@roottrue% + }{}}}}}}}}}% + \expandafter\upm@spec@func@modifiers@scan{\upm@reserved@b}% + }% +} + +%----- +%\upm@spec@param@modifiers{modifiers} +\newcommand{\upm@spec@param@modifiers}[1]{% + \upm@ifnotempty{#1}{% + \ifthenelse{\equal{#1}{out}}{% + %out + \upm@spec@lang@modifier@out% + }{ + \ifthenelse{\equal{#1}{inout}}{% + %inout + \upm@spec@lang@modifier@inout% + }{ + %in + \upm@spec@lang@modifier@in% + }} + }% +} + +%----- +\def\upm@spec@trim#1{#1} +\newcommand{\upm@spec@splitparams}[1]{% + \upm@ifnotempty{#1}{% + \upm@spec@firstparamtrue + \@for\reserved@a:=#1\do{% + \ifupm@spec@firstparam\upm@spec@firstparamfalse\else, \fi% + \mbox{\upm@spec@trim{\reserved@a}}% + }% + \upm@spec@trim + }% +} + +%----- +%\begin{upm@spec@detailspec}[width]{title}...\end{detailspec} +\newenvironment{upm@spec@detailspec}[2][\linewidth]{% + + \setcounter{upm@detailspec@return@counter}{0} + \setcounter{upm@detailspec@function@counter}{0} + + \gdef\upm@spec@detailspec@width{#1} + \gdef\upm@spec@detailspec@title{#2} + \gdef\upm@spec@functions{} + \gdef\upm@spec@parameters{} + \gdef\upm@spec@global@return{} + \gdef\upm@spec@local@return{} + + %----- + %\speccons[modifiers]{name}{prototype} + \newcommand{\speccons}[3][]{\specfunc[##1]{}{##2}{##3}} + + %----- + %\specget[modifiers]{return_type}{name} + \newcommand{\specget}[3][]{\specfunc[c##1]{##2}{##3}{}} + + %----- + %\specset[modifiers]{name}{prototype} + \newcommand{\specset}[3][]{\specfunc[##1]{\jvoid}{##2}{##3}{}} + + %----- + %\specfunc[modifiers]{return_type}{name}{prototype} + \newcommand{\specfunc}[4][+]{% + \addtocounter{upm@detailspec@function@counter}{1}% + \protected@xdef\upm@spec@reserved@a{\protect\csname upm@detailspec@return@ptr@\theupm@detailspec@function@counter\endcsname}% + \gdef\upm@spec@reserved@b{} + \upm@ifnotempty{##2}{\gdef\upm@spec@reserved@b{\string:\ }} + + \gdef\upm@spec@reserved@c{}% + \upm@spec@func@modifiers{##1}% + \ifupm@spec@modifier@has@private\gdef\upm@spec@reserved@c{\upm@spec@lang@modifier@private}% + \else\ifupm@spec@modifier@has@protected\gdef\upm@spec@reserved@c{\upm@spec@lang@modifier@protected}% + \else\gdef\upm@spec@reserved@c{\upm@spec@lang@modifier@public}\fi\fi% + + \gdef\upm@spec@reserved@d{##3}% + \ifupm@spec@modifier@has@static% + \protected@xdef\upm@spec@reserved@d{\protect\upm@spec@lang@modifier@static{\upm@spec@reserved@d}}% + \fi% + + \gdef\upm@spec@reserved@e{}% + \upm@spec@tmp@afalse% + \ifupm@spec@modifier@has@const\upm@spec@tmp@atrue\fi% + \ifupm@spec@modifier@has@final\upm@spec@tmp@atrue\fi% + \ifupm@spec@modifier@has@abstract\upm@spec@tmp@atrue\fi% + \ifupm@spec@modifier@has@root\upm@spec@tmp@atrue\fi% + \ifupm@spec@tmp@a% + \ifupm@spec@modifier@has@const% + \gdef\upm@spec@reserved@e{\upm@spec@lang@modifier@const}% + \fi + \ifupm@spec@modifier@has@final% + \upm@ifnotempty{\upm@spec@reserved@e}{% + \xdef\upm@spec@reserved@e{\upm@spec@reserved@e,}}% + \protected@xdef\upm@spec@reserved@e{\upm@spec@reserved@e\protect\upm@spec@lang@modifier@final}% + \fi + \ifupm@spec@modifier@has@abstract% + \upm@ifnotempty{\upm@spec@reserved@e}{% + \xdef\upm@spec@reserved@e{\upm@spec@reserved@e,}}% + \protected@xdef\upm@spec@reserved@e{\upm@spec@reserved@e\protect\upm@spec@lang@modifier@abstract}% + \fi + \ifupm@spec@modifier@has@root% + \upm@ifnotempty{\upm@spec@reserved@e}{% + \xdef\upm@spec@reserved@e{\upm@spec@reserved@e,}}% + \protected@xdef\upm@spec@reserved@e{\upm@spec@reserved@e\protect\upm@spec@lang@modifier@root}% + \fi + \protected@xdef\upm@spec@reserved@e{ \protect\{\upm@spec@reserved@e\protect\}} + \fi% + + \protected@xdef\upm@spec@functions{\upm@spec@functions {\upm@spec@reserved@c}\protect&% + {\upm@spec@reserved@d}\protect&% + \string(\protect&\protect\upm@spec@splitparams{##4}\string) {\upm@spec@reserved@b##2{\upm@spec@reserved@a}{\upm@spec@reserved@e}}\protect\\}% + + \global\let\upm@spec@reserved@a\relax + \global\let\upm@spec@reserved@b\relax + \global\let\upm@spec@reserved@c\relax + \global\let\upm@spec@reserved@d\relax + \global\let\upm@spec@reserved@e\relax + \expandafter\gdef\csname upm@detailspec@return@ptr@\theupm@detailspec@function@counter\endcsname{} + } + + %----- + %\specreturn{description} + \newcommand{\specreturn}[1]{% + \addtocounter{upm@detailspec@return@counter}{1}% + \expandafter\protected@xdef\csname upm@detailspec@return@ptr@\theupm@detailspec@function@counter\endcsname{% + {\protect\tiny\protect\ensuremath{_{\protect\string[\theupm@detailspec@return@counter\protect\string]}}}% + }% + \protected@xdef\upm@spec@local@return{\upm@spec@local@return {\protect\tiny\protect\string[\theupm@detailspec@return@counter\protect\string]} \protect& ##1 \protect\\}% + } + + %----- + %\specglobalreturn{description} + \newcommand{\specglobalreturn}[1]{\gdef\upm@spec@global@return{##1}} + + %----- + %\specparam[in|inout|out]{name}{description} + \newcommand{\specparam}[3][in]{% + \protected@xdef\upm@spec@parameters{\upm@spec@parameters \protect\upm@spec@param@modifiers{##1} \protect& {##2:} \protect& {##3} \protect\\} + } + + %----- + %\specendhline + \newcommand{\specendhline}{\gdef\upm@detailspec@end@hline{\hline}} + + %----- + %\specstarthline + \newcommand{\specstarthline}{\gdef\upm@detailspec@start@hline{\hline}} + + \setlength{\upm@spec@detailspec@itrn@width}{#1} + \addtolength{\upm@spec@detailspec@itrn@width}{-\the\upm@spec@detailspec@description@width} + \addtolength{\upm@spec@detailspec@itrn@width}{-2\tabcolsep} + + \begin{lrbox}{\upm@spec@detailspec@savebox} + \begin{minipage}[t]{\upm@spec@detailspec@itrn@width}% +}{% + \end{minipage} + \end{lrbox}% + + \gdef\upm@detailspec@separator{} + \upm@spec@showreturnsfalse% + + \ifthenelse{\equal{\upm@spec@global@return}{\@empty}}{% + \gdef\upm@detailspec@return@section{} + \upm@ifnotempty{\upm@spec@local@return}{ + \gdef\upm@detailspec@separator{ & & & \\} + \protected@xdef\upm@detailspec@return@section{\upm@spec@local@return}% + \upm@spec@showreturnstrue% + }% + }{% + \upm@ifnotempty{\upm@spec@local@return}{% + \gdef\upm@detailspec@separator{ & & & \\} + \gdef\upm@spec@reserved@a{ \upm@spec@lang@except@for:\protect\upm@spec@local@return}}% + \protected@xdef\upm@detailspec@return@section{% + \upm@spec@global@return\upm@spec@reserved@a% + }% + \upm@spec@showreturnstrue% + } + + \ifthenelse{\equal{\upm@spec@detailspec@title}{\@empty}}{ + \gdef\upm@spec@reserved@c{} + }{ + \gdef\upm@spec@reserved@c{\hline% + \multicolumn{4}{>{\columncolor{backtableheader}}l}{\color{fronttableheader}{\large\textsc{\upm@spec@detailspec@title}}} \\% + } + \gdef\upm@detailspec@start@hline{\hline}% + \upm@spec@showdescriptiontrue% + } + + \upm@spec@showparamsfalse% + + \upm@ifnotempty{\upm@spec@parameters}{% + \ifupm@spec@showdescription% + \gdef\upm@detailspec@separator{ & & & \\}% + \fi% + \upm@ifnotempty{\upm@spec@functions}{% + \gdef\upm@detailspec@separator{ & & & \\}% + }% + \upm@spec@showparamstrue% + }% + + \vspace{.5cm}\noindent\begin{tabularx}{\the\upm@spec@detailspec@width}{|clr@{}>{\raggedright\arraybackslash}X|} + \upm@spec@reserved@c% + \upm@detailspec@start@hline% + \ifupm@spec@showdescription + \multicolumn{4}{|X|}{% + \begin{tabularx}{\linewidth}{@{}lX@{}}% + \upm@spec@lang@description: & \usebox{\upm@spec@detailspec@savebox} \\% + \end{tabularx}% + } \\% + \hline% + \fi + \upm@spec@functions% + \upm@detailspec@separator% + \ifupm@spec@showparams% + \multicolumn{4}{|X|}{% + \begin{tabularx}{\linewidth}{@{}l@{}lX@{}}% + \upm@spec@parameters% + \end{tabularx}% + } \\% + \fi% + \ifupm@spec@showreturns% + \multicolumn{4}{|X|}{% + \textit{\upm@spec@lang@returned@values}: \newline% + \begin{tabularx}{\linewidth}{@{}lX@{}}% + \upm@detailspec@return@section% + \end{tabularx}% + } \\% + \fi% + \upm@detailspec@end@hline% + \end{tabularx}\vspace{.5cm}% + + \global\let\@arraycr\upm@arraycr + + \global\let\upm@spec@detailspec@width\relax% + \global\let\upm@spec@detailspec@title\relax% + \global\let\upm@spec@functions\relax% + \global\let\upm@spec@parameters\relax% + \global\let\upm@spec@global@return\relax% + \global\let\upm@spec@local@return\relax% + \global\let\upm@detailspec@return@section\relax% + \global\let\upm@spec@reserved@a\relax% + \global\let\upm@spec@reserved@b\relax% + \global\let\upm@spec@reserved@c\relax% + \global\let\upm@detailspec@separator\relax% + \global\let\upm@detailspec@start@hline\relax% + \global\let\upm@detailspec@end@hline\relax% +} + +%----- +%\begin{detailspec}}[width]{title}...\end{detailspec}.... +\newenvironment{detailspec}[2][\linewidth] +{% + \upm@spec@showdescriptiontrue% + \gdef\upm@detailspec@start@hline{\hline}% + \gdef\upm@detailspec@end@hline{\hline}% + \begin{upm@spec@detailspec}[#1]{#2}% +} +{% + \end{upm@spec@detailspec}% +} + +%----- +%\begin{detailspec}}[width]{title}...\end{detailspec}.... +\newenvironment{detailspec*}[2][\linewidth] +{% + \upm@spec@showdescriptionfalse% + \gdef\upm@detailspec@start@hline{}% + \gdef\upm@detailspec@end@hline{}% + \begin{upm@spec@detailspec}[#1]{#2}% +} +{% + \end{upm@spec@detailspec}% +} + +\endinput diff --git a/upmethodology-task.sty b/upmethodology-task.sty new file mode 100644 index 0000000..fdc90a7 --- /dev/null +++ b/upmethodology-task.sty @@ -0,0 +1,268 @@ +% Task management for Unified Process Methodology +% +% Copyright (c) 2006-2007 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% +% Creation date: 2006-04-20 +% Modifications: +% 2009-10-30 Clean code. +% 2007-03-19 Add localization. +% + +\global\edef\upm@package@task@ver{2009/10/30} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-task}[\upm@package@task@ver] + +\RequirePackage{upmethodology-p-common} + +%----- LOCALIZATION +\def\upm@task@lang@english{ + \gdef\upm@lang@@{\message{**** upmethodology-task is using English language ****}}% + \gdef\upm@task@lang@task{Task} + \gdef\upm@task@lang@description{Description} + \gdef\upm@task@lang@startat{Start at} + \gdef\upm@task@lang@endat{End at} + \gdef\upm@task@lang@archieved{Archieved} + \gdef\upm@task@lang@managers{Managers} + \gdef\upm@task@lang@members{Members} + \gdef\upm@task@lang@milestones{Milestones} + \gdef\upm@task@lang@subtask{Sub-task of} +} +\def\upm@task@lang@french{ + \gdef\upm@lang@@{\message{**** upmethodology-task is using French language ****}}% + \gdef\upm@task@lang@task{T\^ache} + \gdef\upm@task@lang@description{Description} + \gdef\upm@task@lang@startat{D\'ebut le} + \gdef\upm@task@lang@endat{Fin le} + \gdef\upm@task@lang@archieved{Termin\'ee} + \gdef\upm@task@lang@managers{R\'ef\'erent} + \gdef\upm@task@lang@members{Membres} + \gdef\upm@task@lang@milestones{\'Etapes} + \gdef\upm@task@lang@subtask{Sous-t\^ache de} +} + +%----- OPTIONS +\DeclareOption{french}{% + \upm@task@lang@french +} +\DeclareOption{francais}{% + \upm@task@lang@french +} +\DeclareOption{english}{% + \upm@task@lang@english +} +\ExecuteOptions{english} +\ProcessOptions +\upm@lang@@ + +\RequirePackage{upmethodology-version} + +%----- +\newif\if@upm@task@displaydescription +\newif\if@upm@task@rebuild +\@upm@task@rebuildfalse + +\def\upm@task@define#1#2#3{% + \protected@write\@auxout{}{\string\global\string\@namedef{upm@task@#1@#2}{#3}}% + \ifthenelse{\equal{\csname upm@task@#1@#2\endcsname}{#3}}{}{\@upm@task@rebuildtrue}% + \global\@namedef{upm@task@#1@#2}{#3}% +} + +\def\upm@task@define@list#1#2#3{% + \ifthenelse{\equal{\csname upm@task@#1@#2\endcsname}{\@empty}}{% + \expandafter\xdef\csname upm@task@#1@#2\endcsname{#3}% + }{% + \expandafter\xdef\csname upm@task@#1@#2\endcsname{% + \csname upm@task@#1@#2\endcsname, #3% + }% + }% + \AtEndDocument{\protected@write\@auxout{}{\string\global\string\@namedef{upm@task@#1@#2}{\csname upm@task@#1@#2\endcsname}}} +} + +\newenvironment{upm@taskdescription}[1]{% + \global\@namedef{upm@task@#1@managers}{}% + \global\@namedef{upm@task@#1@members}{}% + \global\@namedef{upm@task@#1@milestones}{}% + + \newcommand{\taskname}[1]{\upm@task@define{#1}{name}{##1}} + \newcommand{\tasksuper}[1]{\upm@task@define{#1}{super}{##1}} + \newcommand{\taskcomment}[1]{\upm@task@define{#1}{comment}{##1}}% + \newcommand{\taskprogress}[1]{\upm@task@define{#1}{progress}{##1}}% + \newcommand{\taskstart}[1]{\upm@task@define{#1}{startat}{##1}}% + \newcommand{\taskend}[1]{\upm@task@define{#1}{endat}{##1}}% + \newcommand{\taskmanager}[1]{\upm@task@define@list{#1}{managers}{##1}} + \newcommand{\taskmember}[1]{% + \upm@task@define@list{#1}{members}{##1}% + } + \newcommand{\taskmilestone}[2]{% + \upm@task@define@list{#1}{milestones}{##1}% + \upm@task@define{#1}{ml@##1}{##2}% + %\global\@namedef{upm@task@#1@description@milestones}{\upm@task@lang@milestones: & \multicolumn{2}{X|}{\parbox[t]{1.9\linewidth}{\thetaskmembers{#1}}} \\} + } + + + \def\upm@task@currenttask{#1} +}{% + \if@upm@task@displaydescription\thetaskdescription{\upm@task@currenttask}\fi% + \let\upm@task@currenttask\relax% +} + +%----- +%\begin{taskdescription}{id}...\end{taskdescription} +\newenvironment{taskdescription}[1]{% + \@upm@task@displaydescriptiontrue% + \upm@taskdescription{#1}% +}{% + \endupm@taskdescription% +} + +%----- +%\begin{taskdescription*}{id}...\end{taskdescription*} +\newenvironment{taskdescription*}[1]{% + \@upm@task@displaydescriptionfalse% + \upm@taskdescription{#1}% +}{% + \endupm@taskdescription% +} + +%----- +%\thetasksuper{id} +\newcommand{\thetasksuper}[1]{% + \expandafter\providecommand\csname upm@task@#1@super\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@super\endcsname% +} + +%----- +%\thetaskname{id} +\newcommand{\thetaskname}[1]{% + \expandafter\providecommand\csname upm@task@#1@name\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@name\endcsname% +} + +%----- +%\thetaskcomment{id} +\newcommand{\thetaskcomment}[1]{% + \expandafter\providecommand\csname upm@task@#1@comment\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@comment\endcsname% +} + +%----- +%\thetaskprogress{id} +\newcommand{\thetaskprogress}[1]{% + \expandafter\providecommand\csname upm@task@#1@progress\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@progress\endcsname% +} + +%----- +%\thetaskstart{id} +\newcommand{\thetaskstart}[1]{% + \expandafter\providecommand\csname upm@task@#1@startat\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@startat\endcsname% +} + +%----- +%\thetaskend{id} +\newcommand{\thetaskend}[1]{% + \expandafter\providecommand\csname upm@task@#1@endat\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@endat\endcsname% +} + +%----- +%\thetaskmanagers{id} +\newcommand{\thetaskmanagers}[1]{% + \expandafter\providecommand\csname upm@task@#1@managers\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@managers\endcsname% +} + +%----- +%\thetaskmembers{id} +\newcommand{\thetaskmembers}[1]{% + \expandafter\providecommand\csname upm@task@#1@members\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@members\endcsname% +} + +%----- +%\thetaskmilestones{id} +\newcommand{\thetaskmilestones}[1]{% + \expandafter\providecommand\csname upm@task@#1@milestones\endcsname{??\@latex@warning{The task identified by '#1' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@milestones\endcsname% +} + +%----- +%\thetaskmilestonecomment{id}{date} +\newcommand{\thetaskmilestonecomment}[2]{% + \expandafter\providecommand\csname upm@task@#1@ml@#2\endcsname{??\@latex@warning{The task milestone identified by '#1' and '#2' was not found.}\@upm@task@rebuildtrue}% + \expandafter\csname upm@task@#1@ml@#2\endcsname% +} + +\def\@upm@trim#1{#1} + +%----- +%\thetaskdescription{id} +\newcommand{\thetaskdescription}[2][\linewidth]{% + \ifthenelse{\equal{\csname upm@task@#2@members\endcsname}{\@empty}}{ + \gdef\upm@task@tmp@a{}% + }{% + \gdef\upm@task@tmp@a{\upm@task@lang@members: & \multicolumn{2}{X|}{\parbox[t]{1.9\linewidth}{\thetaskmembers{#2}}} \\}% + }% + \ifthenelse{\equal{\csname upm@task@#2@milestones\endcsname}{\@empty}}{ + \gdef\upm@task@tmp@b{}% + }{% + \gdef\upm@task@tmp@b{\hline \upm@task@lang@milestones: &% + \multicolumn{2}{X|}{\parbox[t]{1.95\linewidth}{% + \edef\upm@task@tmp@c{\csname upm@task@#2@milestones\endcsname}% + \def\upm@task@tmp@e{}% + \@for\reserved@a:=\upm@task@tmp@c\do{% + \edef\upm@task@tmp@d{\expandafter\@upm@trim\reserved@a}% + \protected@edef\upm@task@tmp@e{\upm@task@tmp@e \protect\item[\upm@task@tmp@d~:] \protect\thetaskmilestonecomment{#2}{\upm@task@tmp@d}}% + }% + \begin{description}\upm@task@tmp@e\end{description}% + }} \\}% + }% + \vspace{.25cm}\noindent\begin{mtabular}[#1]{3}{|X|X|X|} + \tabulartitle{{\upm@task@lang@task}~\textit{#2}: \thetaskname{#2}} + \hline + %description + \upm@task@lang@description: & \multicolumn{2}{X|}{\parbox[t]{1.9\linewidth}{\thetaskcomment{#2}}} \\ + %sub-task + \expandafter\ifx\csname upm@task@#2@super\endcsname\relax\else% + \upm@task@lang@subtask: & \multicolumn{2}{X|}{\parbox[t]{1.9\linewidth}{{\upm@task@lang@task}~\textit{\csname upm@task@#2@super\endcsname}}} \\ + \fi + \hline + %dates + \upm@task@lang@startat: & \upm@task@lang@endat: & \upm@task@lang@archieved: \\ + \thetaskstart{#2} & \thetaskend{#2} & \thetaskprogress{#2}\% \\ + \hline + %manager + \upm@task@lang@managers: & \multicolumn{2}{X|}{\parbox[t]{1.9\linewidth}{\thetaskmanagers{#2}}} \\ + %members + \upm@task@tmp@a + %milestones + \upm@task@tmp@b + %\@nameuse{upm@task@#1@description@milestones} + \hline + \end{mtabular}\par\vspace{.5cm}% +} + +\AtEndDocument{% + \if@upm@task@rebuild% + \@latex@warning@no@line{Project Task(s) may have changed.\MessageBreak% + Rerun to get cross-references right}\fi% + +} +\endinput diff --git a/upmethodology-version.sty b/upmethodology-version.sty new file mode 100644 index 0000000..6d3538a --- /dev/null +++ b/upmethodology-version.sty @@ -0,0 +1,203 @@ +% Version management for Unified Process Methodology +% +% Copyright (c) 2006-2007 Stephane GALLAND +% Copyright (c) 2013 Stephane GALLAND +% +% This program is free library; you can redistribute it and/or modify +% it under the terms of the GNU Lesser General Public License as +% published by the Free Software Foundation; either version 3 of the +% License, or any later version. +% +% This library is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with this library; see the file COPYING. If not, +% write to the Free Software Foundation, Inc., 59 Temple Place - Suite +% 330, Boston, MA 02111-1307, USA. +% + +\global\edef\upm@package@version@ver{2013/08/26} + +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{upmethodology-version}[\upm@package@version@ver] + +\RequirePackage{upmethodology-p-common} + +%locales +\def\upm@version@lang@english{ + \gdef\upm@lang@@{\message{**** upmethodology-version is using English language ****}}% + \gdef\upm@lang@date{Date} + \gdef\upm@lang@updates{Updates} + \gdef\upm@lang@version{Version} + \gdef\upm@lang@version@history{Version History} + \gdef\upm@lang@restricted{Confidential} + \gdef\upm@lang@validable{Validable} + \gdef\upm@lang@validated{Validated} + \gdef\upm@lang@public{Public} +} +\def\upm@version@lang@french{ + \gdef\upm@lang@@{\message{**** upmethodology-version is using French language ****}}% + \gdef\upm@lang@date{Date} + \gdef\upm@lang@updates{Modifications} + \gdef\upm@lang@version{Version} + \gdef\upm@lang@version@history{Historique} + \gdef\upm@lang@restricted{Confidentiel} + \gdef\upm@lang@validable{Validable} + \gdef\upm@lang@validated{Valid\'e} + \gdef\upm@lang@public{Publique} +} + +%---------------------------------------- +% OPTIONS +%---------------------------------------- +\DeclareOption{french}{% + \upm@version@lang@french +} +\DeclareOption{francais}{% + \upm@version@lang@french +} +\DeclareOption{english}{% + \upm@version@lang@english +} +\ExecuteOptions{english} +\ProcessOptions* + +\upm@lang@@ + +\RequirePackage{upmethodology-fmt} + +%tmp counter +\newcount{\upm@tmp@a} + +% Internal information: first and last registered dates +\let\upm@thefirstdate\@undefined +\let\upm@thelastdate\@undefined + +%increment major part of version number +\def\upm@incmajorversion#1.#2{% + \upm@tmp@a=#1\advance\upm@tmp@a + 1% + \global\edef\theupmversion{\the\upm@tmp@a.0}% +} + +%increment minor part of version number +\def\upm@incminorversion#1.#2{% + \upm@tmp@a=#2\advance\upm@tmp@a + 1% + \global\edef\theupmversion{#1.\the\upm@tmp@a}% +} + +%list of updates +\def\upm@update@list{} + +%add an update to the list +\newcommand{\upm@addupdatetolist}[4]{% + \global\protected@edef\upm@update@list{% + \upm@update@list% + #1 & #2 & #3 \protect\\% + } +} + +%----- +% Available status' constants +\def\upmrestricted{\upm@lang@restricted} +\def\upmvalidable{\upm@lang@validable} +\def\upmvalidated{\upm@lang@validated} +\def\upmpublic{\upm@lang@public} + +%----- +% Replies the modification date of the given version +\newcommand{\upmdate}[1]{\@nameuse{upm@version@#1@updatedate}} + +%----- +% Replies the modification description of the given version +\newcommand{\upmdescription}[1]{\@nameuse{upm@version@#1@description}} + +%----- +% Replies the status of the given version +\newcommand{\upmstatus}[1]{\@nameuse{upm@version@#1@level}} + +%----- +\newcommand{\upm@updateversion}[4]{% + \gdef\theupmdate{#2}% + \gdef\theupmlastmodif{#3}% + \gdef\theupmstatus{#4}% + \ifx\upm@thefirstdate\@undefined + \global\edef\upm@thefirstdate{#2} + \fi + \global\edef\upm@thelastdate{#2} + \@namedef{upm@version@#1@updatedate}{#2}% + \@namedef{upm@version@#1@description}{#3}% + \@namedef{upm@version@#1@level}{#4}% + \upm@addupdatetolist{#1}{#2}{#3}{#4}% +} + +%----- +%\updateversion{new_version}{update_date}{description}{status} +\newcommand{\updateversion}[4]{% + \gdef\theupmversion{#1}% + \upm@updateversion{#1}{#2}{#3}{#4}% +} + +%----- +%\initialversion[version]{date}{description}{status} +\newcommand{\initialversion}[4][0.1]{% + \updateversion{#1}{#2}{#3}{#4}% +} + +%----- +%\incversion{update_date}{description}{status} +\newcommand{\incversion}[3]{% + \expandafter\upm@incmajorversion\theupmversion% + \upm@updateversion{\theupmversion}{#1}{#2}{#3}% +} + +%----- +%\incsubversion{update_date}{description}{status} +\newcommand{\incsubversion}[3]{% + \expandafter\upm@incminorversion\theupmversion% + \upm@updateversion{\theupmversion}{#1}{#2}{#3}% +} + +%----- +% Version variables +\def\theupmversion{0.1} +\edef\theupmdate{\today} +\def\theupmlastmodif{} +\def\theupmstatus{\upmrestricted} + +%----- +% Display the version history +%\upmhistory[width] +\newcommand{\upmhistory}[1][\linewidth]{% + \noindent\expandafter\begin{mtabular}[#1]{3}{|c|c|X|} + \tabulartitle{\upm@lang@version@history}% + \tabularheader{\upm@lang@version}{\upm@lang@date}{\upm@lang@updates}% + \upm@update@list + \hline + \expandafter\end{mtabular}\par\vspace{.5cm}% +} + +%----- +% Copyright date +%\upmcopyrightdate +\newcommand{\upmcopyrightdate}{% + \ifx\upm@thefirstdate\@undefined% + \edef\upm@tmp@copyright@a{\the\year}% + \else% + \edef\upm@tmp@copyright@a{\extractyear{\upm@thefirstdate}}% + \fi% + \ifx\upm@thelastdate\@undefined% + \def\upm@tmp@copyright@b{\the\year}% + \else% + \edef\upm@tmp@copyright@b{\extractyear{\upm@thelastdate}}% + \fi% + \ifthenelse{\equal{\upm@tmp@copyright@a}{\upm@tmp@copyright@b}}{% + \upm@tmp@copyright@a% + }{% + \upm@tmp@copyright@a-\upm@tmp@copyright@b% + }% +} + +\endinput diff --git a/yfonts.sty b/yfonts.sty new file mode 100644 index 0000000..a3597d0 --- /dev/null +++ b/yfonts.sty @@ -0,0 +1,128 @@ +%% +%% This is file `yfonts.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% yfonts.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from yfonts.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file yfonts.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +\ProvidesPackage{yfonts} + [2003/01/08 v1.3 (WaS)] +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\newif\ifyf@v +\DeclareOption{varumlaut}{\yf@vtrue} +\ProcessOptions\relax +\DeclareFontEncoding{LY}{}{} +\DeclareFontSubstitution{LY}{yfrak}{m}{n} +\DeclareFontEncoding{LYG}{}{} +\DeclareFontSubstitution{LYG}{ygoth}{m}{n} +\DeclareFontFamily{LYG}{ygoth}{} +\DeclareFontShape{LYG}{ygoth}{m}{n}{% +<10><10.95><12><14.4><17.28><20.74><24.88>ygoth}{} +\DeclareFontFamily{LY}{yfrak}{} +\DeclareFontShape{LY}{yfrak}{m}{n}{% +<10><10.95><12><14.4><17.28><20.74><24.88>yfrak}{} +\DeclareFontFamily{LY}{ysmfrak}{} +\DeclareFontShape{LY}{ysmfrak}{m}{n}{% + <10><10.95><12><14.4><17.28><20.74><24.88>ysmfrak}{} +\DeclareFontFamily{LY}{yswab}{} +\DeclareFontShape{LY}{yswab}{m}{n}{% +<10><10.95><12><14.4><17.28><20.74><24.88>yswab}{} + +\DeclareFontFamily{U}{yinitas}{} +\DeclareFontShape{U}{yinitas}{m}{n}{% +<10>sfixed*yinitas% +<10.95>sfixed*[42.34]yinitas% +<12>sfixed*[46.39]yinitas% +<14.4>sfixed*[55.68]yinitas% +<17.28>sfixed*[66.82]yinitas% +<20.74>sfixed*[80.19]yinitas% +<24.88>sfixed*[96.20]yinitas% +}{} +\DeclareTextSymbol{\textemdash}{LYG}{124} +\DeclareTextSymbol{\textendash}{LYG}{123} +\DeclareTextComposite{\"}{LYG}{a}{91} +\DeclareTextComposite{\"}{LYG}{o}{93} +\DeclareTextComposite{\"}{LYG}{u}{94} +\DeclareTextComposite{\"}{LYG}{e}{92} +\DeclareTextSymbol{\ss}{LYG}{25} +\DeclareTextCommand{\SS}{LYG}{SS} +\DeclareTextSymbol{\i}{LYG}{16} +\DeclareTextSymbol{\j}{LYG}{17} +\DeclareTextSymbol{\textquotedblleft}{LYG}{95} +\DeclareTextCommand{\grqq}{LYG}{\textquotedblleft} +\DeclareTextSymbol{\textquotedblright}{LYG}{34} +\DeclareTextCommand{\"}{LY}[1]{\UseTextAccent{OT1}{\"}{#1}} +\DeclareTextAccent{\'}{LY}{19} +\DeclareTextAccent{\.}{LY}{95} +\DeclareTextAccent{\=}{LY}{22} +\DeclareTextAccent{\^}{LY}{94} +\DeclareTextAccent{\`}{LY}{18} +\DeclareTextAccent{\~}{LY}{126} +\DeclareTextAccent{\H}{LY}{125} +\DeclareTextAccent{\u}{LY}{21} +\DeclareTextAccent{\v}{LY}{20} +\DeclareTextAccent{\r}{LY}{23} +\DeclareTextSymbol{\textemdash}{LY}{124} +\DeclareTextSymbol{\textendash}{LY}{123} +\ifyf@v +\DeclareTextComposite{\"}{LY}{a}{137} +\DeclareTextComposite{\"}{LY}{o}{153} +\DeclareTextComposite{\"}{LY}{u}{158} +\DeclareTextComposite{\"}{LY}{e}{144} +\else +\DeclareTextComposite{\"}{LY}{a}{138} +\DeclareTextComposite{\"}{LY}{o}{154} +\DeclareTextComposite{\"}{LY}{u}{159} +\DeclareTextComposite{\"}{LY}{e}{145} +\fi +\DeclareTextSymbol{\textsection}{LY}{60} +\DeclareTextSymbol{\i}{LY}{16} +\DeclareTextSymbol{\j}{LY}{17} +\DeclareTextSymbol{\ss}{LY}{26} +\DeclareTextSymbol{\etc}{LY}{201} +\DeclareTextSymbol{\textquotedblleft}{LY}{34} +\DeclareTextCommand{\grqq}{LY}{\textquotedblleft} +\DeclareTextSymbol{\quotedblbase}{LY}{92} +\DeclareTextSymbol{\textquoteleft}{LY}{`\`} +\DeclareTextCommand{\grq}{LY}{\textquoteleft} +\DeclareTextSymbol{\textquoteright}{LY}{`\'} +\DeclareTextCommand{\SS}{LY} + {SS} +\def\gothdefault{ygoth} +\def\swabdefault{yswab} +\def\frakdefault{yfrak} +\def\initdefault{yinitas} +\def\gothfamily{\usefont{LYG}{\gothdefault}{m}{n}} +\def\swabfamily{\usefont{LY}{\swabdefault}{m}{n}} +\def\frakfamily{\usefont{LY}{\frakdefault}{m}{n}} +\def\initfamily{\usefont{U}{\initdefault}{m}{n}} +\DeclareTextFontCommand{\textgoth}{\gothfamily} +\DeclareTextFontCommand{\textswab}{\swabfamily} +\DeclareTextFontCommand{\textfrak}{\frakfamily} +\DeclareTextFontCommand{\textinit}{\initfamily} +\newcommand{\yinipar}[1]{\par\noindent\yinitpar{#1}} +\newcommand{\yinitpar}[1]{\setbox0=\hbox{\textinit{#1}}% +\hangindent=\wd0\hangafter=-4\advance\hangindent by .25em +{\dimen@=-3\baselineskip +\dimen@=\baselinestretch\dimen@ +\hskip-\wd0 \hskip-.25em +\raisebox{\dimen@}[0pt][0pt]{\unhbox0}\hskip.25em}} +\def\fraklines{\baselineskip\f@size dd\relax} +\endinput +%% +%% End of file `yfonts.sty'. -- 2.39.5