From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/27574 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Julien Dutant Newsgroups: gmane.text.pandoc Subject: recursive citeproc? Date: Mon, 25 Jan 2021 06:00:13 -0800 (PST) Message-ID: <22fc94e0-d1e7-44b9-a683-a387f3c24e58n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3380_334243611.1611583213758" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9855"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC5Y3356IYIO5HN3QADBUBFYSVGRG-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Jan 25 15:00:17 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f190.google.com ([209.85.167.190]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l42Ph-0002Rb-8y for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 25 Jan 2021 15:00:17 +0100 Original-Received: by mail-oi1-f190.google.com with SMTP id e63sf2265407oib.21 for ; Mon, 25 Jan 2021 06:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=VJc14SSa0SbRaPJrHM6wvS0pvXmtqdQ2+pR4H4Z4zfA=; b=QA4nJ/fBBvFJuwdSvfMbOMq787FSlRi3fZ5Crt5Q99XujUTwTYdNxL8Wn7pVUUky0Q doBXS/OQvfRyBuMR3q5p7qjI2+nFPVzxbBW3NH4Ch3/D/vzQCpUUfJ5kjM6gZSLm9lc5 gteP+fbEu/5J9722cBl7GLvd/dd7KjIqnndAZNAN8aqcfH5JzdqgVjlxpMeXBnZPQK/a QfG8jZP0Bh+1IeAtu4CjM+YR9ZTNs9Zp25dv4gH+MoxYtjWKBbsPB4jAubBcP5I2iQaE ev0a67mvk10ZJXK+r8fFQrfnRx4esYa/aiwqY2hLmhCAQLtUeGh8R7cEeSiudQDFcAUD vFcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=VJc14SSa0SbRaPJrHM6wvS0pvXmtqdQ2+pR4H4Z4zfA=; b=Ato2Mqs4eALMBxAmZqiJjzIOZ+D9jytLlSzC5tGEpyif5si3jpUMgqLbToX1JHert1 Wlpa1P+5RXyiH/eo6GOPoRje5gTyfDsY+9tg+I6teiST3W+m2MYVBRbX/V8XtW4dA3i9 NccQWI6PsNjdy4rm8RIvMOQbCqTozhkA2ukgumm1Cgd2GeBDwqj6Q3sqM27sOUvdtLTd PANhmf5qw+2k/Taigg2gACDNRfc+WAEb0S8ZANgrLuBlG1Yu9QebOgnwtgBSoKSvuuMP +Ml+Jg5H3MfXqVYDt7Vl832XOUSKiK1fQ6nhf0AqODSGdR6oMy6tjnlcxNCVv88X2y1V oDmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=VJc14SSa0SbRaPJrHM6wvS0pvXmtqdQ2+pR4H4Z4zfA=; b=hWWWUPo3Ly/A3TDgsW2yf8WLMsaPxn312KaC62Vbq44JWAFJ3khZ6Du9qhBy2ZlhDW U2DPRQjX5ZhohxxQQU30HNbirgnzLR1mDqVL/rh7aXZ74Ds6bu8VMl/LU7itoKY/avHO zQlSPBy6Rg/du+5bpA5TjiGuUjMQC/Fz1Wn7x9UPGJoscKQAdiR3Ny0LgF/HCVt1GKPD 7T6rrg9iW8sh9BG/vmnTxXHjci3QvexNabWAzRQ2qfT8Iv6WeGQ5PQmIsiTBNoP+CBQk /tYUtrvMYWbrVm7u+ChtLvuh1/QKk8b6ZoP+UbZ6Ae9agskBLe6W63/rnOwSBC8r+WAD TelQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532kkKp4n4UoHhMC54HCfOjsJHQO7bECJNjtgMCcDIH4+vZ1/a4H Cs9JhcJC4Q8aUO0H6MAhq5Q= X-Google-Smtp-Source: ABdhPJwV95CWtsdE9w0Hp48/blAAYjoUnY4YivDFIe6LCChyjQ/90L8FR/dtLR+LoVshBE+G+BJgKw== X-Received: by 2002:a9d:19c8:: with SMTP id k66mr521477otk.89.1611583216268; Mon, 25 Jan 2021 06:00:16 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:1e4a:: with SMTP id e10ls2652883otj.7.gmail; Mon, 25 Jan 2021 06:00:14 -0800 (PST) X-Received: by 2002:a05:6830:13ce:: with SMTP id e14mr514239otq.356.1611583214496; Mon, 25 Jan 2021 06:00:14 -0800 (PST) X-Original-Sender: julien.dutant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:27574 Archived-At: ------=_Part_3380_334243611.1611583213758 Content-Type: multipart/alternative; boundary="----=_Part_3381_1857295319.1611583213758" ------=_Part_3381_1857295319.1611583213758 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear all,=20 I have to work with self-citing .bib files. They contain \citet commands in= =20 the title and note fields, e.g.: ``` @Article{lewis_dk:1981b, author =3D {Lewis, David}, journal =3D {Theoria}, title =3D {Are We Free to Break the Laws?}, year =3D {1981}, note =3D {reprinted in \citet[291--298]{lewis_dk:1986a}}, number =3D {3}, pages =3D {113--121}, volume =3D {47}, doi =3D {10.1093/0195036468.003.0010}, } @article{aaron_ri-etal:1961, author =3D {Aaron, Richard Ithamar and Rotenstreich, Nathan and Passmore,= =20 John A. and Mercier, Andr{\'e} and Russell, Leonard and Moreau, Joseph }, year =3D { 1961 }, title =3D { Discussion sur \citet{hersch_j:1961} et \citet{marias:1961} }, journal =3D { dialectica }, volume =3D { 15 }, number =3D { 57--58 }, pages =3D { 253--257 }, } ``` In LaTeX these would be processed by compiling the document 3 times. But=20 (a) I intend to work with citeproc + CSL, and (b) I can't manually replace= =20 all the \citet commands in the .bib file (thousands of entries). Right now= =20 my best solution would be to write a python script using bibparse and=20 citeproc-py (https://pypi.org/project/bibparse/ and=20 https://github.com/brechtm/citeproc-py) to process those \citet commands.= =20 But I'm curious to hear if you have a better idea - or if John would=20 consider making citeproc recursive.=20 In general, Citeproc processes LaTeX commands in .bib fields, but not \cite= =20 commands. They are passed as such in TeX output: ``` \leavevmode\hypertarget{ref-aaron_ri-etal:1961}{}% Aaron, Richard Ithamar, Nathan Rotenstreich, John A. Passmore, Andr=C3=A9 Mercier, Leonard Russell, and Joseph Moreau. 1961. {``Discussion Sur \cite{hersch_j:1961} Et {marias:1961}.''} \emph{Dialectica} 15 (57--58): 253--57. ``` Yet citeproc does recognize them because in HTML it prints the keys in a=20 special 'citation-data' span: ```
Aaron, Richard Ithamar, Nathan Rotenstreich, John A. Passmore, Andr=C3=A9= =20 Mercier, Leonard Russell, and Joseph Moreau. 1961. =E2=80=9CDiscussio= n Sur=20 Et marias:1961.=E2=80=9D Dialectica<= /em> 15=20 (57=E2=80=9358): 253=E2=80=9357. ``` When trying to produce a PDF we actually get an error, because natbib isn't= =20 loaded (citeproc has processed the references already) so the \citet=20 command is unknown.=20 As I said, a python script with bibparse and citeproc-py seems to me the=20 best option at the moment. There's probably a Haskell option too=20 (BibTex https://wiki.haskell.org/BibTeX and citeproc). Any suggestion=20 welcome.=20 All best, Julien --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/22fc94e0-d1e7-44b9-a683-a387f3c24e58n%40googlegroups.com. ------=_Part_3381_1857295319.1611583213758 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear all, 

I have to work with self-citing .bib fil= es. They contain \citet commands in the title and note fields, e.g.:
<= div>
```
@Article{lewis_dk:1981b,
&n= bsp; author  =3D {Lewis, David},
  journal =3D {Theoria= },
  title   =3D {Are We Free to Break the Laws?},=
  year    =3D {1981},
  note =   =3D {reprinted in \citet[291--298]{lewis_dk:1986a}},
&nbs= p; number  =3D {3},
  pages   =3D {113--121},=
  volume  =3D {47},
  doi    =  =3D {10.1093/0195036468.003.0010},
}
@= article{aaron_ri-etal:1961,
author =3D {Aaron, Richard Ithamar and Rotenstreich, Nathan and Passmore, John A. and Mercier, Andr{\'e= } and Russell, Leonard and Moreau, Joseph },
year =3D { 1961<= span style=3D"white-space:pre"> },
title =3D { Discuss= ion sur \citet{hersch_j:1961} et \citet{marias:1961} },
journ= al =3D { dialectica },
volume =3D { 15 },
nu= mber =3D { 57--58 },
p= ages =3D { 253--257 },
}
```

In LaTeX these would be processed by compiling the document 3 times= . But (a) I intend to work with citeproc + CSL, and (b) I can't manually re= place all the \citet commands in the .bib file (thousands of entries). Righ= t now my best solution would be to write a python script using bibparse and= citeproc-py (https://pypi.org/project/bibparse/ and https://github.com/bre= chtm/citeproc-py) to process those \citet commands. But I'm curious to hear= if you have a better idea - or if John would consider making citeproc recu= rsive. 

In general, Citeproc processes LaTeX = commands in .bib fields, but not \cite commands. They are passed as such in= TeX output:

```
\leavevmode\hypert= arget{ref-aaron_ri-etal:1961}{}%
Aaron, Richard Ithamar, Nathan R= otenstreich, John A. Passmore, Andr=C3=A9
Mercier, Leonard Russel= l, and Joseph Moreau. 1961. {``Discussion Sur
\cite{hersch_j:1961= } Et {marias:1961}.''} \emph{Dialectica} 15 (57--58):
253--57.
```

Yet citeproc does recognize them= because in HTML it prints the keys in a special 'citation-data' span:

```
<div id=3D"ref-aaron_ri-etal:196= 1" class=3D"csl-entry" role=3D"doc-biblioentry">
Aaron, Richar= d Ithamar, Nathan Rotenstreich, John A. Passmore, Andr=C3=A9 Mercier, Leona= rd Russell, and Joseph Moreau. 1961. <span>=E2=80=9CDiscussion Sur &l= t;span class=3D"citation" data-cites=3D"hersch_j:1961"></span> Et = <span class=3D"citation" data-cites=3D"marias:1961"><span class=3D= "nocase">marias:1961</span></span>.=E2=80=9D</span> &l= t;em>Dialectica</em> 15 (57=E2=80=9358): 253=E2=80=9357.
```

When trying to produce a PDF we actuall= y get an error, because natbib isn't loaded (citeproc has processed the ref= erences already) so the \citet command is unknown. 

As I said, a python script with bibparse and citeproc-py seems to me= the best option at the moment. There's probably a Haskell option too (BibT= ex https://wiki.haskell.org/BibTeX and citeproc). Any suggestion welco= me. 

All best,

Julie= n


--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/22fc94e0-d1e7-44b9-a683-a387f3c24e58n%40googlegroups.= com.
------=_Part_3381_1857295319.1611583213758-- ------=_Part_3380_334243611.1611583213758--