# [tex-live] Nested macro resetting problem

Geoff Russell geoffrey.russell at gmail.com
Sat Jun 13 14:05:03 CEST 2009

When writing I like to put the full name of an organisation at the
first reference
and its initials subsequently:

e.g., The TeXLive User Group (TUG) is always helpful in solving my
problems, because
TUG people are smarter than the average bear.

So I want to say:  The \TUG/ is always helpful in solving my problems
because \TUG/ people are smarter than the average bear.

Easy,

\def\TUG/{TeXLive User Group(TUG) \def\TUG/{TUG}}

And I have a couple of dozen in the book, so I want
\newabbr{TUG}{TeXLive User Group}

Now comes the hard bit,  I want to reset these at the start of each chapter.

\def\mychapter#1{\resetdefs
\chapter{#1}
}

So I'm trying:

\def\newabbr#1#2{%
\edef\nnnn{\resetdefs}%
\expandafter\def\csname#1\endcsname/{#2 (#1)
\expandafter\def\csname#1\endcsname/{#1}}%
\def\resetdefs{\nnnn \expandafter\def\csname#1\endcsname/{#2 (#1)}}%
}

But I'm getting a recursion error, input stack full.

Any ideas?

Cheers,
Geoff Russell