[Tugindia] Help me write a macro? (writing out strings to a file)

Ajay Narottam Shah ajayshah at mayin.org
Tue Sep 13 11:07:54 CEST 2005


Folks,

I want to write a macro which works like this.

The context is a book. At the start of processing chapter 4, an empty
file 4.keywords should be created. When I say:

     \keyword{string}

this should be typeset in boldface in the running text, but 

     string\\

should be written into 4.keywords as well. File buffering should not
be done.

At the end of the chapter, I should be able to say

\tableofkeywords

which should induce the code:

  \section*{Keywords}

  \textsl{
    \input{4.keywords}
  }

By not having buffering, it would become a one-pass algorithm, because
at the end of the chapter, the file 4.keywords would be ready to use.

How would I go about writing this macro?

-- 
Ajay Shah                                                   Consultant
ajayshah at mayin.org                      Department of Economic Affairs
http://www.mayin.org/ajayshah           Ministry of Finance, New Delhi



More information about the tugindia mailing list