From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/99287 Path: news.gmane.org!.POSTED!not-for-mail From: Jano Kula Newsgroups: gmane.comp.tex.context Subject: Re: Sorting of abbreviations in index Date: Mon, 9 Oct 2017 12:42:16 +0200 Message-ID: References: <3F1C0E18-B416-49D5-B3E0-B0D63743F312@fiee.net> <23a1f832-1457-4735-5b0e-205ca3b45d35@uni-bonn.de> <5AF879E4-42C3-492F-8596-1D880117D3B6@fiee.net> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="089e08268c2c875709055b1ada64" X-Trace: blaine.gmane.org 1507545845 27313 195.159.176.226 (9 Oct 2017 10:44:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Oct 2017 10:44:05 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Oct 09 12:43:58 2017 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1VXR-000636-6p for gctc-ntg-context-518@m.gmane.org; Mon, 09 Oct 2017 12:43:57 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8F62DFE2238; Mon, 9 Oct 2017 12:43:12 +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 7J0StQ_3vlAp; Mon, 9 Oct 2017 12:43:11 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id CB47CFE2239; Mon, 9 Oct 2017 12:43:11 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0B97BFE2239 for ; Mon, 9 Oct 2017 12:43:10 +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 hmVmfwetPo0x for ; Mon, 9 Oct 2017 12:43:09 +0200 (CEST) Original-Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id DEE96FE2238 for ; Mon, 9 Oct 2017 12:42:58 +0200 (CEST) Original-Received: by mail-io0-f177.google.com with SMTP id m16so12351315iod.1 for ; Mon, 09 Oct 2017 03:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=TjKq3khUfvwWdo2VXL1VgzB8LbQtKVNKarqp1sf3inI=; b=H6i/DUiVtmXXvwg5mJQTKKx0IErEThPuoSCkzoA2wXwLndv8FyiGqXi2HGotuIoQyL XUSo74z1SyMLe/Ah9LDWMbYkU8nHCU+5a9FXtlKBRpf84wlS/0NnNQVZdca+wpEysF5D qEmYHLVDrrrk7cIU6yolpHDzk5FeGBopPvtPz3eNSm3WjKnQp6jdidjkHAL86v5ykJLL YI8muHzEi88WUEmNIdte6T9Nqa+x/DIh9qoQXCJIm5N8eg8Fkn5M9vquMdhpY6Q3A/uT JDvWtPz2R/usx97pbOJoGWQgjC3aCm9rBqKn0A+ccl4ZIlLrCzTTV80EAy3jIq1BTF63 7Mag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=TjKq3khUfvwWdo2VXL1VgzB8LbQtKVNKarqp1sf3inI=; b=guHmqKINz/fSaZhTRUK/7GJgUQiVGG4K3jXq1WnDN+wm8tIfXu6VUQgkIYmlVF+UJk H0wjf5Y+iZ4q1KFc4RzyXWL0dSNB13vbZy54iPaxb6XSknru988/6hSf9Gx6f+dTQ5rL b3s6qe3wpAnP2Yy0L+3vGIqsOyJZhLrHo97gX7KrhvKy4OeiQ1XWrwTByjTqZEX5oaIK YC1866vl//UjbaGDZMs9AGmcpSb82V3MfuGKg5sRVMsO7cK3YJbi8cmkbmln/Dzu8Vdd mTHh+8NMYfVieN0fqik+DReDAFQHgCa05lX0joSZqE/m6Hbi8ao751NiGgHhsL2Ad8AD /ydw== X-Gm-Message-State: AMCzsaWSG5QKixs4uBt3GvR3e3AarKNWFTVOwxPcyqBwDQNA1cTCfy6V 0CCLUpEAGZqb4an7xQQznFllsemVYHZAOnlsIo/tEA== X-Google-Smtp-Source: AOwi7QBFdB540mEMoWcPPttzOn040QiJ9lHqKp+BskSGNt6nfk8foJ9S6cYKSlTPmIkEvW+gGeEeWhWLqJeS/Ds64Gk= X-Received: by 10.107.82.13 with SMTP id g13mr13828435iob.214.1507545777124; Mon, 09 Oct 2017 03:42:57 -0700 (PDT) Original-Received: by 10.107.7.219 with HTTP; Mon, 9 Oct 2017 03:42:16 -0700 (PDT) In-Reply-To: <5AF879E4-42C3-492F-8596-1D880117D3B6@fiee.net> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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.org gmane.comp.tex.context:99287 Archived-At: --089e08268c2c875709055b1ada64 Content-Type: multipart/alternative; boundary="089e08268c2c875707055b1ada62" --089e08268c2c875707055b1ada62 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Hraban, have a look into the TUC file to find out, what's going on. I'm sure, Hans would come with a more efficient approach, but this works here. Especially the abbreviation table is probably stored on the fly somewhere, not only in the TUC file and the table could be stored once. Change definition to: \def\Abk#1{\ctxlua{WriteToIndex("#1")}{\sc\lowercase{#1}}} Add lua code to preamble: \startluacode function WriteToIndex (abbr) -- test, if table exits already if structures.synonyms.collected["abbreviation"] then local abbreviation_entries_table =3D structures.synonyms.collected["abbreviation"]["entries"] local abbreviation =3D abbr local meaning =3D "" for i=3D1,#abbreviation_entries_table do local def =3D abbreviation_entries_table[i]["definition"] if def["synonym"] =3D=3D abbreviation then meaning =3D def["meaning"] end end context.Sach(meaning .. " (" .. abbreviation .. ")") end end \stopluacode Abbreviation isn't used then (no \infull), so you need criterium=3Dall to display the list: \setupsynonyms [abbreviation] [textstyle=3Dnormal,criterium=3Dall] Complete example attached. Regards, Jano On 24 September 2017 at 00:45, Henning Hraban Ramm wrote: > So, in extension of my previous question: > I=E2=80=99m combining abbreviations and registers (index). > My author wants organizations listed with full name and abbreviation, and > I try to avoid many verbose entries in the text. > > If I use \infull within \index, entries get sorted at i =E2=80=93 probabl= y a > problem of expansion. How can I solve this? > > \Sach[\infull{ADN}]{\infull{ADN} (ADN)} doesn=E2=80=99t help. > > ----- > > \mainlanguage[de] > \setupsynonyms [abbreviation] [textstyle=3Dnormal] > > \abbreviation{Abt.}{Abteilung} > \abbreviation{ADN}{Allgemeiner Deutscher Nachrichtendienst} > \abbreviation{AFL}{American Federation of Labor} > \abbreviation{ANC}{African National Congress} > \abbreviation{AV}{Auslandsvertretung} > \abbreviation{BArch}{Bundesarchiv} > > \defineregister[Sach][ > pagestyle=3Dnormal, > compress=3Dyes, > indicator=3Dno, > ] > \setupregister[Sach][style=3Dnormal] > > \def\Abk#1{\Sach{\infull{#1} (#1)}{\sc\lowercase{#1}}} > %\def\qAbk#1{\Sach{\infull{#1} (#1)}} > > > \starttext > \section{Intro} > \Sach{Abenteuer}\Sach{Abba}\Sach{Alliteration} > \Sach{Berta}\Sach{C=C3=A4sar}\Sach[Context]{\CONTEXT}\Sach{COBOL}\Sach{C= =C3=A4sium} > \Sach{Igel}\Sach{Jagertee}\Sach{Humboldt}\Sach{infulk}\Sach{infulm} > > \Abk{ADN}, \Abk{ANC}, \Abk{AV} > > \section{Abk=C3=BCrzungen} > \placelistofabbreviations %[criterium=3Dall] > > \section{Sachregister} > \placeregister[Sach] > > %\infull{AV} > %\infull{AFL} > > \stoptext > > ----- > > Greetlings, Hraban > --- > http://www.fiee.net > http://wiki.contextgarden.net > GPG Key ID 1C9B22FD > > ____________________________________________________________ > _______________________ > 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 > ____________________________________________________________ > _______________________ --089e08268c2c875707055b1ada62 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Hraban,

have a look into the TUC = file to find out, what's going on. I'm sure, Hans would come with a= more efficient approach, but this works here. Especially the abbreviation = table is probably stored on the fly somewhere, not only in the TUC file and= the table could be stored once.

Change definition= to:

\def\Abk#1{\ctxlua{WriteToIndex("#1"= ;)}{\sc\lowercase{#1}}}

Add lua code to preamb= le:

\startluacode
function WriteToI= ndex (abbr)
-- test, if table exits already
if structur= es.synonyms.collected["abbreviation"] then
=C2=A0 =C2= =A0 local abbreviation_entries_table =3D structures.synonyms.collected[&quo= t;abbreviation"]["entries"]
=C2=A0 =C2=A0 local ab= breviation =3D abbr
=C2=A0 =C2=A0 local meaning =3D ""<= /div>
=C2=A0 =C2=A0 for i=3D1,#abbreviation_entries_table do
= =C2=A0 =C2=A0 =C2=A0 =C2=A0local def =3D abbreviation_entries_table[i][&quo= t;definition"]
=C2=A0 =C2=A0 =C2=A0 =C2=A0if def["synon= ym"] =3D=3D abbreviation then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0meaning =3D def["meaning"]
=C2=A0 =C2=A0 = =C2=A0 =C2=A0end
=C2=A0 =C2=A0 end
=C2=A0 =C2=A0 contex= t.Sach(meaning .. " (" .. abbreviation .. ")")
end
end
\stopluacode

A= bbreviation isn't used then (no \infull), so you need criterium=3Dall t= o display the list:
\setupsynonyms [abbreviation] [textstyle=3Dno= rmal,criterium=3Dall]

Complete example attached.

Regards,
Jano

<= div class=3D"gmail_extra">
On 24 September 20= 17 at 00:45, Henning Hraban Ramm <texml@fiee.net> wrote:
So, in extension of my previous question:
I=E2=80=99m combining abbreviations and registers (index).
My author wants organizations listed with full name and abbreviation, and I= try to avoid many verbose entries in the text.

If I use \infull within \index, entries get sorted at i =E2=80=93 probably = a problem of expansion. How can I solve this?

\Sach[\infull{ADN}]{\infull{ADN} (ADN)} doesn=E2=80=99t help.

-----

\mainlanguage[de]
\setupsynonyms [abbreviation] [textstyle=3Dnormal]

\abbreviation{Abt.}{Abteilung}
\abbreviation{ADN}{Allgemeiner Deutscher Nachrichtendienst}
\abbreviation{AFL}{American Federation of Labor}
\abbreviation{ANC}{African National Congress}
\abbreviation{AV}{Auslandsvertretung}
\abbreviation{BArch}{Bundesarchiv}

\defineregister[Sach][
=C2=A0 pagestyle=3Dnormal,
=C2=A0 compress=3Dyes,
=C2=A0 indicator=3Dno,
]
\setupregister[Sach][style=3Dnormal]

\def\Abk#1{\Sach{\infull{#1} (#1)}{\sc\lowercase{#1}}}
%\def\qAbk#1{\Sach{\infull{#1} (#1)}}


\starttext
\section{Intro}
\Sach{Abenteuer}\Sach{Abba}\Sach{Alliteration}
\Sach{Berta}\Sach{C=C3=A4sar}\Sach[Context]{\CONTEXT}\Sach{COBOL}= \Sach{C=C3=A4sium}
\Sach{Igel}\Sach{Jagertee}\Sach{Humboldt}\Sach{infulk}\Sach{inful= m}

\Abk{ADN}, \Abk{ANC}, \Abk{AV}

\section{Abk=C3=BCrzungen}
\placelistofabbreviations %[criterium=3Dall]

\section{Sachregister}
\placeregister[Sach]

%\infull{AV}
%\infull{AFL}

\stoptext

-----

Greetlings, Hraban
---
http:/= /www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

maillist : ntg-context@ntg.nl / <= a href=3D"http://www.ntg.nl/mailman/listinfo/ntg-context" rel=3D"noreferrer= " target=3D"_blank">http://www.ntg.nl/mailman/listinfo/ntg-context=
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/cont= ext-mirror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
_________________________________________________________________= __________________

--089e08268c2c875707055b1ada62-- --089e08268c2c875709055b1ada64 Content-Type: application/x-tex; name="index-hraban.tex" Content-Disposition: attachment; filename="index-hraban.tex" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j8k1ori70 XG1haW5sYW5ndWFnZVtkZV0NClxzZXR1cHN5bm9ueW1zIFthYmJyZXZpYXRpb25dIFt0ZXh0c3R5 bGU9bm9ybWFsLGNyaXRlcml1bT1hbGxdDQoNClxhYmJyZXZpYXRpb257QWJ0Ln17QWJ0ZWlsdW5n fQ0KXGFiYnJldmlhdGlvbntBRE59e0FsbGdlbWVpbmVyIERldXRzY2hlciBOYWNocmljaHRlbmRp ZW5zdH0NClxhYmJyZXZpYXRpb257QUZMfXtBbWVyaWNhbiBGZWRlcmF0aW9uIG9mIExhYm9yfQ0K XGFiYnJldmlhdGlvbntBTkN9e0FmcmljYW4gTmF0aW9uYWwgQ29uZ3Jlc3N9DQpcYWJicmV2aWF0 aW9ue0FWfXtBdXNsYW5kc3ZlcnRyZXR1bmd9DQpcYWJicmV2aWF0aW9ue0JBcmNofXtCdW5kZXNh cmNoaXZ9DQoNClxkZWZpbmVyZWdpc3RlcltTYWNoXVsNCiAgcGFnZXN0eWxlPW5vcm1hbCwNCiAg Y29tcHJlc3M9eWVzLA0KICBpbmRpY2F0b3I9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tBbGxpdGVyYXRpb259DQpcU2Fj aHtCZXJ0YX1cU2FjaHtDw6RzYXJ9XFNhY2hbQ29udGV4dF17XENPTlRFWFR9XFNhY2h7Q09CT0x9 XFNhY2h7Q8Okc2l1bX0NClxTYWNoe0lnZWx9XFNhY2h7SmFnZXJ0ZWV9XFNhY2h7SHVtYm9sZHR9 XFNhY2h7aW5mdWxrfVxTYWNoe2luZnVsbX0NCg0KXEFia3tBRE59LCBcQWJre0FOQ30sIFxBYmt7 QVZ9DQoNClxzZWN0aW9ue0Fia8O8cnp1bmdlbn0NClxwbGFjZWxpc3RvZmFiYnJldmlhdGlvbnMN Cg0KXHNlY3Rpb257U2FjaHJlZ2lzdGVyfQ0KXHBsYWNlcmVnaXN0ZXJbU2FjaF0NCg0KXHN0b3B0 ZXh0DQo= --089e08268c2c875709055b1ada64 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 X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --089e08268c2c875709055b1ada64--