ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* 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-04  9:44 tooltips and glossary Michael Saunders
@ 2010-05-04 12:28 ` Philipp Gesang
       [not found]   ` <o2i54d7f5601005040628p90c28ea6s47eab9d212acce20@mail.gmail.com>
  2010-05-04 13:07 ` Willi Egger
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 24+ messages in thread
From: Philipp Gesang @ 2010-05-04 12:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: odradek5


[-- Attachment #1.1.1: Type: text/plain, Size: 4247 bytes --]

(Preliminary remark to M.S.: please, please, configure your MUA to
correctly reply to the current thread!)


Hi Michael,


I'm cc'ing you in case the list eats the attachments.

On 2010-05-04 <04:44:21>, Michael Saunders wrote:
> 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

No, it's plain English. Unfamiliar phrases are just one consequence of a
language becoming the world standard. Do you want to flame Italians or
French for not adhering to the norms of classical Latin? You don't.
There's no point at all in even mentioning somebody's stylistic
idiosyncrasies on the internets. Just face it: the world won't adopt
English as a global means of communication without interfering with its
norms. If you don't understand something why don't you contact the
author, his email adress is right there on the first page.

> 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":

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

I append a snippet that should allow basic glossaries. It doesn't
provide much functionality (capitalization might have to be implemented
…) but you may fit it to your needs. As for the tooltips, unfortunately
I don't know how to create them. The functionality would be nice,
though, as long as no javascript is involved.

(As for the code, it's certainly not context style, I'm aware of that
but don't have the time to care.)

Awaiting your feedback,


Philipp

> 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
> ___________________________________________________________________________________

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

[-- Attachment #1.1.2: glossarium.tex --]
[-- Type: text/x-tex, Size: 1865 bytes --]

\setupinteraction[state=start]

\ctxlua{dofile("glossarium.lua")}

% Use \gloss#1#2 somewhere before \starttext, in a secondary file if you like.
% #1: gloss reference key (used as index)
% #2: the entry (explanation)
\def\gloss#1#2{%
  \ctxlua{gloss.newgloss("#1", "\luaescapestring{#2}")}
}

\def\dousegloss[#1]#2{%
  \ctxlua{gloss.usegloss("#2", "#1")}%
}

% Use this in your text to create a reference to the glossary.
% #1: optional, If this is the main passage where you explain the entry in detail, 
%     the glossary will link back here. (Just make it non-empty.)
% #2: the gloss key
\def\usegloss{\dosingleempty\dousegloss}


% This is meant to create the glossary after the text:
% The gloss key is typeset in bold face and will reference the point in the
% main text where \usegloss was called with a nonempty first arg.
\def\placeglossary{\ctxlua{gloss.place_glossary()}}

\starttext

\gloss{glossary}{%
  A collection of glosses; a list with explanations of abstruse,
  antiquated, dialectal, or technical terms; a partial dictionary. (As defined by
  M.~Saunders)%
}

\gloss{index}{%
  An index (plural: indexes) is a list of words or phrases ('headings') and
  associated pointers ('locators') to where useful material relating to that
  heading can be found in a document.
  (As def'ed by the English Wikipedia)
}

test \usegloss{glossary} test.
\page
Here \usegloss{index} just occurs.
\page
The glossary entry \usegloss[exp]{index} is explained here.
\page
Here \usegloss{index} just occurs again.
\page
Here we'll deal with \usegloss[exp]{glossary} in detail.
\page
Here \usegloss{index} just occurs again.
\page
Here \usegloss{index} just occurs again.
\page
Here we mention \usegloss{glossary}.
\page
Here \usegloss{index} just occurs again.
\page

\placeglossary



\stoptext

[-- Attachment #1.1.3: glossarium.lua --]
[-- Type: text/plain, Size: 2093 bytes --]

--
--------------------------------------------------------------------------------
--         FILE:  glossarium.lua
--        USAGE:  ConTeXt MkIV only
--  DESCRIPTION:  ad-hoc glossary
--       AUTHOR:  Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--      VERSION:  1.0
--      CREATED:  04/05/10 13:00:54 CEST
--     REVISION:  1
--------------------------------------------------------------------------------
--

gloss = {}
gloss.tracker, gloss.content = {}, {}

function gloss.warn( text )
    context.message( "== GLOSSARY: " .. text )
end

function gloss.newgloss( keyword, entry )
    if gloss.content[keyword] then
        gloss.warn( "Entry for " .. keyword .. " exists. Skipping." )
    else
        gloss.content[keyword] = entry
    end
end

function gloss.usegloss( keyword, explained_here)
    if gloss.content[keyword] then
        local indstring = "glossind:" .. keyword
        if explained_here ~= "" and
           not gloss.tracker[keyword] then
            local refstring = "gloss:" .. keyword
            context.reference({ refstring }, "")
            gloss.tracker[keyword] = true
        end
        context.goto(keyword, {indstring})
    else
        gloss.warn( "No entry for " .. keyword .. ". Skipping." )
    end
end

function gloss.place_glossary ()
    -- get all keywords and sort them
    local sort_me = {}
    for key, _ in pairs(gloss.content) do
        table.insert(sort_me, key)
    end
    table.sort(sort_me)

    -- pretty print them somehow
    for _, keyword in ipairs(sort_me) do
        local refstring = "gloss:"    .. keyword
        local indstring = "glossind:" .. keyword
        context.noindentation()
        context.reference({ indstring }, "")
        context.bgroup() 
            context.bf()
            context.goto( keyword, { refstring } )
            --context(keyword)
        context.egroup()
        -- leave some space before entry
        context.hskip1em()
        context(gloss.content[keyword])
        context.par()
    end
end


        


[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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 tooltips and glossary Michael Saunders
  2010-05-04 12:28 ` Philipp Gesang
