From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Reuleaux Subject: Re: org-ref code Date: Wed, 14 May 2014 00:33:56 +0100 Message-ID: <87ha4tmexn.fsf@a-rx.info> References: <878uql7r7p.fsf@ucl.ac.uk> <87eh0d62ys.fsf@ucl.ac.uk> <87lhu9ofqa.fsf@ucl.ac.uk> <871tvzm859.fsf@pinto.chemeng.ucl.ac.uk> <87zjimnccb.fsf@a-rx.info> <87tx8uc59f.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkMEt-0003jy-8y for emacs-orgmode@gnu.org; Tue, 13 May 2014 19:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkMEm-0000m9-Fz for emacs-orgmode@gnu.org; Tue, 13 May 2014 19:36:03 -0400 Received: from plane.gmane.org ([80.91.229.3]:51065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkMEm-0000lt-5T for emacs-orgmode@gnu.org; Tue, 13 May 2014 19:35:56 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WkMEi-0005bd-OY for emacs-orgmode@gnu.org; Wed, 14 May 2014 01:35:52 +0200 Received: from stu826b.kent.ac.uk ([129.12.130.107]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 May 2014 01:35:52 +0200 Received: from andreas by stu826b.kent.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 14 May 2014 01:35:52 +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: emacs-orgmode@gnu.org John Kitchin writes: > You can see a document I wrote using org-ref here: > http://kitchingroup.cheme.cmu.edu/org/2014/05/13/Using-org-ref-for-citations-and-references.org > > You will want to pull a current version. I added some code so it is in > principle easy for you to add your own citation types and use the org-ref > machinery to insert citations. > > > I made a little screencast here: http://screencast.com/t/bxfafVydE > Thanks for the sample file and the screencast, very nice. still a bit confused about org-ref-cite-types: Say, I want to add two new link types: textcite - somehow standard in biblatex, cf. the biblatex.pdf manual, p 81 citeauthorfull - my own creation - author with first- and lastname, cf below. from my document.org I load some latex preparation stuff like this #+LaTeX_HEADER: \include{ltxhdr} I was just getting tired of prefixing so many lines with #+LaTeX_HEADER: and collected some of those in a lxthdr.tex file. there I have prepared something for this citeauthorfull thingy: %% cf %% http://tex.stackexchange.com/questions/24979/citing-authors-full-name-in-biblatex %% called citeauthorfirstlast... there \DeclareCiteCommand{\citeauthorfull} {\boolfalse{citetracker}% \boolfalse{pagetracker}% \DeclareNameAlias{labelname}{first-last}% \usebibmacro{prenote}} {\ifciteindex {\indexnames{labelname}} {}% \printnames{labelname}} {\multicitedelim} {\usebibmacro{postnote}} this does the job, don't ask me details. now back to org-ref: with your advice I add: ;; add new format (setf (nth 2 (assoc 'org reftex-cite-format-builtin)) (append (nth 2 (assoc 'org reftex-cite-format-builtin)) '( ;; C-t like text (?\C-t . "textcite:%l") ;; f like full (?f . "citeauthorfull:%l") ))) and I get the comfort of two additional citation formats to chose from when typing C-u C-c ] - nice, indeed. this is basically what you said in your e-mail before, now also on the org-ref.org webpage, (just shortcut and don't define that format variable) Now I can add these: (add-to-list 'org-ref-cite-types "textcite") (add-to-list 'org-ref-cite-types "citeauthorfull") but this is of limited use to me currently, at least I don't get the point, not sure if I am doing something wrong: say, I have added a few of these textcite:foo citeauthorfull:bar in my document.org, there are some problems with these: * first: they don't appear blue and clickable in my document.org * second: they don't get exported in the latex in a reasonable way, they appear there just as textcite:foo citeauthorfull:bar Well I can cure the situation by adding by adding (org-add-link-type "textcite" 'org-ref-cite-onclick-minibuffer-menu ;; formatting (lambda (keyword desc format) (cond ((eq format 'html) (format "(%s)" path)) ((eq format 'latex) (concat "\\textcite{" (mapconcat (lambda (key) key) (org-ref-split-and-strip-string keyword) ",") "}"))))) (org-add-link-type "citeauthorfull" 'org-ref-cite-onclick-minibuffer-menu ;; formatting (lambda (keyword desc format) (cond ((eq format 'html) (format "(%s)" path)) ((eq format 'latex) (concat "\\citeauthorfull{" (mapconcat (lambda (key) key) (org-ref-split-and-strip-string keyword) ",") "}"))))) now they appear clickable in blue, and get properly exported to \textcite{...} and \citeauthorfull{...} Now, what was the deal of this adding them to 'org-ref-cite-types in the first place, if I had to take care of the details by hand anyway? Is there anything I could have left out / shortcut / I have forgotten maybe? Thanks. -Andreas