From: Martin Mares Date: Thu, 31 May 2018 14:54:33 +0000 (+0200) Subject: Added \addto X-Git-Tag: v1.99~1^2~39 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=9b8cc8cfc29484a09074574d37bfd98bfc109712;p=ucwmac.git Added \addto --- diff --git a/test.tex b/test.tex index 6859be8..a697b38 100644 --- 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 diff --git a/ucwmac.tex b/ucwmac.tex index f49d765..db94954 100644 --- a/ucwmac.tex +++ b/ucwmac.tex @@ -22,6 +22,11 @@ \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