From: Martin Mares Date: Tue, 5 Jun 2018 21:01:29 +0000 (+0200) Subject: ucw-algo: Comments X-Git-Tag: v1.99~1^2~17 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=28ba27063e52a4bed4934a451bff826f2da40659;p=ucwmac.git ucw-algo: Comments --- diff --git a/test.tex b/test.tex index 5d2ba49..42ffd77 100644 --- a/test.tex +++ b/test.tex @@ -106,7 +106,7 @@ The set{\settextsize{11}text}size macro does not strew spaces. \algo{Factorial}\algalias{calculate a~factorial} \algin A~non-negative integer~$n$ -\:If $n\ge 1$: +\:If $n\ge 1$: \cmt{Test if something} \::Return $n$ \:Else: \::Return $n \cdot \alg{Factorial}(n-1)$ diff --git a/ucw-algo.tex b/ucw-algo.tex index cb65f04..e356ef4 100644 --- a/ucw-algo.tex +++ b/ucw-algo.tex @@ -7,7 +7,7 @@ % \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 @@ -59,6 +59,7 @@ \inititemize \let\:=\algoitem \def\={\leftarrow} + \let\cmt=\algcmt \itemcount=0 } @@ -88,3 +89,7 @@ % 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}}