]> mj.ucw.cz Git - ucwmac.git/commitdiff
Added \addto
authorMartin Mares <mj@ucw.cz>
Thu, 31 May 2018 14:54:33 +0000 (16:54 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 31 May 2018 14:54:33 +0000 (16:54 +0200)
test.tex
ucwmac.tex

index 6859be8c8c7ae48c347a16631eda28282b18fa9a..a697b38d9d5506f852079b6ce6feaf575d7371de 100644 (file)
--- a/test.tex
+++ b/test.tex
@@ -1,6 +1,7 @@
 \input ucwmac.tex
 \input ucw-ofs.tex
 \input ucw-verb.tex
+\input ucw-algo.tex
 
 \showfonts
 
@@ -102,4 +103,15 @@ The set{\settextsize{11}text}size macro does not strew spaces.
 
 {\tt Typewriter {\it italic} {\sl slanted.}}
 
+\hd{Algorithms}
+
+\algo{Factorial}\algalias{calculate a~factorial}
+\algin A~non-negative integer~$n$
+\:If $n\ge 1$:
+\::Return $n$
+\:Else:
+\::Return $n \cdot \alg{Factorial}(n-1)$
+\algout The factorial of~$n$
+\endalgo
+
 \bye
index f49d765b14317fb7f81416163b1760d78d414fb4..db9495463d0bd7cb0996110821d42ae94d5adaa3 100644 (file)
        \pdfpkresolution=600    % Provide a reasonable default
 \fi\fi
 
+%%% Auxiliary macros %%%
+
+% Append #2 to the definition of #1
+\long\def\addto#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}
+
 %%% Page size and margins %%%
 
 % If you modify these registers, call \setuppage afterwards