From 28ba27063e52a4bed4934a451bff826f2da40659 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 5 Jun 2018 23:01:29 +0200 Subject: [PATCH] ucw-algo: Comments --- test.tex | 2 +- ucw-algo.tex | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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}} -- 2.39.2