% ALGORITHMIC STYLE -- Released 27 APR 2005 % for LaTeX version 2e % % Copyright Szasz Janos % E-mail szaszjanos@users.sourceforge.net % Based on Peter Williams's algorithmic.sty % \NeedsTeXFormat{LaTeX2e}% \ProvidesPackage{algcompatible}% \RequirePackage{ifthen}% \RequirePackage{algorithmicx}% \typeout{Document Style - algorithmic compatible environments for the `algorithmicx' style}% % \def\ALG@noend{f}% % \DeclareOption{noend}{\def\ALG@noend{t}}% \DeclareOption{end}{\def\ALG@noend{f}}% \ProcessOptions% % % *** DECLARATIONS *** % \algnewlanguage{algorithmic}% \alglanguage{algorithmic}% % % *** KEYWORDS *** % \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\algorithmicif{\textbf{if}} \algnewcommand\algorithmicthen{\textbf{then}} \algnewcommand\algorithmicelse{\textbf{else}} \algnewcommand\algorithmicrequire{\textbf{Require:}} \algnewcommand\algorithmicensure{\textbf{Ensure:}} % % *** DECLARED LOOPS *** % % lines... \let\ALG@loopmark\ALG@x@nomark% % default line and marks \def\ALG@startmark{nomark}% \def\ALG@blockline{noline}% \def\ALG@continuemark{nomark}% \def\ALG@endmark{nomark}% % \newcommand\ALG@compatcomm[1]{\ifthenelse{\equal{#1}{default}}{}{\ \algorithmiccomment{#1}}}% \algrenewcomment[1]{\{#1\}}% \algdef{SE}[WHILE]{WHILE}{ENDWHILE}% [2][default]{\algorithmicwhile\ #2\ \algorithmicdo\ALG@compatcomm{#1}}% {\algorithmicend\ \algorithmicwhile}% \algdef{SE}[FOR]{FOR}{ENDFOR}% [2][default]{\algorithmicfor\ #2\ \algorithmicdo\ALG@compatcomm{#1}}% {\algorithmicend\ \algorithmicfor}% \algdef{S}[FOR]{FORALL}% [2][default]{\algorithmicforall\ #2\ \algorithmicdo\ALG@compatcomm{#1}}% \algdef{SE}[LOOP]{LOOP}{ENDLOOP}% [1][default]{\algorithmicloop\ALG@compatcomm{#1}}% {\algorithmicend\ \algorithmicloop}% \algdef{SE}[REPEAT]{REPEAT}{UNTIL}% [1][default]{\algorithmicrepeat\ALG@compatcomm{#1}}% [1]{\algorithmicuntil\ #1}% \algdef{SE}[IF]{IF}{ENDIF}% [2][default]{\algorithmicif\ #2\ \algorithmicthen\ALG@compatcomm{#1}}% {\algorithmicend\ \algorithmicif}% \algdef{C}[IF]{IF}{ELSIF}% [2][default]{\algorithmicelse\ \algorithmicif\ #2\ \algorithmicthen\ALG@compatcomm{#1}}% \algdef{Ce}[ELSE]{IF}{ELSE}{ENDIF}% [1][default]{\algorithmicelse\ALG@compatcomm{#1}}% \algnewcommand\REQUIRE{\item[\algorithmicrequire]}% \algnewcommand\ENSURE{\item[\algorithmicensure]}% \algnewcommand\STATE{\State}% \algnewcommand\STATEx{\Statex}% \algnewcommand\COMMENT{\Comment}% % \ifthenelse{\equal{\ALG@noend}{t}}% {% \algtext*{ENDWHILE}% \algtext*{ENDFOR}% \algtext*{ENDLOOP}% \algtext*{ENDIF}% }{}% % \algrenewcommand\algorithmicindent{1em}% %