From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/108219 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jairo A. del Rio" Newsgroups: gmane.comp.tex.context Subject: Re: consistent index entries Date: Sat, 1 Aug 2020 14:18:00 -0500 Message-ID: References: <212C8B7F-748B-46EA-813B-4CACC17DE1C0@fiee.net> <5545C586-7920-4865-A0D9-BD3C0E1BE405@fiee.net> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5017498950339248295==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39518"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Aug 01 21:18:27 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k1x1X-000AAZ-CH for gctc-ntg-context-518@m.gmane-mx.org; Sat, 01 Aug 2020 21:18:27 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 61AC51A79EC; Sat, 1 Aug 2020 21:18:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IddqnDLO1ex7; Sat, 1 Aug 2020 21:18:15 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 70E431A79DC; Sat, 1 Aug 2020 21:18:15 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C2E251A79E0 for ; Sat, 1 Aug 2020 21:18:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W2tP6_4nivz2 for ; Sat, 1 Aug 2020 21:18:12 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.48; helo=mail-wm1-f48.google.com; envelope-from=jairoadelrio6@gmail.com; receiver= Original-Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id CB8351A79C7 for ; Sat, 1 Aug 2020 21:18:12 +0200 (CEST) Original-Received: by mail-wm1-f48.google.com with SMTP id 3so12049894wmi.1 for ; Sat, 01 Aug 2020 12:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=M7GkiFb78DBniM1M/1NlBYx7WCBGwuJw4K9v8z5w83E=; b=t9A/q23PbgnwjZOMIHsiSh5SrdTBV9OA+WW0ilMFqC8LyZo7LKvHXBShicyhQSZ+Pn G+8bpn3TPE9jWyjnQhAdtw/6dEoJCAcEi/SUiWzHOElmI0a4xRdMTEvYjoP/AhVLcXaC 8LWiBEiqTLUCfBqZyLYcmdQKFnZNBdQ82uptddVnAJ2w+zzSlCMpsBBWwHqz5ovamCZ9 L6MweMlU4cquW6tntlqSvk3yIbbdwjGOzwtG834rqkfpwKjL5pZDe4pi7CBsI19OLQRm 9l9/zrfHvWDv6VPj9reIu7cGqCTHAFQdgQDE7C1+PtpBDgHKChyTC3mhmyMSm8L1IuCE 6lRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=M7GkiFb78DBniM1M/1NlBYx7WCBGwuJw4K9v8z5w83E=; b=b/6kdvneW1PJ0Oc5TvSVtbjLm0QwGQ79H3ThuAi3lHbYlFmXL/I5ooTJkoasOuemCK OJGx1uD4i3uBivX1iVRTDroWU/gWWn7dnSYT5vlr9LxkBe2+LSQnsmYyyyv+KOHIzPqL oEs4NitrN3OczUOc74oUgtdo8m9DgUfF02qA4C4ulMJv97l9mxyD0Zja45/ibt3Eo+VB 5FsKX41X5R/ei+834YQ42IcotZoaSdlSoaX6Ad98AMYg6m1Qd3CPt4YgEFU1IA9soTlc VrPlGDCWtts4fVOGuzHyXHtLmDrFUgN0Zj22Ev57xxFmpCpqBkbCes04O5SDTkDk1cGU AIog== X-Gm-Message-State: AOAM531FSo3BzIflk4cGIhX9FB+lSFuU6XdRkWiwp8Eq4+Y/QsDTbTLo 7LrVS4YMnoJ1eH7JrdpmgV3zJYRl31Y9+6PUVOTRAh+sgFs= X-Google-Smtp-Source: ABdhPJyl8n3K/OUOfLw3vIv+dG6sfh8ZoYnFE0RXj+b5b0QZJFPbE8/4YehmMVuOvJcpU5FG59ykVSU14Kpoj1MClTk= X-Received: by 2002:a1c:3b89:: with SMTP id i131mr8980252wma.30.1596309492146; Sat, 01 Aug 2020 12:18:12 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:108219 Archived-At: --===============5017498950339248295== Content-Type: multipart/alternative; boundary="0000000000003b25c205abd5c4af" --0000000000003b25c205abd5c4af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Wrt formatting (e.g. \index{\emph{something}}), the garden also mentions processors for MkIV (https://wiki.contextgarden.net/Registers#Processors), so you can wrap them with custom commands, in case it helps. Cordially, Jairo. El s=C3=A1b., 1 de ago. de 2020 a la(s) 14:01, Jairo A. del Rio ( jairoadelrio6@gmail.com) escribi=C3=B3: > Hi, Henning. According to the garden, something like: > > \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} > > as long as #1 is capable of being sorted in the normal way, should work. > > Regards, > > Jairo > > El s=C3=A1b., 1 de ago. de 2020 a la(s) 13:49, Henning Hraban Ramm ( > texml@fiee.net) escribi=C3=B3: > >> >> >> > Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm : >> > >> > Hi, >> > >> > besides the CG journal I=E2=80=99m working on a scientific biography w= ith 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=C5=82aw)} >> > or >> > \Person{Arends, Katharina (n=C3=A9e Schoemaker)} >> > \Person{Wilhelm II. (Kaiser)} >> > >> > Now, I need that consistent and I don=E2=80=99t want to type these com= plicated >> entries every time. >> > >> > I=E2=80=99m looking for a good way to handle this =E2=80=93 maybe a lo= okup 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 =3D { >> ["Albano"] =3D "Albano (Provinz Rom)", >> ["Altona"] =3D "Altona (Hamburg)", >> ["Aurich"] =3D "Aurich (Ostfriesland)" >> } >> >> function user.Lookup(Name) >> local Res =3D 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=E2=80=99t find a solution in my usual sourc= es. >> >> >> Hraban >> >> >> ________________________________________________________________________= ___________ >> If your question is of interest to others as well, please add an entry t= o >> 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 >> >> ________________________________________________________________________= ___________ >> > --0000000000003b25c205abd5c4af Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Wrt formatting (e.g. \index{\emph{something}}), = the garden also mentions processors for MkIV (https://wiki.contextgarden.net/Registers= #Processors), so you can wrap them with custom commands, in case it hel= ps.

Cordially,

Jairo.

El s=C3=A1b., 1 de ago. = de 2020 a la(s) 14:01, Jairo A. del Rio (jairoadelrio6@gmail.com) escribi=C3=B3:
Hi, He= nning. According to the garden, something like:

\def\Ort#1{\index[#1= ]{\ctxlua{user.Lookup("#1")}}}

as long as #1 is capa= ble of being sorted in the normal way, should work.

Regards,<= br>
Jairo

El s=C3=A1b., 1 de ago. de 2020 a la(s) 13:49, Hennin= g Hraban Ramm (texml@fi= ee.net) escribi=C3=B3:


> Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm <texml@fiee.net>:
>
> Hi,
>
> besides the CG journal I=E2=80=99m working on a scientific biography w= ith huge person and locality indexes (named Person and Locality for the exa= mples).
>
> In many cases, the author wants additional information in the index, e= .g.
>
> \Locality{Altona (Hamburg)}
> \Locality{Breslau (pol. Wroc=C5=82aw)}
> or
> \Person{Arends, Katharina (n=C3=A9e Schoemaker)}
> \Person{Wilhelm II. (Kaiser)}
>
> Now, I need that consistent and I don=E2=80=99t want to type these com= plicated entries every time.
>
> I=E2=80=99m looking for a good way to handle this =E2=80=93 maybe a lo= okup 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 =3D {
=C2=A0 ["Albano"] =3D "Albano (Provinz Rom)",
=C2=A0 ["Altona"] =3D "Altona (Hamburg)",
=C2=A0 ["Aurich"] =3D "Aurich (Ostfriesland)"
}

function user.Lookup(Name)
=C2=A0 local Res =3D user.Lookups[Name]
=C2=A0 if Res then
=C2=A0 =C2=A0 return context(Res)
=C2=A0 else
=C2=A0 =C2=A0 return context(Name)
=C2=A0 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=E2=80=99t find a solution in my usual sources.


Hraban

___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--0000000000003b25c205abd5c4af-- --===============5017498950339248295== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5017498950339248295==--