From 9b8cc8cfc29484a09074574d37bfd98bfc109712 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 31 May 2018 16:54:33 +0200 Subject: [PATCH] Added \addto --- test.tex | 12 ++++++++++++ ucwmac.tex | 5 +++++ 2 files changed, 17 insertions(+) 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 -- 2.39.2