emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-ref code


From: Andreas Reuleaux
Subject: Re: [O] org-ref code
Date: Wed, 14 May 2014 00:33:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

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


  \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 "(<textcite>%s</textcite>)" 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 "(<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?

Thanks.

-Andreas




reply via email to

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