From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Citation syntax: a revised proposal Date: Tue, 03 Mar 2015 16:41:30 +0100 Message-ID: <874mq2rsut.fsf@pank.eu> 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> <87bnkbi61v.fsf@gmail.com> <877fuzruin.fsf@gmx.us> <87sidm2kny.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSowz-0005Xi-LD for emacs-orgmode@gnu.org; Tue, 03 Mar 2015 10:41:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSoww-0001Uq-DH for emacs-orgmode@gnu.org; Tue, 03 Mar 2015 10:41:37 -0500 Received: from mout.gmx.net ([212.227.15.15]:63654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSoww-0001UT-34 for emacs-orgmode@gnu.org; Tue, 03 Mar 2015 10:41:34 -0500 Received: from x200s ([37.133.201.102]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0Lw285-1XPT0r0pHJ-017hyS for ; Tue, 03 Mar 2015 16:41:32 +0100 In-Reply-To: <87sidm2kny.fsf@gmail.com> (Aaron Ecay's message of "Tue, 03 Mar 2015 14:57:37 +0000") 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: emacs-orgmode@gnu.org Hi, > I=E2=80=99m not sure I=E2=80=99m happy about the citations/citation propo= sal (under any > assignment of different names to the pieces). A citations containing > only one citation is degenerate: it can never have a :prefix or :suffix > (these will rather be attached to the lone daughter citation). This is one of my concerns. Getting [cite: pre @k post] right. I mentioned it in another post, but Nicolas seemed not to worry about it. > That=E2=80=99s a smell in my book. I my book it's very pleasant since it means that I can use the same function no matter the amount of "keys" within the citation. It's always a list that you map on. You don't even need a cond, though in some cases the length of the list may be nice to have. > It also makes the latex export more complicated: a one-daughter > citations should export as \textcite etc., whereas a multi-daughter one > will be \multicite. From my perspective it would be more > straightforward to only have the citations wrapper be generated if there > are actually multiple citations. But I don=E2=80=99t know how that would= affect > the parser, so you should do what seems best to you. With biblatex, which is the only latex backend that has sophisticated notes functionality, this scheme makes it *super easy*! Here's the latex part of the hack I use for citation "in production": ;; type is e.g. textcite, and citations look like ;; [[cite: common pre; pre0 @key0 post0; pre1 @key1 post1; common post ]] (if (org-export-derived-backend-p backend 'latex) (format "\\%s%s%s%s%s" type (if (> (length citations) 1) "s" "") common-pre common-post (mapconcat (lambda (cite) (let ((pre (org-string-nw-p (plist-get cite :pre))) (post (org-string-nw-p (plist-get cite :post))= )) (concat (cond ((and pre post) (format "[%s][%s]" pre post)) (post (format "[%s]" post)) (pre (format "[%s][]" pre)) (t "")) (format "{%s}" (plist-get cite :key))))) citations "")) =E2=8B=AF It works well irrespective of the number of citations because a citation is a list of keys. > Another tangentially related issue is what does (org-element-context) > return when point is in a multi-citation. It would be nice if it > returned the citation daughter, rather than the wrapping citations > element. This would make implementing goto-citation-at-point very > easy. This is a technical detail that I don't know enough about to have an opinion on. If it would not be as you say it should be easy enough to extract :begin and :end from daughters and figure out which one point it on. >> As little as possible, though a highlevel API is nice, e.g. being able to >> make a citepos using (concat (citeauthor cite) "'s" (citeyear cite)). > > I think I have an idea for this (though based on string templates rather > than list forms). OK. Although I don't want to make you angry, do you know reftex-format-citation? It's what I use for citations outside of latex. >> I haven't tried org-ref, but isn't it just reftex?=20=20 > > I haven=E2=80=99t either, but my impression is that, while perhaps based = on > reftex, there=E2=80=99s a lot of spit and polish that goes into making it= work > nicely. It would be nice to be able to =E2=80=9Csteal=E2=80=9D that beca= use... I think *that* part of reftex is fairly easy to bend. Still, Reftex has some quirkiness. Initially I think it's OK. Here's John's setup: https://github.com/jkitchin/org-ref/blob/master/org-ref.org#org-mode--ref= tex-setup > In the long term I=E2=80=99d be happy if we built something out of more = easily > composable pieces. I agree. >> Another idea would be to use the ox-export dispatcher code, somehow... > > If this was a composable piece I=E2=80=99d be happy (I haven=E2=80=99t lo= oked at it). Isn't it? Maybe I remember wrongly. > There was also an attempt to factor the menu code out of magit (called > makey IIRC). I=E2=80=99ve used it for some small things, but it wasn=E2= =80=99t terribly > pleasant. Magit isn't part of ELPA... There's the new hydra thing in ELPA (haven't tried it), which seems similar to the export dispatcher. > What about XEmacs? That=E2=80=99s another stumbling block. I don't know. I don't even have it installed to be honest... =E2=80=93Rasmus --=20 Summon the Mothership!