From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Citation syntax: a revised proposal Date: Mon, 02 Mar 2015 18:54:20 +0000 Message-ID: <87bnkbi61v.fsf@gmail.com> References: <87k2zjnc0e.fsf@berkeley.edu> <87bnkvm8la.fsf@berkeley.edu> <87zj8co3se.fsf@berkeley.edu> <87ioezooi2.fsf@berkeley.edu> <87mw4bpaiu.fsf@nicolasgoaziou.fr> <8761aznpiq.fsf@berkeley.edu> <87twyjnh0r.fsf@nicolasgoaziou.fr> <87oaopx24e.fsf@berkeley.edu> <87k2zd4f3w.fsf@nicolasgoaziou.fr> <87egpkv8g9.fsf@berkeley.edu> <877fv6xfaq.fsf@gmail.com> <87twya2ak0.fsf@berkeley.edu> <87zj81aa97.fsf@nicolasgoaziou.fr> <87ioep2r6p.fsf@berkeley.edu> <87y4ngbgm7.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSVUD-00062w-5Z for emacs-orgmode@gnu.org; Mon, 02 Mar 2015 13:54:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSVUA-0007la-Eq for emacs-orgmode@gnu.org; Mon, 02 Mar 2015 13:54:37 -0500 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:44778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSVUA-0007lV-2p for emacs-orgmode@gnu.org; Mon, 02 Mar 2015 13:54:34 -0500 Received: by wggx12 with SMTP id x12so35346940wgg.11 for ; Mon, 02 Mar 2015 10:54:33 -0800 (PST) In-Reply-To: <87y4ngbgm7.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou , Richard Lawrence Cc: emacs-orgmode@gnu.org, John Kitchin --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Nicolas, Thanks for implementing the parser support. I decided to go ahead and see what I could make of it. The result has been pushed to the org mode repo to the branch wip-cite-awe. (I didn=E2=80=99t want to push to your br= anch without asking, but if you prefer I=E2=80=99ll do that and delete my own.) First I=E2=80=99ll describe two minor issues with the parser support I uncovered. Then I=E2=80=99ll go on to describe what the code I=E2=80=99ve = written does. The first issue is that the parser includes trailing punctuation in =E2=80=9Cbare=E2=80=9D @key citations. So the following does not work as e= xpected (the :key includes the period): =E2=80=9CThis was demonstrated most recently by @Smith2015.=E2=80=9D I=E2=80=99m not sure what the right approach is =E2= =80=93 one option would be to say that keys can contain punctuation, but must end (and begin) with an alphanumeric character. The second issue is that the :key property of the citation element includes the @. This is not right IMO: it=E2=80=99s a detail of the syntax. And it means that consumers of the syntax, who might want to look up the key in a database, will always have to remember to strip the @. I=E2=80=99ve pushed a provisional fix for this in my branch. =3D=3D=3D=3D=3D The code I have pushed introduces three document-level keywords: BIBDB, CITATION_MODE, and CITATION_STYLE. Each of these has a corresponding extension point in the code: org-export-cite-add-lookup-type, org-export-cite-add-citation-mode, and org-export-cite-add-citation-style. Lookup types are concerned with mapping from a key to bibliographic information. Currently an org-bibtex lookup is implemented. Others that could be added straightforwardly are bibtex and the internet DOI resolver as described here: https://tex.stackexchange.com/questions/6848/automatically-dereference-doi-= to-bib Citation modes are responsible for formatting the in-text citation (usually, a reference to a full citation stored elsewhere). Currently a crude author-year style is implemented. Footnote and numbered citations could both be added with relatively little effort (I think), though they=E2=80=99d be a bit more complicated because they require keeping track= of a counter. Citation styles are responsible for formatting the citation in the bibliography (or footnote, or wherever the =E2=80=9Cfull=E2=80=9D citation = lands). Currently a hyper-simple one is implemented that just outputs the author, year, and title. I=E2=80=99ve attached a zip file to this email which contains a very simple= org document, a very simple bibliography, and the results of exporting it to HTML (body only), plain text, and Latex. (These are the only three supported backends so far). The code is very rough and ready, has lots of TODO comments in it, is missing tests, documentation in the manual, etc. Nonetheless, I want to get feedback on it early, given that many people have already contributed so much useful information to this discussion. The two main questions that arise for me at this point are: -> How much is it worth trying to keep latex and the other backends together. The current implementation uses some common functions (in ox-cite.el) for all backends, including latex. However, latex basically does its own thing. So it would be possible to include in ox-cite only code for non-latex backends, and then implement latex citations solely in ox-latex. Separation would make the initial implementation very simple. On the other hand, I worry that it would perpetuate the present situation where latex and non-latex citations are two separate universes. On the third hand, serious latex users will probably just say you should use latex of you want nice citations, since latex is so much better. ;) -> How much of the non-latex citation code is it worth implementing in elisp. One quick strategy would be to depend on citeproc-java . This can generate bibliographies in HTML format from a bibtex file, which can be parsed, turned into org syntax, and used wherever they are needed. However, it introduces a hard dependency on this program. Is it worth trying to put together a bare-bones elisp implementation, so people can have dependency-free bibliographies? My inclination is to say =E2=80=9Cno,=E2= =80=9D to avoid duplicating the considerable effort put into the CSL universe (over 7,000 citation styles available!). However, it also seems a bit wrong to have a core feature depend on a third party executable. (How much it would slow down export to continually shell out to an external program is also an open question.) =3D=3D=3D=3D=3D I didn=E2=80=99t try to do anything about support for editing/inserting cit= ations within org mode. It would be good to know whether John Kitchin is willing to contribute bits of his org-ref code for that. (I see on Worg that he has an FSF assignment on file, but I don=E2=80=99t want to take without ask= ing =E2=80=93 or do porting/integration work that he=E2=80=99s happy to do himself!) Thanks, Aaron PS the code uses relatively new functions from the subr-x and let-alist libraries, so it probably works best on a recent-ish (past few months) trunk version of emacs. --=-=-= Content-Type: application/zip Content-Disposition: attachment; filename=org-citations.zip Content-Transfer-Encoding: base64 UEsDBAoAAAAAAPWVYkYAAAAAAAAAAAAAAAAOABwAb3JnLWNpdGF0aW9ucy9VVAkAA06w9FThkvRU dXgLAAEE6AMAAAToAwAAUEsDBBQAAAAIAPiLYkb8UZ2ndAAAANkA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