[comp.text.tex] Problems using commands in /csname

toriver@lise.unit.no (Tor Iver Wilhelmsen) (04/03/91)

I have a problem using a macro (used in LaTeX) to create automatic
rule numberings for game rules (along the line of: "8.1.2.1: The
English officer counters are never used more than once, however.").
LaTeX says:

! Use of \csname doesn't match its definition.
\Rule ...\advance \cuindex by 1 \advance \csname R
                                                  uleno\number \cuindex \end...

\Rule ...rindent =-30pt\par \bf \theRule \ #1:} #2
                                                   \advance \nxindex by -1 \...
<argument> ...s'' sheet for that expansion set.}}}
                                                   \Rule []{The Volmit playe...

\Rule ...rindent =-30pt\par \bf \theRule \ #1:} #2
                                                   \advance \nxindex by -1 \...
l.16 ...\underline{one} of the INF-ORC~3 units.}}}

So, is there a way to "trick" csname to accept the contents??
The macro looks like this:

\newcount\cuindex % current index
\newcount\nxindex % next index
\newcount\countthis
\expandafter\newcount\csname Ruleno1\endcsname
\cuindex=0
\nxindex=1
\csname Ruleno1\endcsname = 0

% Parameters:
% #1 = initial text to the rule, set in boldface
% #2 = the rule itself

\def\Rule[#1]#2{\advance\cuindex by 1
		\advance\csname Ruleno\number\cuindex\endcsname by 1
		\advance\nxindex by 1
		\expandafter\newcount\csname Ruleno\number\nxindex\endcsname
		\csname Ruleno\number\nxindex\endcsname=0
		\def\theRule{}
		\countthis=1
		\loop
		\edef\theRule{\theRule\number\csname Ruleno\number\countthis\endcsname }
		 \ifnum\countthis < \cuindex
			\advance\countthis by 1
			\edef\theRule{\theRule .}
		 \repeat
		{\parindent=-30pt\par\bf\theRule\  #1:} #2
		\advance\nxindex by -1
		\advance\cuindex by -1 }

The problem is that it _did_ compile without trouble on an older
version of TeX... can anyone shed any light on what the trouble might
be??

--
"When things are slow, don't introduce new technology, introduce new
	terminology." - John C. Dvorak	
"Keep it up, rock'n'roll, good music save your soul" - Motorhead: Ramones
toriver@{lise,solan,siri}.unit.no         pumpkin@norunit.{sintef.no, bitnet}

em@dce.ie (Eamonn McManus) (04/03/91)

toriver@lise.unit.no (Tor Iver Wilhelmsen) writes:
>LaTeX says:
>
>! Use of \csname doesn't match its definition.

It looks as if you have accidentally nuked the \csname primitive, e.g.,
by saying
	\def\csname something\endcsname{...} 
instead of
	\expandafter\def\csname something\endcsname{...}
I didn't see anything wrong with the extracts you posted, so perhaps it
has occurred earlier in the same file (or perhaps I missed it).

,
Eamonn