Re: collecting text througout the document to build lists



Here ist the code I came up with so far:

\documentclass{article}

\newcommand{\printkeywords}{}

\makeatletter
\newcommand{\addtokeyword}[2]
{%
\label{#1#2}%
\@ifundefined{#1}
{%
\expandafter\def\csname #1\endcsname{#2\hfill\pageref
{#1#2}\\}%
\expandafter\def\csname #1name\endcsname{\vskip .5cm
#1}%
\g@addto@macro{\printkeywords}{\csname #1name\endcsname
\\\csname #1\endcsname}%
}
{\expandafter\g@addto@macro\csname #1\endcsname{#2\hfill
\pageref{#1#2}\\}}
}
\makeatother

\setlength{\parindent}{0pt}
\begin{document}
text
\addtokeyword{lot-sizing}{WS08/09}
\addtokeyword{inventory management}{WS08/09}
\newpage
text
\addtokeyword{lot-sizing}{WS07/08}
\newpage

\printkeywords
\end{document}

\printkeywords produces an output like this:
lot-sizing
WS 08/09 1
WS 07/08 2
inventory management
WS 08/09 1


Two things I don't like about this approach:
1) I can not sort the entries by keywpords...I could live with this
flaw.
2) I can only call \printkeywords at the end of my document. That is
too bad. As a table of conents I would like to print the index at the
beginning of my document. That would require to write the contents of
\printkeywords to a file. I tried \immediate\write, but I was unable
to make it work. Either it didn't compile or it didn't expand...

Any suggestions?
.



Relevant Pages

  • Re: ADA Popularity Discussion Request
    ... but you don't get this sort of extremely interactive incremental ... > compile time and the program at run time, ... The "both" here is typically not true in static languages. ... In a dynamic language, _values_ have types, variables are just binding ...
    (comp.lang.ada)
  • Re: Fantasy Books not set in pseudo-Europe
    ... looking for this sort of thing and haven't read those, ... you have to go to the entries on the 1001 Nights and on "Persia" ... <Wheel of the Infinite> ... Fantasy rooted in no particular Earth historical culture is not, ...
    (rec.arts.sf.written)
  • How to sort the variable length objects in Lexicographical order?
    ... I am involved in the Agent development for providing the support for ... about the lexicographic ordering of the table entries with respect to ... Because we need to sort the connection table based on four parameters ...
    (comp.protocols.snmp)
  • CL subset?
    ... language in a conscious effort to create smaller distributables. ... case of COMPILE and friends, they wouldn't be giving up much at all. ... it seems the most obvious way to implement this sort of thing is to ... LISP" question. ...
    (comp.lang.lisp)
  • Re: What is the fastest way to determine if folder has subfolders or not!?
    ... | This sort of stuff does work very nicely, and is a good way of storing ... in binary tree search on 6000 entries would take 12 steps. ... for faster getting of free units, and if there is none free, using last unit offset + 1)... ... I sew VMWare has sdk for their disk format maybe beter idea would be to use their disk driver and sdk for such job. ...
    (microsoft.public.vb.winapi)