diff --git a/algorithms.dtx b/algorithms.dtx index c0e6233..3ca35b5 100644 --- a/algorithms.dtx +++ b/algorithms.dtx @@ -764,6 +764,8 @@ USA. % \newcommand{\algorithmicendupon}{\algorithmicend\ \algorithmicupon} % \newcommand{\algorithmicproc}{\textbf{procedure}} % \newcommand{\algorithmicendproc}{\algorithmicend\ \algorithmicproc} +% \newcommand{\algorithmicfunction}{\textbf{function}} +% \newcommand{\algorithmicendfunction}{\algorithmicend\ \algorithmicfunction} % \newcommand{\algorithmicrepeat}{\textbf{repeat}} % \newcommand{\algorithmicendrepeat}{\algorithmicend\ \algorithmicrepeat} % \newcommand{\algorithmicuntil}{\textbf{until}} @@ -1232,6 +1234,8 @@ USA. \newcommand{\algorithmicendupon}{\algorithmicend\ \algorithmicupon} \newcommand{\algorithmicproc}{\textbf{procedure}} \newcommand{\algorithmicendproc}{\algorithmicend\ \algorithmicproc} +\newcommand{\algorithmicfunction}{\textbf{function}} +\newcommand{\algorithmicendfunction}{\algorithmicend\ \algorithmicfunction} \newcommand{\algorithmicprint}{\textbf{print}} \newcommand{\algorithmiccontinue}{\textbf{continue}} \newcommand{\algorithmicbreak}{\textbf{break}} @@ -1345,6 +1349,7 @@ USA. \newenvironment{ALC@otherwise}{\begin{ALC@g}}{\end{ALC@g}} \newenvironment{ALC@upon}{\begin{ALC@g}}{\end{ALC@g}} \newenvironment{ALC@proc}{\begin{ALC@g}}{\end{ALC@g}} + \newenvironment{ALC@function}{\begin{ALC@g}}{\end{ALC@g}} \renewcommand{\\}{\@centercr} \newcommand{\INPUTS}[1][default]{\ALC@it\algorithmicinputs\ \ALC@com{##1}\begin{ALC@inputs}} \newcommand{\ENDINPUTS}{\end{ALC@inputs}} @@ -1384,6 +1389,8 @@ USA. \ALC@com{##1}\begin{ALC@upon}} \newcommand{\PROC}[2][default]{\ALC@it\algorithmicproc\ ##2\ % \ALC@com{##1}\begin{ALC@proc}} + \newcommand{\FUNCTION}[3][default]{\ALC@it\algorithmicfunction\ ##2(##3) % +\ALC@com{##1}\begin{ALC@function}} \ifthenelse{\boolean{ALC@noend}}{ \newcommand{\ENDIF}{\end{ALC@if}} \newcommand{\ENDFOR}{\end{ALC@for}} @@ -1395,6 +1402,7 @@ USA. \newcommand{\ENDOTHERWISE}{\end{ALC@otherwise}} \newcommand{\ENDUPON}{\end{ALC@upon}} \newcommand{\ENDPROC}{\end{ALC@proc}} + \newcommand{\ENDFUNCTION}{\end{ALC@function}} }{ \newcommand{\ENDIF}{\end{ALC@if}\ALC@it\algorithmicendif} \newcommand{\ENDFOR}{\end{ALC@for}\ALC@it\algorithmicendfor} @@ -1406,6 +1414,7 @@ USA. \newcommand{\ENDOTHERWISE}{\end{ALC@otherwise}\ALC@it\algorithmicendotherwise} \newcommand{\ENDUPON}{\end{ALC@upon}\ALC@it\algorithmicendupon} \newcommand{\ENDPROC}{\end{ALC@proc}\ALC@it\algorithmicendproc} + \newcommand{\ENDFUNCTION}{\end{ALC@function}\ALC@it\algorithmicendfunction} } \renewcommand{\@toodeep}{} \begin{list}{\ALC@lno}{\setcounter{ALC@rem}{0}\setcounter{ALC@line}{0}%