% \algo{name of the algorithm}\algalias{a longer name}
% \algin input description
% \:step
-% \:step
+% \:step \cmt{comment}
% \::[identifier]nested step
% \:::yet more nested step
% \algout output description
% \endalgo
% Localized strings
-\localedef{en}{alg:alg}{Algorithm}
-\localedef{en}{alg:proc}{Procedure}
-\localedef{en}{alg:in}{Input}
-\localedef{en}{alg:out}{Output}
+\localedef{0}{alg:alg}{Algorithm}
+\localedef{0}{alg:proc}{Procedure}
+\localedef{0}{alg:in}{Input}
+\localedef{0}{alg:out}{Output}
% Item indent
\newdimen\algoindent
\def\algostep#1{\hbox to \algolabelwidth{\hss #1~~}}
\def\algoinit{
- \goodbreak
\begingroup
\algospacing
\inititemize
\let\:=\algoitem
\def\={\leftarrow}
+ \let\cmt=\algcmt
\itemcount=0
}
\def\proc#1{\typedalgo{\localestr{alg:proc}}{#1}}
\def\headlessalgo{\algoinit}
-\def\endalgo{\goodbreak\endlist\endgroup}
+\def\endalgo{\endlist\endgroup}
\let\endproc=\endalgo
\def\algoitem{%
% Algorithm name in text or in a formula
\protected\def\alg#1{\leavevmode\hbox{\csc #1}}
+
+% Comments
+\def\algcmt#1{\unskip~~\hfill\fullcmt{#1}\ignorespaces}
+\def\fullcmt#1{{$\triangleleft$\hskip0.5em\it #1}}