all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* biblatex citation
@ 2011-08-27  7:10 Thomas S. Dye
  2011-08-27  8:16 ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2011-08-27  7:10 UTC (permalink / raw)
  To: Org-mode

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?

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: biblatex citation
  2011-08-27  7:10 biblatex citation Thomas S. Dye
@ 2011-08-27  8:16 ` Nick Dokos
  2011-08-27  8:52   ` Nick Dokos
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2011-08-27  8:16 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: nicholas.dokos, Org-mode

Thomas S. Dye <tsd@tsdye.com> 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.

Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: biblatex citation
  2011-08-27  8:16 ` Nick Dokos
@ 2011-08-27  8:52   ` Nick Dokos
  2011-08-27  9:38     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2011-08-27  8:52 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: nicholas.dokos, emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> wrote:

> Thomas S. Dye <tsd@tsdye.com> 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.

My preferred solution would be for \parencites to change its syntax :-)
If it were implemented like this e.g.

\parencites{234|kirch85|185|kirch84}

it would be easier to type *and* org would be able to handle it
out of the box: a win-win for everybody except for the parencites
author.

Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: biblatex citation
  2011-08-27  8:52   ` Nick Dokos
@ 2011-08-27  9:38     ` Nicolas Goaziou
  2011-08-27 21:12       ` Thomas S. Dye
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2011-08-27  9:38 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Hello,

Nick Dokos <nicholas.dokos@hp.com> writes:

> Nick Dokos <nicholas.dokos@hp.com> wrote:
>
>> Thomas S. Dye <tsd@tsdye.com> 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,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: biblatex citation
  2011-08-27  9:38     ` Nicolas Goaziou
@ 2011-08-27 21:12       ` Thomas S. Dye
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2011-08-27 21:12 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: nicholas.dokos, emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> Nick Dokos <nicholas.dokos@hp.com> wrote:
>>
>>> Thomas S. Dye <tsd@tsdye.com> 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 [<pre>][<post>]{<key>}
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:<key>][<post>;<pre>]][[multicite:<key>][<post>;<pre>]]

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 "(<cite>%s</cite>)" 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-27 21:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-27  7:10 biblatex citation Thomas S. Dye
2011-08-27  8:16 ` Nick Dokos
2011-08-27  8:52   ` Nick Dokos
2011-08-27  9:38     ` Nicolas Goaziou
2011-08-27 21:12       ` Thomas S. Dye

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.