@ 2010-05-04 13:07 ` Willi Egger
  2010-05-04 13:34 ` Marius
  2010-05-06  9:45 ` Hans Hagen
  3 siblings, 0 replies; 24+ messages in thread
From: Willi Egger @ 2010-05-04 13:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Why do you complain about other user's English? - Let us be happy, that people of another mother tong including my self do participate on the list and share their experience with others!

According to what I tested the basic functionality is already available in Context:

\definesynonyms[Gloss][Glosses][\infull][\inshort]

\Gloss{cooltip}{HEI! This is a longer text in a tooltip}

\def\Hint#1{\tooltip[middle]{#1}{\infull{#1}}}

\starttext
This is a text. This sentence contains a \tooltip[middle]{cooltip}{HEI! This is a longer text in a tooltip}
\blank
This is a text. This sentence contains a \inshort{cooltip}: say: \infull{cooltip}

\blank
This is a text. This sentence contains a \Hint{cooltip}.
\blank[2cm]
\placelistofGlosses
\stoptext


Willi
On 4 May 2010, at 11:44, Michael Saunders wrote:

> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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
       [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
  0 siblings, 2 replies; 24+ messages in thread
From: Michael Saunders @ 2010-05-04 13:32 UTC (permalink / raw)
  To: ntg-context

> (Preliminary remark to M.S.: please, please, configure your MUA to
> correctly reply to the current thread!)

(What's wrong with my subject line?  I'm merely hitting "reply" in gmail.)


> No, it's plain English. Unfamiliar phrases are just one consequence of a
> language becoming the world standard. Do you want to flame Italians or
> French for not adhering to the norms of classical Latin? You don't.
> There's no point at all in even mentioning somebody's stylistic
> idiosyncrasies on the internets. Just face it: the world won't adopt
> English as a global means of communication without interfering with its
> norms. If you don't understand something why don't you contact the
> author, his email adress is right there on the first page.

I don't mind non-native speakers using bad grammar, strange usages, or
odd constructions at all.  Things like that are usually no problem for
native speakers to understand, although the two sentences I quoted
were not "plain English" at all---one was completely indecipherable.
The biggest problem with the docs is far more basic---it's the most
basic mistake a beginning writer can make.  I'm sure documents like
the ones I was shown on this thread make perfect sense to their
authors---who already know what they mean---but they fail to
communicate their message to anyone who doesn't already know it.  The
reader isn't being given enough information to decode the message and
what he is given is in no particular order:  it's whatever bits and
pieces of the story the author thinks of in the order he happens to
think of them.

You can't tell the author this.  It makes sense to him and he can't
understand the criticism.  He has to put himself in the place of the
reader who doesn't already know the message.  If he can't do that, he
can't communicate.  I'm sure that these documents would be just as bad
in the native languages of the authors as they are in English.  The
fault is far deeper than bad translation.

Increasingly, I'm wondering whether the problem with Context is just
bad docs or bad language design (it's hard to control, it looks bad
most of the time).  I still don't know.  I'm hoping that Idris's book
will shed light on this.



> I append a snippet that should allow basic glossaries. It doesn't
> provide much functionality (capitalization might have to be implemented
> …) but you may fit it to your needs.
...
>
> (As for the code, it's certainly not context style, I'm aware of that
> but don't have the time to care.)
>
> Awaiting your feedback,

Thank you.  I'm not quite sure what to do with these files (the .lua
file in particular).  Unfortunately, I won't be able to get to them
until tomorrow.

> As for the tooltips, unfortunately
> I don't know how to create them. The functionality would be nice,
> though, as long as no javascript is involved.

It's not done with javascript.  As I understand it, the usual way is
to place an invisible pdf  "forms"-style button over the word you want
to gloss and then set its "short description" feature.   I think
context knows how to make such buttons and to set bounding boxes
around words, so I think it should be possible, no?
___________________________________________________________________________________
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 tooltips and glossary Michael Saunders
  2010-05-04 12:28 ` Philipp Gesang
  2010-05-04 13:07 ` Willi Egger
@ 2010-05-04 13:34 ` Marius
  2010-05-06  9:45 ` Hans Hagen
  3 siblings, 0 replies; 24+ messages in thread
From: Marius @ 2010-05-04 13:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

On Tue, May 4, 2010 at 12:44 PM, Michael Saunders <odradek5@gmail.com> wrote:
> 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".

I don't know how to make tooltips, but everything else is in the file attached.

[-- Attachment #2: test2.pdf --]
[-- Type: application/pdf, Size: 14169 bytes --]

[-- Attachment #3: test2.tex --]
[-- Type: application/x-tex, Size: 681 bytes --]

[-- Attachment #4: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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 13:32     ` Michael Saunders
@ 2010-05-04 19:04       ` Philipp Gesang
  2010-05-04 19:42       ` Corsair
  1 sibling, 0 replies; 24+ messages in thread
