[Top][All Lists]

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

Re: [O] org-ref code

From: John Kitchin
Subject: Re: [O] org-ref code
Date: Tue, 13 May 2014 20:38:32 -0400

with the most recent org-ref, it should be sufficient to put this in your init file:

(org-ref-define-citation-link "textcite" ?I)
(org-ref-define-citation-link "citeauthorfull" ?F)

this will create a textcite link and create a reftex menu you select with the key I, and the other link with the key F. these should automatically be links, and have completion functions. These will get exported as \textcite{label} and \citeauthorfull{label}. The org-ref-define-citation-link function adds the link, creates the functions necessary, and adds the types to the right places.

You do not need to do the manual additions unless you manually define the link like you did with org-add-link-type.


John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213

On Tue, May 13, 2014 at 7:33 PM, Andreas Reuleaux <address@hidden> wrote:
John Kitchin <address@hidden> 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


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



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


Well I can cure the situation by adding by adding

 ;; formatting
 (lambda (keyword desc format)
    ((eq format 'html) (format "(<textcite>%s</textcite>)" path))
    ((eq format 'latex)
     (concat "\\textcite{"
             (mapconcat (lambda (key) key) (org-ref-split-and-strip-string keyword) ",")

 ;; formatting
 (lambda (keyword desc format)
    ((eq format 'html) (format "(<citeauthorfull>%s</citeauthorfull>)" 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?



reply via email to

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