projects
/
ucwmac.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1b2fdb3
)
ucw-algo: Comments
author
Martin Mares
<mj@ucw.cz>
Tue, 5 Jun 2018 21:01:29 +0000
(23:01 +0200)
committer
Martin Mares
<mj@ucw.cz>
Tue, 5 Jun 2018 21:01:29 +0000
(23:01 +0200)
test.tex
patch
|
blob
|
history
ucw-algo.tex
patch
|
blob
|
history
diff --git
a/test.tex
b/test.tex
index 5d2ba496422fb9c801fcfbee24d36dafffe80c31..42ffd775b416c83b312e2a8396c718047949eaba 100644
(file)
--- 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$
\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)$
\::Return $n$
\:Else:
\::Return $n \cdot \alg{Factorial}(n-1)$
diff --git
a/ucw-algo.tex
b/ucw-algo.tex
index cb65f042bdcf0b74d74f59e210d4dbc168277705..e356ef4f6f3f47ac42f697b1a89a916f36bfd82f 100644
(file)
--- 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
% \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
% \::[identifier]nested step
% \:::yet more nested step
% \algout output description
@@
-59,6
+59,7
@@
\inititemize
\let\:=\algoitem
\def\={\leftarrow}
\inititemize
\let\:=\algoitem
\def\={\leftarrow}
+ \let\cmt=\algcmt
\itemcount=0
}
\itemcount=0
}
@@
-88,3
+89,7
@@
% Algorithm name in text or in a formula
\protected\def\alg#1{\leavevmode\hbox{\csc #1}}
% 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}}