diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty | 98 |
1 files changed, 40 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty b/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty index ba7a5d57329..fca966ac658 100644 --- a/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty +++ b/Master/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty @@ -1,4 +1,4 @@ -% PSEUDOCODE ALGORITHMIC STYLE -- Released 18 MAR 2004 +% PSEUDOCODE ALGORITHMIC STYLE -- Released 27 APR 2005 % for LaTeX version 2e % % Copyright Szasz Janos @@ -11,63 +11,59 @@ \RequirePackage{algorithmicx}% \typeout{Document Style - pseudocode environments for use with the `algorithmicx' style}% % -\def\ALG@setpseudocode{t}% -\newboolean{ALG@noend}% -\setboolean{ALG@noend}{false}% +\def\ALG@noend{f}% \newboolean{ALG@compatible}% \setboolean{ALG@compatible}{false}% % -\DeclareOption{noset}{\def\ALG@setpseudocode{}}% -\DeclareOption{set}{\def\ALG@setpseudocode{t}}% -\DeclareOption{noend}{\setboolean{ALG@noend}{true}}% -\DeclareOption{end}{\setboolean{ALG@noend}{false}}% -\DeclareOption{compatible}{\setboolean{ALG@compatible}{true}}% +\DeclareOption{noend}{\def\ALG@noend{t}}% +\DeclareOption{end}{\def\ALG@noend{f}}% +\DeclareOption{compatible}{\typeout{For compatibility mode use algcompatible.sty!!!}\setboolean{ALG@compatible}{true}}% \DeclareOption{noncompatible}{\setboolean{ALG@noncompatible}{false}}% \ProcessOptions% % % *** DECLARATIONS *** % -\ALG@deflanguage{pseudocode}{\ALG@setpseudocode}% -{% +\algnewlanguage{pseudocode}% +\alglanguage{pseudocode}% % % *** KEYWORDS *** % -\newcommand\algorithmicend{\textbf{end}} -\newcommand\algorithmicdo{\textbf{do}} -\newcommand\algorithmicwhile{\textbf{while}} -\newcommand\algorithmicfor{\textbf{for}} -\newcommand\algorithmicforall{\textbf{for all}} -\newcommand\algorithmicloop{\textbf{loop}} -\newcommand\algorithmicrepeat{\textbf{repeat}} -\newcommand\algorithmicuntil{\textbf{until}} -\newcommand\algorithmicprocedure{\textbf{procedure}} -\newcommand\algorithmicfunction{\textbf{function}} -\newcommand\algorithmicif{\textbf{if}} -\newcommand\algorithmicthen{\textbf{then}} -\newcommand\algorithmicelse{\textbf{else}} -\newcommand\algorithmicrequire{\textbf{Require:}} -\newcommand\algorithmicensure{\textbf{Ensure:}} -\newcommand{\algorithmicreturn}{\textbf{return}} -\newcommand\textproc{\textsc} +\algnewcommand\algorithmicend{\textbf{end}} +\algnewcommand\algorithmicdo{\textbf{do}} +\algnewcommand\algorithmicwhile{\textbf{while}} +\algnewcommand\algorithmicfor{\textbf{for}} +\algnewcommand\algorithmicforall{\textbf{for all}} +\algnewcommand\algorithmicloop{\textbf{loop}} +\algnewcommand\algorithmicrepeat{\textbf{repeat}} +\algnewcommand\algorithmicuntil{\textbf{until}} +\algnewcommand\algorithmicprocedure{\textbf{procedure}} +\algnewcommand\algorithmicfunction{\textbf{function}} +\algnewcommand\algorithmicif{\textbf{if}} +\algnewcommand\algorithmicthen{\textbf{then}} +\algnewcommand\algorithmicelse{\textbf{else}} +\algnewcommand\algorithmicrequire{\textbf{Require:}} +\algnewcommand\algorithmicensure{\textbf{Ensure:}} +\algnewcommand\algorithmicreturn{\textbf{return}} +\algnewcommand\textproc{\textsc} % % *** DECLARED LOOPS *** % -\algdef{SE}[WHILE]{While}{EndWhile}[1]{\algorithmicwhile\ ##1\ \algorithmicdo}{\algorithmicend\ \algorithmicwhile}% -\algdef{SE}[FOR]{For}{EndFor}[1]{\algorithmicfor\ ##1\ \algorithmicdo}{\algorithmicend\ \algorithmicfor}% -\algdef{S}[FOR]{ForAll}[1]{\algorithmicforall\ ##1\ \algorithmicdo}% +\algdef{SE}[WHILE]{While}{EndWhile}[1]{\algorithmicwhile\ #1\ \algorithmicdo}{\algorithmicend\ \algorithmicwhile}% +\algdef{SE}[FOR]{For}{EndFor}[1]{\algorithmicfor\ #1\ \algorithmicdo}{\algorithmicend\ \algorithmicfor}% +\algdef{S}[FOR]{ForAll}[1]{\algorithmicforall\ #1\ \algorithmicdo}% \algdef{SE}[LOOP]{Loop}{EndLoop}{\algorithmicloop}{\algorithmicend\ \algorithmicloop}% -\algdef{SE}[REPEAT]{Repeat}{Until}{\algorithmicrepeat}[1]{\algorithmicuntil\ ##1}% -\algdef{SE}[IF]{If}{EndIf}[1]{\algorithmicif\ ##1\ \algorithmicthen}{\algorithmicend\ \algorithmicif}% -\algdef{C}[IF]{IF}{ElsIf}[1]{\algorithmicelse\ \algorithmicif\ ##1\ \algorithmicthen}% +\algdef{SE}[REPEAT]{Repeat}{Until}{\algorithmicrepeat}[1]{\algorithmicuntil\ #1}% +\algdef{SE}[IF]{If}{EndIf}[1]{\algorithmicif\ #1\ \algorithmicthen}{\algorithmicend\ \algorithmicif}% +\algdef{C}[IF]{IF}{ElsIf}[1]{\algorithmicelse\ \algorithmicif\ #1\ \algorithmicthen}% \algdef{Ce}[ELSE]{IF}{Else}{EndIf}{\algorithmicelse}% \algdef{SE}[PROCEDURE]{Procedure}{EndProcedure}% - [2]{\algorithmicprocedure\ \textproc{##1}\ifthenelse{\equal{##2}{}}{}{(##2)}}% + [2]{\algorithmicprocedure\ \textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}% {\algorithmicend\ \algorithmicprocedure}% \algdef{SE}[FUNCTION]{Function}{EndFunction}% - [2]{\algorithmicfunction\ \textproc{##1}\ifthenelse{\equal{##2}{}}{}{(##2)}}% + [2]{\algorithmicfunction\ \textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}% {\algorithmicend\ \algorithmicfunction}% % -\ifthenelse{\boolean{ALG@noend}}% +\ifthenelse{\equal{\ALG@noend}{t}}% {% \algtext*{EndWhile}% \algtext*{EndFor}% @@ -79,32 +75,18 @@ % % *** OTHER DECLARATIONS *** % -\def\Require{\item[\algorithmicrequire]} -\def\Ensure{\item[\algorithmicensure]} -\def\Return{\algorithmicreturn{} }% +\algnewcommand\Require{\item[\algorithmicrequire]}% +\algnewcommand\Ensure{\item[\algorithmicensure]}% +\algnewcommand\Return{\algorithmicreturn{} }% +\algnewcommand\Call[2]{\textproc{#1}\ifthenelse{\equal{#2}{}}{}{(#2)}}% % % % \ifthenelse{\boolean{ALG@compatible}}% {% - \let\WHILE\While\let\ENDWHILE\EndWhile% - \let\FOR\For\let\FORALL\ForAll\let\ENDFOR\EndFor% - \let\LOOP\Loop\let\ENDLOOP\EndLoop% - \let\REPEAT\Repeat\let\UNTIL\Until% - \let\PROCEDURE\Procedure\let\ENDPROCEDURE\EndProcedure% - \let\FUNCTION\Function\let\ENDFUNCTION\EndFunction% - \let\IF\If\let\ELSIF\ElsIf\let\ELSE\Else\let\ENDIF\EndIf% - \let\REQUIRE\Require\let\ENSURE\Ensure% - \let\STATE\State\let\STATEx\Statex% - \let\COMMENT\Comment% + \ifthenelse{\equal{\ALG@noend}{t}}% + {\RequirePackage[noend]{algcompatible}}% + {\RequirePackage{algcompatible}}% }% {}% % -% -% -}% -% -% -% -\let\ALG@setpseudocode\relax% -% |