From: Philipp Gesang @ 2010-05-04 19:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3839 bytes --]

On 2010-05-04 <08:32:36>, Michael Saunders wrote:
> > (Preliminary remark to M.S.: please, please, configure your MUA to
> > correctly reply to the current thread!)
> 
> (What's wrong with my subject line?  I'm merely hitting "reply" in gmail.)
Strange, judging from my inbox some of your replies are indeed threaded
correctly, but others are not because they are missing the “references”
and “in-reply-to” headers. Some inconsistency in the gmail frontend?

> > No, it's plain English. Unfamiliar phrases are just one consequence of a
> > language becoming the world standard. Do you want to flame Italians or
> > French for not adhering to the norms of classical Latin? You don't.
> > There's no point at all in even mentioning somebody's stylistic
> > idiosyncrasies on the internets. Just face it: the world won't adopt
> > English as a global means of communication without interfering with its
> > norms. If you don't understand something why don't you contact the
> > author, his email adress is right there on the first page.
> 
> I don't mind non-native speakers using bad grammar, strange usages, or
<snip: mostly right stuff/>
> Increasingly, I'm wondering whether the problem with Context is just
> bad docs or bad language design (it's hard to control, it looks bad
> most of the time).  I still don't know.  I'm hoping that Idris's book
> will shed light on this.
I agree with you in most points and don't want to discuss this here. My
expectations concerning the context book are high, too, I wonder whether
Idris accepts subscriptions … ?

