[comp.text] TeX memory problem

ceblair@uxe.cso.uiuc.edu (04/07/88)

%  I am trying to do the following in TeX:  I have a sequence of 
% groups of small letters, with one space between each group, followed
% by a Z at the end.  Each group has at least two letters.  I want to
% put a number in front of each group.  

%   The macro below works, in the sense that when I run it, I get 
 
%           1 ab 2 cde 3 fed 4 qrs 5 dd etc.,
 
% but it must be terribly inefficient.  If I try it with even a few 
% more groups than shown here, I get "Memory Capacity Exceeded"
% messages related to parameter stack size.  Comments welcome.
 
%              Charles Blair [BITNET: CEBLAIR at UIUCVMD]
 
\def\numb#1Z{\count11=1 \num#1 W Z}
\def\num#1#2 #3Z{\if #1W {} \else {\number\count11} #1#2 \advance%
\count11 by 1\num #3Z\fi}
\numb ab cde fed qrs dd dede fghjk klkvds mbcd
abcde fg hj Z \bye