Re: [NTG-context] tooltips and glossary
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 approaches: 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 \def\gdef#1#2#3{\gloss{#1}{#2}\gentry{#1}{#3}} \def\hint#1{\tooltip[middle]{#1}{\infull{#1}}} %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: Glossary: \placelistofgentries 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: http://gilbertconsulting.com/pdf/Build_tool_tips_in_InDesign.pdf (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?)
Hello again, On 2010-05-04 <23:36:17>, Michael Saunders wrote:
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] Here you are! Now the link back to the main explanation (yes, that's what \usegloss[#1]#2 with a nonempty first argument does) is carried by a page reference at the end of the entry. Let me know if you want me to change the formatting.
There probably is some advantage in using the lua script for this, but I don't know what it is. No advantage other than time saving …
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: http://gilbertconsulting.com/pdf/Build_tool_tips_in_InDesign.pdf I had a look at that, he is creating pdf forms and uses them as tooltips -- consequentially I couldn't even see them in xpdf.
(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? Well, it is form-(“widget”-)based and at least some forms use js. The omniscient landfill has some info about this: http://en.wikipedia.org/wiki/Pdf#Interactive_elements But with those elements not even working I have no way to tell them apart. You might be interested in a thread on c.t.t. where widgets and the phantom-box approach are used to accomplish the same in latex: http://groups.google.com/group/comp.text.tex/browse_thread/thread/863613f3d1...
(by the way: I've not broken the thread again, have I?) Unfortunately, yes, gmail is again misbehaving.
Phg -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
... forgot the attachment. -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
On Wed, May 5, 2010 at 7:36 AM, Michael Saunders
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.
You can modify the look of an index with \setupregister http://wiki.contextgarden.net/Reference/en/setupregister
On Wed, May 5, 2010 at 6:36 AM, Michael Saunders
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 approaches:
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 \def\gdef#1#2#3{\gloss{#1}{#2}\gentry{#1}{#3}} \def\hint#1{\tooltip[middle]{#1}{\infull{#1}}}
%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.} Synonyms are defined in strc-syn.mkii (or strc-syn.mkiv, if you are using mkiv) ; maybe it can help you in defining your own macros (just to avoid to reinvent the wheel, possibly)
-- luigi
participants (4)
-
luigi scarso
-
Marius
-
Michael Saunders
-
Philipp Gesang