> Thank you.  I'm not quite sure what to do with these files (the .lua
> file in particular).  Unfortunately, I won't be able to get to them
> until tomorrow.
The lua file should be placed in the same directory as your document.
The tex file contains the wrapper macros for the lua functions in the
preamble. Everything between \starttext and \stoptext is demonstration
of the humble functionality. As this is rather an ad-hoc “solution”,
don't expect much of it. To adapt it to a particular layout you'll have
to manipulate the lua source but that won't be hard. Just tell me when
you're in need of something special. (Expect breakage in footnotes! As
usual, \usegloss has to be made unexpanded to get this to work …)
> 
> > As for the tooltips, unfortunately
> > I don't know how to create them. The functionality would be nice,
> > though, as long as no javascript is involved.
> 
> It's not done with javascript.  As I understand it, the usual way is
> to place an invisible pdf  "forms"-style button over the word you want
> to gloss and then set its "short description" feature.   I think
> context knows how to make such buttons and to set bounding boxes
> around words, so I think it should be possible, no?
As pointed out by Willi, context in fact has tooltips functionality but
they _are_ implemented via js. These gimmicks are unsupported by most pdf
readers (or looking funny in okular, which has some basic js support), so
for now I'm personally opposed to using them. Let's hope “lua sponsor”
Adobe replaces js by lua scripting in pdf eventually.

Philipp

> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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 13:32     ` Michael Saunders
  2010-05-04 19:04       ` Philipp Gesang
