emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] State of the art in citations


From: Thomas S. Dye
Subject: Re: [O] State of the art in citations
Date: Sun, 27 Apr 2014 06:01:21 -1000

Clément B. <address@hidden> writes:

> Hi Leonard,
>
>> I am in the process of writing a new package for inserting
>> citations into org buffers using RefTeX.
>
> I'd be interested to know what you have in mind. I use something
> of the sort, by customising `reftex-cite-format`, e.g:
>
> (setq reftex-cite-format
>            '((?\C-m . "\\cite[]{%l}")
>              (?b . "[[ref:%l][%A (%y)]]")))
>
> This makes inserting custom links ("ref") easier with the usual
> `reftex-citation` bound to C-c [.
>
>
>> On the other hand, it will work with multicite commands,
>> whereas Clement's does not look like it will.
>
> It does not, and that's a big limitation. That being said, I don't
> know how to go about mixing multiple citations and links to the
> bib file. This is definitely something I care about, being able
> to quickly jump from the text to the bibliographic entry, PDF
> file, or whatever source I am using to write is one of the main
> reasons I use org instead of plain LaTeX.

One approach for muliticites is to drop a placeholder and then replace
it with an export filter.  I've been using these two for a while and
they seem to work fine.

** Filters for multicites
*** Filter for parencites
Add the placeholder with alt-p

#+name: tsd-parencites
#+BEGIN_SRC emacs-lisp
(defun tsd-latex-filter-parencites (text backend info)
  "Replace parencites placeholders in Beamer/LaTeX export."
  (when (memq backend '(beamer latex))
    (replace-regexp-in-string "π" "\\parencites" text nil t)))
(add-to-list 'org-export-filter-plain-text-functions
             'tsd-latex-filter-parencites)
#+END_SRC

*** Filter for textcites
Add the placeholder with alt-t

#+name: tsd-textcites
#+BEGIN_SRC emacs-lisp
(defun tsd-latex-filter-textcites (text backend info)
  "Replace textcites placeholders in Beamer/LaTeX export."
  (when (memq backend '(beamer latex))
    (replace-regexp-in-string "†" "\\textcites" text nil t)))
(add-to-list 'org-export-filter-plain-text-functions
             'tsd-latex-filter-textcites)
#+END_SRC


It looks like this in the text:

  A recent replication experiment that used stone tools in
  the manufacture of an outrigger canoe identified six functional types
  of stone adze that correspond generally with the six types established
  by Duff
  π[[multicite:turner00:_funct_desig_distr_new_zealan_adzes][;;turner
  diss]] [[multicite:turner05:_funct_and_techn_explan_for][;;turner
  nzja]].

My link syntax is a bit different, but the same basic idea:

(org-add-link-type
 "multicite" 'ebib-open-org-link
 (lambda (path desc format)
   (cond
    ((eq format 'latex)
     (if (not desc) (format "{%s}" path)
         (format "[%s][%s]{%s}"
                 (cadr (split-string desc ";"))
                 (car (split-string desc ";"))  path))))))

hth,
Tom

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]