[NTG-context] tooltips and glossary

Michael Saunders odradek5 at gmail.com
Wed May 5 06:36:17 CEST 2010

About glossaries:

Thank you, everyone.  I'm not much of a TeXpert and certainly not a
lua expert, but I'm trying to understand your different solutions and
integrate them into a working system.  There seem to be three

I. Willi Egger---synonym-based
II. Marius---modified index
III. Philipp Gesang---lua-based

I. So far, Willi's synonym-based solution looks simple and promising.
I imagine something like this:

\definesynonyms[gloss][glosses][\infull][\inshort]%to make short
glosses available for tooltips
\definesynonyms[gentry][gentries][\infull][\inshort]%to connect
headwords to entries

%then you have a file of definitions like this one:

\gdef{vibrato}{a periodic fluctuation in pitch}{A periodic fluctuation
of pitch, typically in the range 6--12~Hz.}

%within the text, where you need a tooltip on a word, you can say:

... \hint{vibrato} ...

%at then end of the text, something like:



I see three problems with this:

1.  I don't know how to tell \hint to refer to the "vibrato" in
glosses and not in gentries.
2.  There is no mechanism to refer to the page with a substantive
discussion of "vibrato".
3.  There is no way to handle cases where the string in the text is
some variation of "vibrato" (e.g., Vibrato, vibrati, vibrato's)

II. Marius's modified index solution is the only one to successfully
link the entry back to a point in the text, but the resulting
"glossary"  really just looks like an index.

III.  Philipp Gesang's lua-based solution connects headwords to
entries just as \definesynonyms[gentry][gentries][\infull][\inshort]
does, and it produces something that looks like a glossary, but the
entries have no link back to the text.  Also, I don't see the point of
the \usegloss{word} command unless it references the substantive
discussion(s) of the word.  I think that is what his
"\usegloss[exp]{word}" is for, but then there should be a reference to
it in the entry.  Something like:
{\bd headword}---entry text, p.\at[g:headword]
There probably is some advantage in using the lua script for this, but
I don't know what it is.

About tooltips:

\tooltip surprised me, and I was impressed that it appears to typeset
the tooltip text with Context, but there are some problems with it:

1. It's stretched horizontally.
2. The active area begins at the baseline and stretches about 1 ex
_under_ the word.
3. It appears without a border and under the cursor.

I have seen tooltips in pdf files before, and they looked better than
this.  I suspect the reason is that, as you say, \tooltip uses
Javascript, and the ones I saw use a different mechanism.  I dug
around and found this reference which describes how it's done with
form fields and invisible buttons:
(Notice how tidy the tooltips in it look.) That document describes
setting them up manually in a point-and-click interface, but surely
Context could automate this by putting an invisible frame around the
word and creating a form field/button over it?
And, correct me if I'm wrong, but that mechanism is not
Javascript-based at all, is it?

(by the way:  I've not broken the thread again, have I?)

More information about the ntg-context mailing list