@ 2010-05-04 19:42       ` Corsair
  1 sibling, 0 replies; 24+ messages in thread
From: Corsair @ 2010-05-04 19:42 UTC (permalink / raw)
  To: ntg-context

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 2895 bytes --]

Hey Michael,

I'm the author of that terrible document.

On Tue, May 04, 2010 at 08:32:36AM -0500, Michael Saunders wrote:
> > No, it's plain English. Unfamiliar phrases are just one consequence of a
> > language becoming the world standard. Do you want to flame Italians or
> > French for not adhering to the norms of classical Latin? You don't.
> > There's no point at all in even mentioning somebody's stylistic
> > idiosyncrasies on the internets. Just face it: the world won't adopt
> > English as a global means of communication without interfering with its
> > norms. If you don't understand something why don't you contact the
> > author, his email adress is right there on the first page.
> 
> I don't mind non-native speakers using bad grammar, strange usages, or
> odd constructions at all.  Things like that are usually no problem for
> native speakers to understand, although the two sentences I quoted
> were not "plain English" at all---one was completely indecipherable.
> The biggest problem with the docs is far more basic---it's the most
> basic mistake a beginning writer can make.  I'm sure documents like
> the ones I was shown on this thread make perfect sense to their
> authors---who already know what they mean---but they fail to
> communicate their message to anyone who doesn't already know it.  The
> reader isn't being given enough information to decode the message and
> what he is given is in no particular order:  it's whatever bits and
> pieces of the story the author thinks of in the order he happens to
> think of them.

I'm sorry for my writing and the inconvenience it brings.  However
right now I cannot do anything about it.  May be I will rewrite it
in the summer.
 
> You can't tell the author this.  It makes sense to him and he can't
> understand the criticism.  He has to put himself in the place of the
> reader who doesn't already know the message.  If he can't do that, he
> can't communicate.  I'm sure that these documents would be just as bad
> in the native languages of the authors as they are in English.  The
> fault is far deeper than bad translation.

Actually I do understand your feeling.  Like I said, I may rewrite
most part of it in the summer.

And BTW, that document is *supposed* to be an extraction of some
particular pieces of info in the official doc.  Because I find the
official doc too heavy for both my PDF viewer and me.  And about the
background, I just grabbed some random Asymptote file of mine.  Though
I find it pretty much ok, I may change that also in the future.

Let's focus on the tooltip and external database issue you
encountered, instead of discuss that document and my bad writing :-).

-- 
There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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 tooltips and glossary Michael Saunders
                   ` (2 preceding siblings ...)
  2010-05-04 13:34 ` Marius
@ 2010-05-06  9:45 ` Hans Hagen
  2010-05-06 10:00   ` Taco Hoekwater
  3 siblings, 1 reply; 24+ messages in thread
From: Hans Hagen @ 2010-05-06  9:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4-5-2010 11:44, Michael Saunders wrote:

> 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:

Aangezien een antwoord in het engels voor jou meer vragen oproept dan 
antwoorden, reageer ik maar even in het Nederlands. Wellicht dat de 
google translator je een perfecte vertaling oplevert.

Omdat iedere gebruiker wel wat anders wil, is het onmogelijk om alles in 
te bouwen zonder dat het ontaard in een veelheid aan commandos. Het is 
dan ook vaak beter bestaande mechanismes te combineren. Veel mechanismes 
hebben een 'command hook' en het is niet zo lastig om bijvoorbeeld het 
synoniem mechanisme op die manier uit te breiden met een tooltip.

Er zijn inmiddels verschillende suggesties gedaan en ik ga daar niets 
aan toevoegen. Het is niet mijn probleem als een gebruiker gebrek heeft 
aan fantasie danwel suggesties niet gebruikt cq. zijn mails zodanig 
formuleert dat er niemand zin heeft om te reageren. Het verbaast me 
zowieso dat er gereageerd wordt, zeker als de toonzetting ronduit 
beledigend is, maar dat kan aan mijn gebrekkige engels liggen.

Overigens, in een perl of lua handleiding zie je ook geen kant en klare 
antwoorden. Men mag er zelf wel wat voor doen.

> "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:

Lijkt me logisch, waarom zou ik een glossary beschrijven als het over 
een index gaat. Je bent de eerste die hier deze twee door elkaar haalt.

Overigens, in mkiv kun je user data laten meereizen en gebruiken maar 
dat leg ik nog wel eens uit (of misschien ook nooit, want ik waag me 
niet meer aan Engels).

> "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":

Ach ja, gsub(manual,"index","glossary") zal je niet geven wat je zoekt 
vrees ik. Overigens, we hebben dat soort 'begrippenlijsten in vrijwel 
elk van onze projekten dus het kan echt wel.

Etc etc.

Overigens, als ik zoveel commentaar had op een programma en de manuals, 
dan was ik al lang afgehaakt dus een doorzetter ben je wel.

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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-06  9:45 ` Hans Hagen
@ 2010-05-06 10:00   ` Taco Hoekwater
  0 siblings, 0 replies; 24+ messages in thread
From: Taco Hoekwater @ 2010-05-06 10:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Just being helpful here:

Hans Hagen wrote:
> 
> Aangezien een antwoord in het engels voor jou meer vragen oproept dan 
> antwoorden, reageer ik maar even in het Nederlands. Wellicht dat de 
> google translator je een perfecte vertaling oplevert.

Since an answer in English you calls more questions than answers, I 
react but just as in Dutch. Possibly that the google translator you 
produce a perfect translation.

> Omdat iedere gebruiker wel wat anders wil, is het onmogelijk om alles in 
> te bouwen zonder dat het ontaard in een veelheid aan commandos. Het is 
> dan ook vaak beter bestaande mechanismes te combineren. Veel mechanismes 
> hebben een 'command hook' en het is niet zo lastig om bijvoorbeeld het 
> synoniem mechanisme op die manier uit te breiden met een tooltip.

Because every user, however, what differently wants, it is impossible 
everything build in without it degenerated in a multiplicity to 
commandos. It is thus frequently better existing combine mechanisms. 
Many mechanisms have ' command hook' and it is not this way cumbersome 
for example the synonymous extend mechanism this way with a tool tip.

> Er zijn inmiddels verschillende suggesties gedaan en ik ga daar niets 
> aan toevoegen. Het is niet mijn probleem als een gebruiker gebrek heeft 
> aan fantasie danwel suggesties niet gebruikt cq. zijn mails zodanig 
> formuleert dat er niemand zin heeft om te reageren. Het verbaast me 
> zowieso dat er gereageerd wordt, zeker als de toonzetting ronduit 
> beledigend is, maar dat kan aan mijn gebrekkige engels liggen.

Several suggestions have been meanwhile done and I will add to that 
nothing. It is not my problem if a user to fantasia or suggestions have 
not used lack cq. to be mails as such formulate that there nobody has to 
react sense. It astonishes me zowieso that there is reacted, the more so 
if the toonzetting is simply offending, but that can lie to my poor 
English.

> Overigens, in een perl of lua handleiding zie je ook geen kant en klare 
> antwoorden. Men mag er zelf wel wat voor doen.

Moreover, in perl or lua guide to see you side also no and klare 
answering. One can do there himself, however, what kind of.

> Lijkt me logisch, waarom zou ik een glossary beschrijven als het over 
> een index gaat. Je bent de eerste die hier deze twee door elkaar haalt.

Me seems logical, for which I would describe glossary if it concerns an 
index. You are the first which obtains here these two by each other.

> Overigens, in mkiv kun je user data laten meereizen en gebruiken maar 
> dat leg ik nog wel eens uit (of misschien ook nooit, want ik waag me 
> niet meer aan Engels).

Moreover, in mkiv can to user let travel with you to data and use but 
that explanation I still once (or perhaps also never, because I venture 
myself no longer to English).

> Ach ja, gsub(manual,"index","glossary") zal je niet geven wat je zoekt 
> vrees ik. Overigens, we hebben dat soort 'begrippenlijsten in vrijwel 
> elk van onze projekten dus het kan echt wel.

At last, gsub (manual, " index" , " glossary") you will not give what 
zoekt you apprehension I. Moreover, we have that type ' term lists in 
nearly each of our projects therefore are possible it really, however.

> Etc etc.

Etc etc.

> Overigens, als ik zoveel commentaar had op een programma en de manuals, 
> dan was ik al lang afgehaakt dus een doorzetter ben je wel.

Moreover, if I had so much comment on a programme and the manuals, then 
I had been for a long time pulled out therefore a doorzetter am you, 
however.



___________________________________________________________________________________
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-06 11:20 Michael Saunders
@ 2010-05-06 11:49 ` luigi scarso
  0 siblings, 0 replies; 24+ messages in thread
