From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id B73D725608 for ; Thu, 25 Apr 2024 17:42:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 06762483E17 for ; Thu, 25 Apr 2024 17:42:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=flump.de Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZvYyE4AHNfja for ; Thu, 25 Apr 2024 17:42:30 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 7B7F7482FFD for ; Thu, 25 Apr 2024 17:40:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id F15F2480FA1 for ; Thu, 25 Apr 2024 17:40:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w6C-j--pTctT for ; Thu, 25 Apr 2024 17:40:27 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=185.163.118.210; helo=flump.de; envelope-from=gerion.entrup@flump.de; receiver= Received: from flump.de (flump.de [185.163.118.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 5A08B480FA0 for ; Thu, 25 Apr 2024 17:40:27 +0200 (CEST) Received: from falbala.localnet (unknown [130.75.33.21]) by flump.de (Postfix) with ESMTPSA id C3B4DD06B15 for ; Thu, 25 Apr 2024 17:40:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flump.de; s=mail; t=1714059626; bh=OAyorjDLoaWGyr4X3WT2BMApBK+KNlBZJtC6plCFpu8=; h=From:To:Subject:Date:In-Reply-To:References; b=NvPTmBECRJUsB+mNWviiAFGnVHPmJRQM3TLQJ89cZL2oqhBCjg596oaSwdWadx5GO OJcJMhnH+KEwGHCofPbA+i7EMoDBw1GTd2gOwQOjg+0FB/p+HyDwAUwqUhUft7w3t2 mYiRgio+tvZiaKunrVCQ75MBbQ4X77t7qCMwzmS0= From: Gerion Entrup To: ntg-context@ntg.nl Date: Thu, 25 Apr 2024 17:40:12 +0200 Message-ID: <3091740.CbtlEUcBR6@falbala> In-Reply-To: <3292943.44csPzL39Z@falbala> References: <2931712.e9J7NaK4W3@falbala> <3478475.QJadu78ljV@falbala> <3292943.44csPzL39Z@falbala> MIME-Version: 1.0 Message-ID-Hash: EGXHRCKSP4FXSSBR45K4ECCH7DIK232I X-Message-ID-Hash: EGXHRCKSP4FXSSBR45K4ECCH7DIK232I X-MailFrom: gerion.entrup@flump.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format) List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============8350600746187610531==" --===============8350600746187610531== Content-Type: multipart/signed; boundary="nextPart4586392.cEBGB3zze1"; micalg="pgp-sha256"; protocol="application/pgp-signature" --nextPart4586392.cEBGB3zze1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; protected-headers="v1" From: Gerion Entrup To: ntg-context@ntg.nl Date: Thu, 25 Apr 2024 17:40:12 +0200 Message-ID: <3091740.CbtlEUcBR6@falbala> In-Reply-To: <3292943.44csPzL39Z@falbala> MIME-Version: 1.0 I solved it, although it's kinda hacky. I'm pretty sure that publications.citevariants.short is not meant to be called directly. Do you know why `context.getdetail(dataset, tag, "author")` does not work i= n render_cite? It always returns nil. ``` \setupinteraction[state=3Dstart] \startbuffer[testdata] @Book{knuth1, author =3D {Donald E. Knuth}, title =3D {TEX and METAFONT. New directions in typesetting}, year =3D {1979}, publisher =3D {Addison-Wesley}, } @Article{someother, author =3D {Some Person and Some Otherperson}, title =3D {Another title}, year =3D {1900}, } \stopbuffer % enable tracing \enabletrackers[publications, publications.crossref, publications.details, = publications.cite, publications.strings] \usebtxdataset[main][testdata.buffer] \usebtxdefinitions[aps] \setupbtx[dataset=3Dmain] \definebtxrendering[bibrendering][aps][dataset=3Dmain, numbering=3Dshort] \setupbtxlist[aps][ alternative=3Db, distance=3D.5em, ] \definebtx[aps:cite:special][aps:cite] \startluacode function render_cite(dataset, tag, righttext) local luadata =3D publications.datasets[dataset].luadata local entry =3D luadata[tag] local extrasign =3D "" if entry.author:lower():find("knuth") then extrasign =3D ">" end context("[" .. extrasign) print(righttext) publications.citevariants.short({dataset =3D dataset, reference =3D tag, v= ariant =3D "short", righttext =3D righttext}) context("]") end \stopluacode \startsetups btx:aps:cite:special \btxcitereference \ctxlua{render_cite([=3D=3D[\currentbtxdataset]=3D=3D], [=3D=3D[\currentbt= xtag]=3D=3D], [=3D=3D[\currentbtxrighttext]=3D=3D])} \stopsetups \setupbtx[aps:cite][alternative=3Dspecial] \starttext \def\comma{,} Knuth developed \TeX~\cite[knuth1] Several persons said something~\cite[someother]. \placelistofpublications[bibrendering] \stoptext ``` Gerion Am Dienstag, 23. April 2024, 16:03:50 MESZ schrieb Gerion Entrup: > Here is a solution for the first part of my question. This is based on > https://www.mail-archive.com/ntg-context@ntg.nl/msg101156.html > and try and error based on publ-imp-aps.mkvi and publ-imp-apa.mkvi: >=20 > It display now the citation _and_ numbering labels in the short form: > ``` > \setupinteraction[state=3Dstart] >=20 > \startbuffer[testdata] > @Book{knuth1, > author =3D {Donald E. Knuth}, > title =3D {TEX and METAFONT. New directions in typesetting}, > year =3D {1979}, > publisher =3D {Addison-Wesley}, > } > @Article{someother, > author =3D {Some Person and Some Otherperson}, > title =3D {Another title}, > year =3D {1900}, > } > \stopbuffer >=20 > % enable tracing > \enabletrackers[publications, publications.crossref, publications.details= , publications.cite, publications.strings] >=20 > \usebtxdataset[main][testdata.buffer] > \usebtxdefinitions[aps] > \setupbtx[dataset=3Dmain] > \definebtxrendering[bibrendering][aps][dataset=3Dmain, numbering=3Dshort] > \setupbtxlist[aps][ > alternative=3Db, > distance=3D.5em, > ] > \setupbtx[aps:cite][alternative=3Dshort] >=20 > \starttext >=20 > Knuth developed \TeX \cite[knuth1] > Several persons said something \cite[someother]. >=20 > \placelistofpublications[bibrendering] >=20 > \stoptext > ``` >=20 > The remaining part now is to mark publications of Knuth in a different wa= y. > I have tried this and failed. Here is my code so far: > ``` > \startluacode > function render_cite(short, author) > print(author) > if author:lower():find("knuth") then > context("[>" .. short .. "]") > else > context("[" .. short .. "]") > end > end > \stopluacode > \definebtx[aps:cite:special][aps:cite] > \startsetups btx:aps:cite:special > \btxcitereference > \ctxlua{render_cite([=3D=3D[\btxflush{year}]=3D=3D], [=3D=3D[\btxflush{a= uthor}]=3D=3D])} > \stopsetups > % use it with \cite[special][knuth1] > ``` > This has several problems: > - \btxflush{short} does not work as I expected that. How can I get the sh= ort form? > - \btxflush to pass arguments to lua does not work as intended. On the lu= a side the > variable "author" resolves to "\btxflushauthor{author}" and not to "D.= E. Knuth". > How can I pass the data? >=20 > I use Lua only because I find it more convenient as a programming languag= e. If a > plain tex solution is simpler, I'm happy to use that.=20 >=20 >=20 > Another question that came up while studying the source code: > What effect have \c!, \s!, and \v!? These commands exist a lot in the abo= ve > cited files. >=20 > Gerion >=20 >=20 > Am Mittwoch, 17. April 2024, 15:44:12 MESZ schrieb Gerion Entrup: > > Hi, > >=20 > > > The APS style is an example of a number-based citation system. As you > > > are looking for a tag-based citation, it might be better to start with > > > something like the APA style. > >=20 > > I'm kind of satisfied with the publication-list layout of the APS style= so I chose > > this as a base. If it is simpler to start with the APA style, I can do = that. > >=20 > > My hope is that it is possible to just change the "label" that is used = for > > referencing and keep everything else as is. > >=20 > > > Is there some specification for your short tag-based citation style? > >=20 > > biblatex implements this with the "alphabetic" style. I'm not aware of > > a specification, though. Does the "short" form in ConTeXt exist for a > > specific reason? :) > >=20 > > Gerion > >=20 > > > On Tue, 16 Apr 2024 06:04:35 +0200 > > > Gerion Entrup wrote: > > >=20 > > > > Hi, > > > >=20 > > > > I'm trying to customize a cite format in a bibliography. Currently, > > > > I'm using the aps style which fits so far, except of the plain numb= er > > > > as reference. In concrete, I want to change the following: > > > > - Use the first letter of the last name and the year as reference > > > > (this should be exactly the short form). It is more less also > > > > described here [1]. > > > > - Highlight publications of a certain author with an extra char (e.= g. > > > > '>') > > > >=20 > > > > Here is a minimal example (lets assume, every occurrence of Knuth > > > > should be highlighted): ``` > > > > \setupinteraction[state=3Dstart] > > > >=20 > > > > \startbuffer[testdata] > > > > @Book{knuth1, > > > > author =3D {Donald E. Knuth}, > > > > title =3D {TEX and METAFONT. New directions in typesetting}, > > > > year =3D {1979}, > > > > publisher =3D {Addison-Wesley}, > > > > } > > > > @Article{someother, > > > > author =3D {Some Person and Some Otherperson}, > > > > title =3D {Another title}, > > > > year =3D {1900}, > > > > } > > > > \stopbuffer > > > >=20 > > > > % enable tracing > > > > \enabletrackers[publications, publications.crossref, > > > > publications.details, publications.cite, publications.strings] > > > >=20 > > > > \usebtxdataset[main][testdata.buffer] > > > > \usebtxdefinitions[aps] > > > > \setupbtx[dataset=3Dmain] > > > > \definebtxrendering[bibrendering][aps][dataset=3Dmain] > > > >=20 > > > > % this seems to have no effect? > > > > \setupbtx[alternative=3Dshort] > > > >=20 > > > > \starttext > > > >=20 > > > > Knuth developed \TeX \cite[knuth1]. > > > > Several persons said something \cite[someother]. > > > >=20 > > > > \placelistofpublications[bibrendering] > > > >=20 > > > > \stoptext > > > > ``` > > > >=20 > > > > It should be rendered as: > > > > ``` > > > > Knuth developed TeX [>Knu79]. > > > > Several persons said something [PO00]. > > > >=20 > > > > [Knu79] D.E. Knuth, TEX and METAFONT. New directions in > > > > typesetting (Addi=C2=ADson-Wesley, 1979). [PO00] S. Person and S. > > > > Otherperson, Another title, (1900). ``` > > > >=20 > > > > How can I achieve that \cite[something] always renders in the short > > > > form by default? How can I customize that references to Knuth conta= in > > > > this extra '>'? How can I customize the APS style to also use the > > > > short form in the list of publications instead of numbers? > > > >=20 > > > > Best > > > > Gerion > > > >=20 > > > > [1] > > > > https://tex.stackexchange.com/questions/295444/citation-style-with-= first-letters-of-authors-lastname >=20 --nextPart4586392.cEBGB3zze1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQGzBAABCAAdFiEEM/tVN9WpYYHnPZHxloeAdSYJHeoFAmYqeVwACgkQloeAdSYJ Hep6fAwAxEF1Vb6cbbfvyFrrKFVrEBLxe0H8lsIm50tJTWiRGhS0eS0N5/PVxFoq P2YzugihEPmTMzQGj6KZII6JFukDwQTF4YbdvqlKNmLZMYdFFur8L+T5RYBGK5/M gnF9VRyZnCpqpYAJ5nHNWwdqA7OKiYe/9PB4+18YcM4m6K+wra/zLG1+9hs7lTBQ 4qF+atLHldI9ClNlHTo+hdiLDyC/EGFfYjiZali8SZ5rnoZAri08Xd9AgJRpin96 gQCRuOxsOC1ThRyYSukmaP38ygjCa0FLxrgSaJyVYvtapU117yEtNDIgpqsEEQyK UR5Xx9vfOq4tdJmDX0zqKOG6epA7kB3vz9UrpsANGL+I/UvwaODJHoHNAssc/8dI lxSSZdGpZ+eL136pWoWT/IzBY8sufVneb0R6Tg4glZ9J/nBqfcb+s7EjGRc0xL6U 7dGCHLpHzIwgKfmAcBD5K0pgpJHDgZJJBb96s+Z8ChvXUuSRAZJaJEyRRSLjB5I3 2hUji2Qt =AeeL -----END PGP SIGNATURE----- --nextPart4586392.cEBGB3zze1-- --===============8350600746187610531== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________ --===============8350600746187610531==--