� wrote:
Hello to all,
I have a problem: I want to add a kind of glossary on a book. It will be, in fact, an explanation of acronyms ('NATO: North Atlantic Treaty Organisation' for instance).
But... I'd want it on every page, only for the acronyms used on the current page (and alphabetically sorted if possible)...
I tried using layers (with or without tying them to backgrounds), blocks (\begin... \end...), buffers, list of synonyms, etc. but I had problems with one of the requirements or another. :-)
My first idea was to use blocks for each page :
\beginABREV[1] NATO: North Atlantic Treaty Organisation \endABREV
\beginABREV[1] BLOB: Binary Large Object \endABREV
and to use them with \useblocks[ABREV][\pagenumber] in the footer. To be sure to give the right page number to \beginABREV, I tried to define a label and use it, something like (from memory, I don't have my code near to me):
\reference[abbrev\ABREVcount]% Put a label \beginABREV[{\ref[r][abbrev\ABREVcount]}]% and use the label to get the current page on subsequent runs.
but I went on a nightmare of expansion problems... Plus it didn't eliminate duplicates nor sort the acronyms. But it would have been a start... :-)
Can someone point me to the right direction?
well, instead of making some complex new mechanism, why not misuse notes .... % output=pdf \definenote [glossary] [way=bypage, location={page,high}, factor=0, width=\leftmarginwidth, scope=page, conversion=empty, % no number rule=, before=, after=] \setuplayout [width=middle, height=middle, backspace=5cm, margin=4cm, margindistance=.25cm, cutspace=2cm] \setuptexttexts [margin] [\setups{glossary}] [] \startsetups glossary \vbox to \textheight { \placenotes[glossary] \vfill } \stopsetups \setupnotedefinition [glossary] [location=left, width=fit, distance=.5em, align={right,tolerant,stretch}, headstyle=bold, hang=1] % ok, we will plug in some code (will go into the kernel) \unprotect \def\ownnotesymbol#1% #1 gets number passed {\executeifdefined{\??vn::\currentnote}\empty} \def\setnotesymbol[#1]#2#3% {\prewordbreak % prevent lookback \gdef\lastnotenumber{#2}% \setgvalue{\??vn::#1}{#3} \dolastnotesymbol} \def\ownnote[#1]#2#3#4% {\setnotesymbol[#1]{#2}{#3}% \setnotetext [#1]{#4}} \protect % here we hook the code into the footnote handler \defineconversion [ownnote] [\ownnotesymbol] \setupnote [glossary] [conversion=ownnote, textcommand=, textstyle=, numbercommand=] \showframe \starttext \dorecurse{10} {\dorecurse{5} {I'm \ownnote[glossary]{whowing}{whow}{whatever needs to be glossed:~\recurselevel} a bit. \input tufte \relax}} \stoptext if there is interest i can add the glossary defs (maybe using a different name) to the kernel. I'm a bit puzzled why the notes don't split well ... maybe taco has an idea (he knows ttp -) concerning abbreviations ... maybe some day i'll add a feature like this to it Hans Hans