From: luigi scarso @ 2010-05-06 11:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> 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.
It's the opposite, but I think we all understand the difficulties
that a Latex user has in changing his point of view (for me it's the
same when I jump in LaTeX)
We cannot do anything more than write same examples that encourage you
in find your solution
(that perhaps you want to share with us or in the wiki then).
The hard part is to find a "context-way" (I personally tend to write
more TeX-plain than context), so looking into the source
is always the best choice.

Anyway I want to say that most of us are sometimes in someway annoyed
by your strong sentences
and this  doesn't help so much in finding a solution.



-- 
luigi
___________________________________________________________________________________
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-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
  2010-05-05  7:04 ` Marius
@ 2010-05-06 10:31 ` luigi scarso
  2 siblings, 0 replies; 24+ messages in thread
From: luigi scarso @ 2010-05-06 10:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, May 5, 2010 at 6:36 AM, Michael Saunders <odradek5@gmail.com> wrote:
> 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
___________________________________________________________________________________
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
@ 2010-05-05  7:04 ` Marius
  2010-05-06 10:31 ` luigi scarso
  2 siblings, 0 replies; 24+ messages in thread
From: Marius @ 2010-05-05  7:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

On Wed, May 5, 2010 at 7:36 AM, Michael Saunders <odradek5@gmail.com> wrote:
> 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

