Re: collecting text througout the document to build lists
- From: herpers@xxxxxxxxxxxxxxxxx
- Date: Thu, 12 Feb 2009 08:51:35 -0800 (PST)
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?
.
- References:
- collecting text througout the document to build lists
- From: herpers
- collecting text througout the document to build lists
- Prev by Date: Re: Specifying baseline-to-baseline skip in TeX
- Next by Date: beamer: set font for non-frame text only?
- Previous by thread: collecting text througout the document to build lists
- Next by thread: Re: collecting text througout the document to build lists
- Index(es):
Relevant Pages
|