ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* 'Glossary' on every page
@ 2005-12-29 16:47 Gilles Pérez-Lambert
  2005-12-29 20:59 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Pérez-Lambert @ 2005-12-29 16:47 UTC (permalink / raw)


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?

Thanks in advance,

Gilles.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 'Glossary' on every page
  2005-12-29 16:47 'Glossary' on every page Gilles Pérez-Lambert
@ 2005-12-29 20:59 ` Hans Hagen
  2005-12-30  7:12   ` Gilles Pérez-Lambert
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2005-12-29 20:59 UTC (permalink / raw)


� 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 'Glossary' on every page
  2005-12-29 20:59 ` Hans Hagen
@ 2005-12-30  7:12   ` Gilles Pérez-Lambert
  0 siblings, 0 replies; 3+ messages in thread
From: Gilles Pérez-Lambert @ 2005-12-30  7:12 UTC (permalink / raw)


Hello,

On 12/29/05, Hans Hagen <pragma@wxs.nl> wrote:
> well, instead of making some complex new mechanism, why not misuse notes

Thank you! It's a very good start. If I succeed in eliminating
duplicates in a simple way (and in sorting entries, but not that
important), I'll do a My Way; I'll make a page on the Garden anyway.

Thanks again,

Gilles.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-30  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-29 16:47 'Glossary' on every page Gilles Pérez-Lambert
2005-12-29 20:59 ` Hans Hagen
2005-12-30  7:12   ` Gilles Pérez-Lambert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).