> Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm <te...@fiee.net>: > > Hi, > > besides the CG journal I’m working on a scientific biography with huge person > and locality indexes (named Person and Locality for the examples). > > In many cases, the author wants additional information in the index, e.g. > > \Locality{Altona (Hamburg)} > \Locality{Breslau (pol. Wrocław)} > or > \Person{Arends, Katharina (née Schoemaker)} > \Person{Wilhelm II. (Kaiser)} > > Now, I need that consistent and I don’t want to type these complicated > entries every time. > > I’m looking for a good way to handle this – maybe a lookup table in Lua, so > that > \LookupPerson{Willy II} > would call a Lua function that returns > \Person{Wilhelm II. (Kaiser)} > ? > > Or is there already something in place that I overlooked, like > \OverwriteIndexEntry{Hraban}{Ramm, Henning Hraban} > ?
I came up with: \startluacode user.Lookups = { ["Albano"] = "Albano (Provinz Rom)", ["Altona"] = "Altona (Hamburg)", ["Aurich"] = "Aurich (Ostfriesland)" } function user.Lookup(Name) local Res = user.Lookups[Name] if Res then return context(Res) else return context(Name) end end \stopluacode \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \strut\page \placeindex \stoptext The lookup works so far, but all the entries get sorted unter C (because of \ctxlua). I remember I had the same problem with other macros (like \index{\emph{bla}}), but can’t find a solution in my usual sources. Hraban ___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________