Re: setup and usage for glossaries
Jean-Pierre Delange via ntg-context <[email protected]> Sat, 16 May 2026 20:22:07 +0200
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
Hi Kirk,
There are more than one method to achieve what you want (i. e.
glossaries). A very simple way to begin with glossaries in ConTeXt is to
use the standard register mechanism. In practice, a glossary can
initially be treated as a specialized index.
For example (MWE):
\defineregister[glossary]
\def\Gloss#1{#1\glossary{#1}} % This is a macro which prints the
argument normally in the text and, at the same time, sends the same
argument to the glossary register.
\starttext
\subject{A Market Small Story}
Yesterday morning I went to the village market to buy some fresh fruit.
At the first stall I saw beautiful \Gloss{apples} from Normandy and ripe
\Gloss{pears} carefully arranged in wooden baskets.
Further away, a farmer was selling sweet \Gloss{peaches} and fragrant
\Gloss{apricots}. Nearby, another merchant offered excellent
\Gloss{cherries}, dark \Gloss{plums}, and golden \Gloss{mirabelles}.
Children were asking for \Gloss{bananas} and juicy \Gloss{oranges},
while older customers preferred \Gloss{grapes} and fresh
\Gloss{figs}. One woman was searching for \Gloss{lemons} to prepare a
dessert.
At the end of the market, I discovered exotic \Gloss{mangoes},
fresh \Gloss{pineapples}, and even a few \Gloss{pomegranates}.
A basket full of \Gloss{strawberries} attracted many people.
Before returning home, I bought some \Gloss{raspberries},
a small bag of \Gloss{blackberries}, and several \Gloss{melons}.
\page
\subject{Glossary}
\placeregister[glossary]
\stoptext
This gives you an automatically sorted alphabetical list, with page
references, using only built-in ConTeXt mechanisms.
What makes this approach attractive for beginners is that:
*
no Lua is required;
*
no external database is needed;
*
sorting is automatic;
*
the setup is extremely lightweight;
*
it integrates naturally with ConTeXt’s indexing system.
It is therefore a good first step before moving toward more elaborate
glossary systems with definitions, semantic metadata, custom sorting,
multiple glossaries, or Lua-based collection.
One important point: ConTeXt does not really have a “glossary package”
equivalent to LaTeX’s |glossaries| package. The ConTeXt philosophy is
usually to build such structures from the more general mechanisms
(|register|, XML, Lua, buffers, etc.).
So the documentation you want is often found indirectly through:
*
registers/indexes; like :
https://wiki.contextgarden.net/Command/setupregister
You may want to look at:
*
the ConTeXt Garden pages on registers and indexing;
*
the “Registers” section in the ConTeXt manuals;
*_sed contra_* ! The register method is useful as glossary-index: useful
for locating where a word appears. But, if you need an index that
records terms or concepts together with nuances and explanations, you
need to use a different method. In fact, the |register| method is simple
and effective for creating a glossary-index, that is, an alphabetical
list of terms with page references. Technically, a |register|
essentially stores only a short entry (for example |apple|) together
with its location in the document. It is therefore designed to answer
the question: “where does this word appear?”. By contrast, it is not
naturally suited to a true semantic glossary containing long
definitions, nuances, comments, or conceptual relations, because it does
not manipulate complex documentary structures but only indexing keys.
Best//JP
Le 16/05/2026 à 17:53, Kirk Lowery a écrit :
> Wolfgang,
>
> Thanks for your response. It led me to the linkhttps://tex.stackexchange.com/ and from there I found the file strc-syn.mkxl on the ConTeXt Garden site and read the source. There I found at the top of the file documentation for the module with a detailed example of "abbreviation". That provided a MWE for me to modify to my requirements. I should know to read the source code, I've been doing that for Linux and other software for years. For others on the ConTeXt learning curve, I hope my little journey will help you in yours.
>
> Although it is straightforward, if my MWE is of interest to the list, I can post it here.
>
> Thanks again. I'm grateful for the willingness of you devs and power users to help us newcomers.
>
> Kirk
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist :[email protected] /https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage :https://www.pragma-ade.nl /https://context.aanhet.net (mirror)
> archive :https://github.com/contextgarden/context
> wiki :https://wiki.contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________