emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: "Clément B." <clement@inventati.org>
Cc: julian@hafro.is, Leonard Randall <leonard.a.randall@gmail.com>,
	emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: State of the art in citations
Date: Sun, 27 Apr 2014 06:01:21 -1000	[thread overview]
Message-ID: <m238gykbhq.fsf@tsdye.com> (raw)
In-Reply-To: <87k3aaoo5d.fsf@gaillac.origami> ("Clément B."'s message of "Sun, 27 Apr 2014 16:14:22 +0200")

Clément B. <clement@inventati.org> 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

  parent reply	other threads:[~2014-04-27 16:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-26 16:56 State of the art in citations Clément B.
2014-04-27 13:08 ` Leonard Randall
2014-04-27 14:14   ` Clément B.
2014-04-27 14:41     ` Ken Mankoff
2014-04-27 16:01     ` Thomas S. Dye [this message]
2014-04-27 16:16       ` Ken Mankoff
2014-04-27 16:57         ` Clément B.
2014-04-27 19:20           ` John Kitchin
2014-04-27 21:30             ` Clément B.
2014-04-28 13:57             ` Julian M. Burgos
2014-04-28 13:56   ` Julian M. Burgos
2014-04-29  9:30 ` Vikas Rawal Lists
2014-04-29 15:36   ` Richard Lawrence
2014-04-29  9:30 ` Vikas Rawal Lists
  -- strict thread matches above, loose matches on Subject: below --
2014-04-27 14:53 Clément B.
2014-04-27 15:26 ` Ken Mankoff
2014-04-27 16:05   ` Clément B.
2014-04-27 16:10     ` Ken Mankoff
2014-04-26 18:26 Clément B.
2014-04-28  1:53 ` Richard Lawrence
2014-04-25 12:11 Julian M. Burgos
2014-04-25 15:42 ` Grant Rettke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m238gykbhq.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=clement@inventati.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=julian@hafro.is \
    --cc=leonard.a.randall@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).