ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: tooltips and glossary
@ 2010-05-06 11:20 Michael Saunders
  2010-05-06 11:49 ` luigi scarso
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Saunders @ 2010-05-06 11:20 UTC (permalink / raw)
  To: ntg-context

Philipp:

Thank you---I appreciate your effort on glossarium.lua very much, but
I don't want to be dependent on you every time I want to tweek my
glossary.  I find it difficult to change the appearance and behavior
of anything in Context, but I think my chances are better with it than
with trying to work in lua.

So, I have pursued the problem via the \definesynonyms approach.  What
I have so far can do all the basic things I imagined, and only seems
to need some cosmetic work now.  This is what I have:

In the preamble:

\definesynonyms[gentry][gentries][\infull][\inshort]
%to connect headwords to entries
\definesynonyms[gloss][glosses][\tttext][\ttkey]
%to make short glosses available for tooltips
\def\gldef#1#2#3{\gloss{#1}{#2}\gentry{#1}{#3 {(p.\at[g:#1])}}}
\def\hint#1{\tooltip[middle]{#1}{\tttext{#1}}}
\def\glref#1{\reference[g:#1]{}}
%to place at a substantive reference in the text

%then you have a file of definitions like this one:
\gldef{vibrato}{a periodic fluctuation in pitch}{A periodic
fluctuation of pitch, typically in the range 6--12~Hz.}


Then, in the text, when you use an unfamiliar word and the reader
could benefit from a quick, pop-up gloss:

\hint{vibrato}  (I just need a more sophisticated version of this that
can deal with variants of the word).

And, when you are about to engage in a substantive discussion of a
word or phrase that appears in the glossary (for a given headword,
there might be zero, one, or several such points in the text):

\glref{vibrato}  (This causes a page reference after the glossary entry.)

I have two questions remaining:

1. I was somehow able to guess that \definesynonyms[gentry][gentries]
creates a new command called "\setupgentries[]", and I imagine this
command must inherit its possible keys and values from another
command, but I don't know what.  Where can I look it up?

2. How can I modify the appearance/location/behavior of tooltips?  I
tried \setuptooltips, but apparently that's not it.

I'll tinker with this and test it for a while.   Eventually I hope to
contribute a glossaries "my way" to the garden.


Hans:

No problem!  I'm sure whatever I put in the Google translator was just
as articulate as what came out of it.   Really, I think the mistake is
mine.  All along I have been assuming that Context was like LaTeX:  a
system for end-users, a language where an author could easily
manipulate the appearance of his document.  Apparently, it's more like
a supporting infrastructure for that.  Maybe it needs a layer of
macros sitting on top of it to make it accessible and friendly to
users/writers.  I'm hoping Idris's book will shed light on this.

Thanks, everyone.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: tooltips and glossary
@ 2010-05-05  4:36 Michael Saunders
  2010-05-05  7:02 ` Philipp Gesang
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Michael Saunders @ 2010-05-05  4:36 UTC (permalink / raw)
  To: ntg-context

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?)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: tooltips and glossary
@ 2010-05-04  9:44 Michael Saunders
  2010-05-04 12:28 ` Philipp Gesang
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Michael Saunders @ 2010-05-04  9:44 UTC (permalink / raw)
  To: ntg-context

Marius:

> Try this one: http://www.tex.ac.uk/tex-archive/info/context-top-ten/cmds.pdf
> -> page 14

Thanks, but that looks like it's just some extracts from cont-eni
translated from Engijsh into Engrish along with a distracting
background that makes it hard to read.  The stuff about the not very
useful abbreviation command is there again, but I'm drawn to the
section about building a dictionary that says it's not about building
a dictionary.    It says:

"All you have to do is inserting a \index at whatever the phrase you
want to index is, and placeing a \placeindex where you want the
glossary to be."

and then goes on to describe and index, not a glossary, which seems to
require commands that need a lot of redundant arguments.  It also
contains this gem:

"Like many other ConTeXt command, users can define their own series of
indexing, which pluses the default \index series are called register."

That's the most remarkable thing I've read today.  Maybe I need to be
more clear.  A glossary is like a little dictionary in the back of a
book that defines the specialized words and phrases that the book uses
that might not be known to the general reader.  Here is a definition
of "glossary":

A collection of glosses; a list with explanations of abstruse,
antiquated, dialectal, or technical terms; a partial dictionary.

("Glosses" were little explanatory notes written in the margins of
medieval texts---the kind of thing I would do if Context's marginal
notes weren't incompatible with its columns.)

Ideally, I'd like a system where I could keep the entries in a bib
database or in a special .tex file.  The records would include the
headword and the gloss, and maybe a cross reference to the point in
the text that dealt with the headword definitively---the point where
the term was explained.  (A document that defines and explains the new
words and phrases it coins---imagine such a thing!)  It would be nice
if there were a command that would automatically link this point in
the text with the glossary entry.  LaTeX has several packages
(glosstex, gloss, glossary, glossaries) that do things like this.

To do this in Context, I will probably have to do it all manually,
defining a command to set an entry and then doing all the
alphabetization and cross-referencing by hand.

What I would really, really, like is to add short definitions to each
glossary record that could pop up as tooltips when the reader hovers
over an unfamiliar word.  Since there is no mechanism for glossaries
in Context, there is no mechanism to build this into, but I'm still
interested in doing it.  The idea is, I could write something like:

\gloss{strange word}{short definition}

The text would read "strange word".  When you hover over it with the
cursor, a tooltip would appear saying "short definition".  It would be
great if this were linked to a glossary mechanism so I wouldn't have
to keep writing the short definition---I could say something like:

\gloss{strange word}

and its short definition would be looked up automatically for the
tooltip.  The automatic reference to the word might look like this, in
the text:

\gref{strange word}

which would cause the page number at that point to be printed at the
end of the glossary entry for "strange word".
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: tooltips and glossary
@ 2010-05-03 19:18 Michael Saunders
  2010-05-03 19:21 ` Wolfgang Schuster
  2010-05-04  1:40 ` Michael Saunders
  0 siblings, 2 replies; 24+ messages in thread
From: Michael Saunders @ 2010-05-03 19:18 UTC (permalink / raw)
  To: ntg-context

>> Also, is there no Context method to produce a glossary?  It might be
>> enough to produce a secondary .bib file with special entries and to
>> print this out as a secondary "References" section, but I don't know
>> how to do this or how to control the appearance of the printed
>> "references".

Wolfgang Schuster:

> http://wiki.contextgarden.net/Reference/en/definesynonyms

If you read that page, you'll notice it doesn't say what the second
and third arguments of \definesynonyms do, what the command
\definesynonyms itself does, nor does it hint at what \infull is
doing.  There is certainly nothing there about using an external
database.  I don't see any way to use \definesynonyms for a glossary
or any practical purpose for \definesynonyms at all, and the
abbreviations example is obviously more trouble than it's worth.

More to the point, there is nothing about tooltips.  Is there a way
for Context to produce tooltips in text (with invisible buttons,
perhaps)?
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 24+ messages in thread
* tooltips and glossary
@ 2010-05-02 22:51 Michael Saunders
  2010-05-03 12:26 ` Wolfgang Schuster
  2010-05-03 19:09 ` Wolfgang Schuster
  0 siblings, 2 replies; 24+ messages in thread
From: Michael Saunders @ 2010-05-02 22:51 UTC (permalink / raw)
  To: ntg-context

Does Context have a mechanism for placing tooltips on text?  I think
the usual PDF way is to put an invisible button over the test and set
its "short description".  Does anyone know how to do this?

Also, is there no Context method to produce a glossary?  It might be
enough to produce a secondary .bib file with special entries and to
print this out as a secondary "References" section, but I don't know
how to do this or how to control the appearance of the printed
"references".
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-05-06 11:49 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-06 11:20 tooltips and glossary Michael Saunders
2010-05-06 11:49 ` luigi scarso
  -- strict thread matches above, loose matches on Subject: below --
2010-05-05  4:36 Michael Saunders
2010-05-05  7:02 ` Philipp Gesang
2010-05-05  7:04   ` Philipp Gesang
2010-05-05  7:04 ` Marius
2010-05-06 10:31 ` luigi scarso
2010-05-04  9:44 Michael Saunders
2010-05-04 12:28 ` Philipp Gesang
     [not found]   ` <o2i54d7f5601005040628p90c28ea6s47eab9d212acce20@mail.gmail.com>
2010-05-04 13:32     ` Michael Saunders
2010-05-04 19:04       ` Philipp Gesang
2010-05-04 19:42       ` Corsair
2010-05-04 13:07 ` Willi Egger
2010-05-04 13:34 ` Marius
2010-05-06  9:45 ` Hans Hagen
2010-05-06 10:00   ` Taco Hoekwater
2010-05-03 19:18 Michael Saunders
2010-05-03 19:21 ` Wolfgang Schuster
2010-05-04  1:40 ` Michael Saunders
2010-05-04  8:18   ` Marius
2010-05-05  6:28   ` Taco Hoekwater
2010-05-02 22:51 Michael Saunders
2010-05-03 12:26 ` Wolfgang Schuster
2010-05-03 19:09 ` Wolfgang Schuster

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).