From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: biblatex citation Date: Sat, 27 Aug 2011 11:12:48 -1000 Message-ID: References: <9866.1314433001@alphaville.dokosmarshall.org> <10180.1314435135@alphaville.dokosmarshall.org> <87ei07mbx9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:32859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxQBT-0007rD-7p for emacs-orgmode@gnu.org; Sat, 27 Aug 2011 17:12:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxQBR-0004Ys-KM for emacs-orgmode@gnu.org; Sat, 27 Aug 2011 17:12:55 -0400 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:47401) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QxQBR-0004Yl-Cw for emacs-orgmode@gnu.org; Sat, 27 Aug 2011 17:12:53 -0400 In-Reply-To: <87ei07mbx9.fsf@gmail.com> (Nicolas Goaziou's message of "Sat, 27 Aug 2011 11:38:42 +0200") 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 Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Nicolas Goaziou writes: > Hello, > > Nick Dokos writes: > >> Nick Dokos wrote: >> >>> Thomas S. Dye wrote: >>> >>> > Aloha all, >>> > >>> > This biblatex construct: >>> > \parencites[234]{kirch85}[185]{kirch84} >>> > >>> > is output like this: >>> > \parencites[234]{kirch85}[185]\{kirch84\} >>> > >>> > The biblatex syntax is unusual (to me) in LaTeX. I wonder if it is >>> > possible to support it in Org-mode? >>> > >>> >>> So is the syntax \parencites followed by an arbitrary number of pairs >>> [page#]{ref}? >>> >>> latex export knows to do the right thing for a command with optional and >>> mandatory arguments: \command[opt]{mand} is properly protected, but the >>> above case stretches it to beyond its breaking point. >>> >>> After a quick look, all I could come up with as a possibility was yet >>> another special case in org-export-latex-preprocess - and one more scan >>> of the whole file to add to the many (roughly 20!) that this function >>> does. >>> >> >> Well, maybe another scan is not necessary: the existing command handler >> could perhaps be extended to deal with this case. But the regexp in >> that case is horrendous enough as it is - if it gets any hairier, it >> will become Medusa: mortals looking at it will drop dead. >> However it might be that a loop that eats multiple pairs of [...]{...} >> occurrences would be simple enough to implement. > > Note that Org core already recognizes such latex commands, as confirmed > by using `org-inside-latex-macro-p' anywhere inside it. > > In this case, it's just an exporter failure. > > Regards, Aloha Nick and Nicolas, Thanks for analyzing this problem. Yes, the syntax of \parencites (and various other "multicite" commands in biblatex) allows an arbitrary number of [
][]{}
triplets.  I haven't seen this before in LaTeX.  The biblatex author,
Philipp Lehman, came up with this to solve a long-standing problem in
BibTeX citations where it was possible to cite multiple works in one
citation, but impossible then to indicate page numbers, etc., for
individual works.

The solutions you've pointed out, a pre-process hook or correcting an
exporter failure, both seem beyond me to implement and/or maintain.  In
the meantime, I came up with a workaround that seems to work.  It looks
like this in the Org-mode buffer:

\parencites[[multicite:][;
]][[multicite:][;
]]

It is based on this custom link, which integrates with ebib:

#+source: define-biblatex-multicite-link
#+begin_src emacs-lisp :results silent :exports none
  (org-add-link-type 
   "multicite" 'ebib
   (lambda (path desc format)
     (cond
      ((eq format 'html)
       (format "(%s)" path))
      ((eq format 'latex)
       (if (or (not desc) (equal 0 (search "multicite:" desc)))
           (format "{%s}" path)
         (format "[%s][%s]{%s}"
                 (cadr (split-string desc ";"))
                 (car (split-string desc ";"))  path))))))
  
#+end_src

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com