[-- Attachment #2: test2.pdf --]
[-- Type: application/pdf, Size: 13838 bytes --]

[-- Attachment #3: test2.tex --]
[-- Type: application/x-tex, Size: 794 bytes --]

[-- Attachment #4: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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  7:02 ` Philipp Gesang
@ 2010-05-05  7:04   ` Philipp Gesang
  0 siblings, 0 replies; 24+ messages in thread
From: Philipp Gesang @ 2010-05-05  7:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1.1: Type: text/plain, Size: 143 bytes --]

... forgot the attachment.
-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

[-- Attachment #1.1.2: glossarium.lua --]
[-- Type: text/plain, Size: 2223 bytes --]

--
--------------------------------------------------------------------------------
--         FILE:  glossarium.lua
--        USAGE:  ConTeXt MkIV only
--  DESCRIPTION:  ad-hoc glossary
--       AUTHOR:  Philipp Gesang (Phg), <megas.kapaneus@gmail.com>
--      VERSION:  1.0
--      CREATED:  04/05/10 13:00:54 CEST
--     REVISION:  1
--------------------------------------------------------------------------------
--

gloss = {}
gloss.tracker, gloss.content = {}, {}

function gloss.warn( text )
    context.message( "== GLOSSARY: " .. text )
end

function gloss.newgloss( keyword, entry )
    if gloss.content[keyword] then
        gloss.warn( "Entry for " .. keyword .. " exists. Skipping." )
    else
        gloss.content[keyword] = entry
    end
end

function gloss.usegloss( keyword, explained_here)
    if gloss.content[keyword] then
        local indstring = "glossind:" .. keyword
        if explained_here ~= "" and
           not gloss.tracker[keyword] then
            local refstring = "gloss:" .. keyword
            context.reference({ refstring }, "")
            gloss.tracker[keyword] = true
        end
        context.goto(keyword, {indstring})
    else
        gloss.warn( "No entry for " .. keyword .. ". Skipping." )
    end
end

function gloss.place_glossary ()
    -- get all keywords and sort them
    local sort_me = {}
    for key, _ in pairs(gloss.content) do
        table.insert(sort_me, key)
    end
    table.sort(sort_me)

    -- pretty print them somehow
    for _, keyword in ipairs(sort_me) do
        local refstring = "gloss:"    .. keyword
        local indstring = "glossind:" .. keyword
        context.noindentation()
        context.reference({ indstring }, "")
        context.bgroup() 
            context.bf()
            --context.goto( keyword, { refstring } )
            context(keyword)
        context.egroup()

        -- leave some space before entry
        context.hskip1em()
        context(gloss.content[keyword])

        context.unskip()
        context(", (")
        context.at( "v.s. on p.", { refstring } )
        context(").")

        context.par()
    end
end


        


[-- Attachment #1.1.3: glossarium.tex --]
[-- Type: text/x-tex, Size: 1929 bytes --]

\setupinteraction[state=start]

\ctxlua{dofile("glossarium.lua")}

% Use \gloss#1#2 somewhere before \starttext, in a secondary file if you like.
% #1: gloss reference key (used as index)
% #2: the entry (explanation)
\def\gloss#1#2{%
  \ctxlua{gloss.newgloss("#1", "\luaescapestring{#2}")}
}

\def\dousegloss[#1]#2{%
  \ctxlua{gloss.usegloss("#2", "#1")}%
}

% Use this in your text to create a reference to the glossary.
% #1: optional, If this is the main passage where you explain the entry in detail, 
%     the glossary will link back here. (Just make it non-empty.)
% #2: the gloss key
\unexpanded\def\usegloss{\dosingleempty\dousegloss}


% This is meant to create the glossary after the text:
% The gloss key is typeset in bold face and will reference the point in the
% main text where \usegloss was called with a nonempty first arg.
\def\placeglossary{\ctxlua{gloss.place_glossary()}}

\starttext

\gloss{glossary}{%
  A collection of glosses; a list with explanations of abstruse,
  antiquated, dialectal, or technical terms; a partial dictionary. (As defined by
  M.~Saunders)%
}

\gloss{index}{%
  An index (plural: indexes) is a list of words or phrases ('headings') and
  associated pointers ('locators') to where useful material relating to that
  heading can be found in a document.
  (As def'ed by the English Wikipedia)
}

test \usegloss{glossary} test.
\page
Here \usegloss{index} just occurs.
\page
The glossary entry \usegloss[exp]{index} is explained here.
\page
Here \usegloss{index} just occurs again.
\footnote{Here \usegloss{index} just occurs again.}
\page
Here we'll deal with \usegloss[exp]{glossary} in detail.
\page
Here \usegloss{index} just occurs again.
\page
Here \usegloss{index} just occurs again.
\page
Here we mention \usegloss{glossary}.
\page
Here \usegloss{index} just occurs again.
\page

\placeglossary



\stoptext

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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
  2010-05-05  7:04   ` Philipp Gesang
  2010-05-05  7:04 ` Marius
  2010-05-06 10:31 ` luigi scarso
  2 siblings, 1 reply; 24+ messages in thread
From: Philipp Gesang @ 2010-05-05  7:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2982 bytes --]

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/863613f3d13337f1/989369a06aaf7a34?lnk=raot

> (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

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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  1:40 ` Michael Saunders
  2010-05-04  8:18   ` Marius
@ 2010-05-05  6:28   ` Taco Hoekwater
  1 sibling, 0 replies; 24+ messages in thread
From: Taco Hoekwater @ 2010-05-05  6:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Michael Saunders wrote:
>> Wolfgang Schuster:
>> http://pragma-ade.com/general/manuals/cont-enp.pdf -> page 159
> 
> That rambling entry is like the webpage but worse.  It still doesn't
> say what arguments 2--4 do, why \infull is necesarry, or anything else
> with any clarity.  It's just another bundle of bad writing concealing
> what may be (but probably isn't) something useful. 

plonk.
___________________________________________________________________________________
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  1:40 ` Michael Saunders
@ 2010-05-04  8:18   ` Marius
  2010-05-05  6:28   ` Taco Hoekwater
  1 sibling, 0 replies; 24+ messages in thread
From: Marius @ 2010-05-04  8:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, May 4, 2010 at 4:40 AM, Michael Saunders <odradek5@gmail.com> wrote:
>> Wolfgang Schuster:
>> http://pragma-ade.com/general/manuals/cont-enp.pdf -> page 159
>
> That rambling entry is like the webpage but worse.  It still doesn't
> say what arguments 2--4 do, why \infull is necesarry, or anything else
> with any clarity.  It's just another bundle of bad writing concealing
> what may be (but probably isn't) something useful.  I was thinking of
> something like GlossTeX:
> ftp://ftp.dante.de/tex-archive/support/glosstex/glosstex.pdf

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

> I accept that Context has nothing built-in that's useful for making
> glossaries.  That's okay, I can come up with something on my own.  How
> about tooltips, though?  Does anyone do those with Context?
___________________________________________________________________________________
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
  2010-05-04  8:18   ` Marius
  2010-05-05  6:28   ` Taco Hoekwater
  1 sibling, 2 replies; 24+ messages in thread
From: Michael Saunders @ 2010-05-04  1:40 UTC (permalink / raw)
  To: ntg-context

> Wolfgang Schuster:
> http://pragma-ade.com/general/manuals/cont-enp.pdf -> page 159

That rambling entry is like the webpage but worse.  It still doesn't
say what arguments 2--4 do, why \infull is necesarry, or anything else
with any clarity.  It's just another bundle of bad writing concealing
what may be (but probably isn't) something useful.  I was thinking of
something like GlossTeX:
ftp://ftp.dante.de/tex-archive/support/glosstex/glosstex.pdf

I accept that Context has nothing built-in that's useful for making
glossaries.  That's okay, I can come up with something on my own.  How
about tooltips, though?  Does anyone do those with Context?
___________________________________________________________________________________
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
  1 sibling, 0 replies; 24+ messages in thread
From: Wolfgang Schuster @ 2010-05-03 19:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 03.05.10 21:18, schrieb Michael Saunders:
>> 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.
>    
http://pragma-ade.com/general/manuals/cont-enp.pdf -> page 159

Wolfgang

___________________________________________________________________________________
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

* Re: tooltips and glossary
  2010-05-02 22:51 Michael Saunders
  2010-05-03 12:26 ` Wolfgang Schuster
@ 2010-05-03 19:09 ` Wolfgang Schuster
  1 sibling, 0 replies; 24+ messages in thread
From: Wolfgang Schuster @ 2010-05-03 19:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 03.05.10 00:51, schrieb Michael Saunders:
> 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?
>    

http://wiki.contextgarden.net/Widgets

Wolfgang

___________________________________________________________________________________
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-02 22:51 Michael Saunders
@ 2010-05-03 12:26 ` Wolfgang Schuster
  2010-05-03 19:09 ` Wolfgang Schuster
  1 sibling, 0 replies; 24+ messages in thread
From: Wolfgang Schuster @ 2010-05-03 12:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 03.05.10 00:51, schrieb Michael Saunders:
> 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".
>    
http://wiki.contextgarden.net/Reference/en/definesynonyms

Wolfgang

___________________________________________________________________________________
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-04  9:44 tooltips and glossary 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
  -- strict thread matches above, loose matches on Subject: below --
2010-05-06 11:20 Michael Saunders
2010-05-06 11:49 ` luigi scarso
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-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).