From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: org-ref code Date: Tue, 13 May 2014 20:38:32 -0400 Message-ID: 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> <87ha4tmexn.fsf@a-rx.info> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d043c7ffe680d8104f951664c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkNDQ-0007bx-CZ for emacs-orgmode@gnu.org; Tue, 13 May 2014 20:38:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkNDO-0005XF-B0 for emacs-orgmode@gnu.org; Tue, 13 May 2014 20:38:36 -0400 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:34215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkNDN-0005X7-Ro for emacs-orgmode@gnu.org; Tue, 13 May 2014 20:38:34 -0400 Received: by mail-we0-f169.google.com with SMTP id u56so1183451wes.28 for ; Tue, 13 May 2014 17:38:32 -0700 (PDT) In-Reply-To: <87ha4tmexn.fsf@a-rx.info> 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: Andreas Reuleaux Cc: "emacs-orgmode@gnu.org" --f46d043c7ffe680d8104f951664c Content-Type: text/plain; charset=UTF-8 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 ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Tue, May 13, 2014 at 7:33 PM, Andreas Reuleaux wrote: > 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 > > > --f46d043c7ffe680d8104f951664c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
with the most recent org-ref, it should be suffi= cient to put this in your init file:

(org-ref-define-citation-link &= quot;textcite" ?I)
(org-ref-define-citation-link "c= iteauthorfull" ?F)

this will create a textcite link and create a reftex menu you sel= ect with the key I, and the other link with the key F. these should automat= ically be links, and have completion functions. These will get exported as = \textcite{label} and \citeauthorfull{label}. The org-ref-define-citation-li= nk function adds the link, creates the functions necessary, and adds the ty= pes to the right places.

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

John

----------------------------= -------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of = Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213<= br>412-268-7803
http://kitchingroup.cheme.cmu.edu



On Tue, May 13, 2014 at 7:33 PM, Andreas= Reuleaux <andreas@a-rx.info> wrote:
John Kitchin <jkitchin@andrew.cmu.edu> 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.or= g
>
> 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:


=C2=A0 textcite - somehow standard in biblatex,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cf. the biblatex.pdf manual= , p 81

=C2=A0 citeauthorfull - my own creation - author with first- and lastname,<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cf bel= ow.


from my document.org = I load some latex preparation stuff like this

=C2=A0 #+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:


=C2=A0 %% cf
=C2=A0 %% http://tex.stackexchange.com= /questions/24979/citing-authors-full-name-in-biblatex
=C2=A0 %% called citeauthorfirstlast... there


=C2=A0 \DeclareCiteCommand{\citeauthorfull}
=C2=A0 =C2=A0 {\boolfalse{citetracker}%
=C2=A0 =C2=A0 =C2=A0\boolfalse{pagetracker}%
=C2=A0 =C2=A0 =C2=A0\DeclareNameAlias{labelname}{first-last}%
=C2=A0 =C2=A0 =C2=A0\usebibmacro{prenote}}
=C2=A0 =C2=A0 {\ifciteindex
=C2=A0 =C2=A0 =C2=A0 =C2=A0{\indexnames{labelname}}
=C2=A0 =C2=A0 =C2=A0 =C2=A0{}%
=C2=A0 =C2=A0 =C2=A0\printnames{labelname}}
=C2=A0 =C2=A0 {\multicitedelim}
=C2=A0 =C2=A0 {\usebibmacro{postnote}}

this does the job, don't ask me details.

now back to org-ref:

with your advice I add:

=C2=A0 ;; add new format
=C2=A0 (setf (nth 2 (assoc 'org reftex-cite-format-builtin))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (append (nth 2 (assoc 'org reftex-cit= e-format-builtin))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '(

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; C-t like = text
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?\C-t =C2= =A0. "textcite:%l")


=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; f like fu= ll
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?f =C2=A0. = "citeauthorfull:%l")

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )))

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:

=C2=A0 (add-to-list 'org-ref-cite-types "textcite")
=C2=A0 (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

=C2=A0 textcite:foo

=C2=A0 citeauthorfull:bar

in my document.org, t= here 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,
=C2=A0 they appear there just as

=C2=A0 =C2=A0 textcite:foo
=C2=A0 =C2=A0 citeauthorfull:bar

Well I can cure the situation by adding by adding


(org-add-link-type
=C2=A0"textcite"
=C2=A0'org-ref-cite-onclick-minibuffer-menu
=C2=A0;; formatting
=C2=A0(lambda (keyword desc format)
=C2=A0 =C2=A0(cond
=C2=A0 =C2=A0 ((eq format 'html) (format "(<textcite>%= s</textcite>)" path))
=C2=A0 =C2=A0 ((eq format 'latex)
=C2=A0 =C2=A0 =C2=A0(concat "\\textcite{"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapconcat = (lambda (key) key) (org-ref-split-and-strip-string keyword) ",")<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"}")))))



(org-add-link-type
=C2=A0"citeauthorfull"
=C2=A0'org-ref-cite-onclick-minibuffer-menu
=C2=A0;; formatting
=C2=A0(lambda (keyword desc format)
=C2=A0 =C2=A0(cond
=C2=A0 =C2=A0 ((eq format 'html) (format "(<citeauthorful= l>%s</citeauthorfull>)" path))
=C2=A0 =C2=A0 ((eq format 'latex)
=C2=A0 =C2=A0 =C2=A0(concat "\\citeauthorfull{"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(mapconcat = (lambda (key) key) (org-ref-split-and-strip-string keyword) ",")<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"}")))))


now they appear clickable in blue, and get properly exported
to \textcite{...} and \citeauthorfull{...}

Now, what was the deal of this adding them =C2=A0to '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



--f46d043c7ffe680d8104f951664c--