[NTG-context] Sorting descriptions alphabetically

Wolfgang Schuster schuster.wolfgang at googlemail.com
Fri Apr 6 21:21:39 CEST 2012


Am 06.04.2012 um 19:42 schrieb Malte Stien:

> Hi all,
> 
> I have a chapter with a bunch of definitions. I defined myself a description for that purpose, as in:
> 
>  \definedescription[definition][alternative=hanging, headstyle=bold, align=flushleft, style=normal, width=fit, margin=1cm]
> 
> My definitions obviously come out in the order I defined them in the .tex file. I was just wondering whether there is some clever way to have generated in alphabetic order. I could obviously sort them myself in the .tex file, but if there was some way ConTeXt could handle that, that would be very convenient given the number I am dealing with.

Cou can use ConTeXt’s sorting mechanism but you have to be careful about the content of your descriptions.

\usemodule[annotation]

\define[2]\DefintionCommand
  {\begingroup \simplifycommands \let\par\space
   \xdef\DefinitionContent{\placeannotationcontent}%
   \endgroup
   \expanded{\definitions[\DefinitionContent]{\startdefinitiondescription[title={\placeannotationtitle}]\placeannotationcontent\stopdefinitiondescription}}}

\defineannotation[definition][alternative=command,command=\DefintionCommand]

\definesorting    [definitions]
\definedescription[definitiondescription][alternative=hanging,headstyle=bold,align=flushleft,style=normal,width=fit,margin=1cm]


\starttext \showframe

\startdefinition[title=Ward]
The Earth, as a habitat for animal life, is in old age and
has a fatal illness. Several, in fact. It would be happening
whether humans had ever evolved or not. But our presence is
like the effect of an old|-|age patient who smokes many packs
of cigarettes per day |=| and we humans are the cigarettes.
\stopdefinition

\startdefinition[title=Knuth]
Thus, I came to the conclusion that the designer of a new
system must not only be the implementer and first
large||scale user; the designer should also write the first
user manual.

The separation of any of these four components would have
hurt \TeX\ significantly. If I had not participated fully in
all these activities, literally hundreds of improvements
would never have been made, because I would never have
thought of them or perceived why they were important.

But a system cannot be successful if it is too strongly
influenced by a single person. Once the initial design is
complete and fairly robust, the real test begins as people
with many different viewpoints undertake their own
experiments.
\stopdefinition

\startdefinition[title=Zapf]
Coming back to the use of typefaces in electronic
publishing: many of the new typographers receive their
knowledge and information about the rules of typography
from books, from computer magazines or the instruction
manuals which they get with the purchase of a PC or
software. There is not so much basic instruction, as of
now, as there was in the old days, showing the differences
between good and bad typographic design. Many people are
just fascinated by their PC's tricks, and think that a
widely||praised program, called up on the screen, will make
everything automatic from now on.
\stopdefinition

\placelistofsorts[definitions][criterium=all]

\stoptext

Wolfgang



More information about the ntg-context mailing list