From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: org-ref code Date: Sun, 11 May 2014 14:48:40 -0400 Message-ID: References: <878uql7r7p.fsf@ucl.ac.uk> <87eh0d62ys.fsf@ucl.ac.uk> <87lhu9ofqa.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d043c7ffe84bb2404f924479a Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjYnk-0002jQ-SC for emacs-orgmode@gnu.org; Sun, 11 May 2014 14:48:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjYni-0005oP-JW for emacs-orgmode@gnu.org; Sun, 11 May 2014 14:48:44 -0400 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:49501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjYni-0005oB-8o for emacs-orgmode@gnu.org; Sun, 11 May 2014 14:48:42 -0400 Received: by mail-wg0-f41.google.com with SMTP id z12so6023387wgg.12 for ; Sun, 11 May 2014 11:48:40 -0700 (PDT) In-Reply-To: <87lhu9ofqa.fsf@ucl.ac.uk> 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: John Kitchin , "emacs-orgmode@gnu.org" --f46d043c7ffe84bb2404f924479a Content-Type: text/plain; charset=UTF-8 On Sat, May 10, 2014 at 10:44 AM, Eric S Fraga wrote: > On Thursday, 1 May 2014 at 13:07, John Kitchin wrote: > > I implemented some of this partially. I made it so you can specify the > > default cite link in a user variable, with a default of cite. When you > type > > C-c ], this format will automatically be used. If you want to choose > > another format, type C-u C-c ] which will prompt you for a type, and then > > Hi John, > > I am having problems with org-ref and am obviously missing something > trivial. I downloaded the latest version yesterday (Friday). You don't > say, in the above, what function you actually bound to C-c ] but I bound > org-ref-insert-cite-link and that doesn't seem to work: > C-c ] should be bound by default to org-ref-insert-cite-link. It is defined in a hook function in line 104 of org-ref.org. I made a custom variable to store the key-binding, but I realized it probably doesn't help, since the binding > > 1. C-u on it does not give me a choice of citation method > If you type C-u M-x org-ref-insert-cite-link do you get a choice? I just tried this on a fresh pull and it does work for me. I am not sure why this wouldn't work for you. Do you tangle the .el file from the .org file? I have this code somewhere else to build it when needed: (if (or (not (file-exists-p "org-ref.el")) (< (float-time (nth 5 (file-attributes "org-ref.el"))) (float-time (nth 5 (file-attributes "org-ref.org"))))) (progn (org-babel-tangle-file (expand-file-name "org-ref.org" starter-kit-dir)) (load-file (expand-file-name "org-ref.el" starter-kit-dir))) (require 'org-ref)) That retangles the org file if the org-file is newer than the el file. > 2. the link inserted "looks" like a link (it's blue) but there are > actually no [[...]] characters surrounding it. > There are no [[...]]. The links work fine without them for me. Are they necessary for some reason? I can add them, but since they do not do anything but disappear in this case, I leave them out. That is actually not totally true, if you write your link as [[cite:key][page 23]] the page 23 gets formatted in latex as \cite[page23]{key}. > > What am I missing? Am I expected to type the [[]] or use C-c C-l? > > I don't think you need the [[]], and you do not have to use C-c C-l. The only thing that C-c C-l offers is autocompletion on bibtex keys for the cite link (I have not figured out a way to avoid a lot of cut and paste code for the other types, and I rarely use this feature, but I am leaving it in so I do not forget how I did it ;). I guess C-c C-l might help entering the description too. > I would like to C-u C-c ], choose autocite and my refs and have your > code insert [[autocite:blah-2001,joe-2010,moe-2014]] into my org > buffer. I know I can change the default citation link type through > org-ref-default-citation-link but I want the C-u functionality. > You should be able to do all those things. The C-u functionality works independently of the default type, and it should let you get something other than the default. > > Finally, looking at the code, it would appear that appending new > citations will only work for "cite:" links as the "cite:" is hard-coded > into the code? > This is correct in the version you have. The current workaround is to use C-u C-c ], and select the "A" format, which will output a leading comma and your selections. I have pushed a fix for this, that adds a requirement of dash.el and checks of the link is in a list of cite types defined in org-ref. Thanks for making me think of a solution to that! > thanks again, > eric > > PS - I'm a fellow Chemical Engineer but unfortunately have not yet had > the opportunity to cite any of your papers but look forward to doing so > sometime soon using org-ref ;-) > That would be great! I hope the comments above help! > -- > : Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.6-923-g233c11 > --f46d043c7ffe84bb2404f924479a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Sat, May 10, 2014 at 10:44 AM, Eric S Fraga <e.fraga@ucl.ac.uk&= gt; wrote:
On Thursd= ay, =C2=A01 May 2014 at 13:07, John Kitchin wrote:
> I implemented some of this partially. I made it so you can specify the=
> default cite link in a user variable, with a default of cite. When you= type
> C-c ], this format will automatically be used. If you want to choose > another format, type C-u C-c ] which will prompt you for a type, and t= hen

Hi John,

I am having problems with org-ref and am obviously missing something
trivial. =C2=A0I downloaded the latest version yesterday (Friday). =C2=A0Yo= u don't
say, in the above, what function you actually bound to C-c ] but I bound org-ref-insert-cite-link and that doesn't seem to work:

C-c ] should be bound by default to org-ref-insert-cit= e-link. It is defined in a hook function in line 104 of org-ref.org.

I made a custom variable to store the key-binding, but I rea= lized it probably doesn't help, since the binding
=C2=A0=

1. C-u on it does not give me a choice of citation method
<= div>
If you type C-u M-x=C2=A0 org-ref-insert-cite-link
do you get a choice?

I just tried= this on a fresh pull and it does work for me. I am not sure why this would= n't work for you.=C2=A0 Do you tangle the .el file from the .org file? = I have this code somewhere else to build it when needed:
(if (or
=C2=A0=C2=A0=C2=A0=C2=A0 (not (file-exists-p "org-ref.el&qu= ot;))
=C2=A0=C2=A0=C2=A0=C2=A0 (< (float-time (nth 5 (file-attributes= "org-ref.el")))
=C2=A0=C2=A0=C2=A0 (float-time (nth 5 (file-a= ttributes "org-ref.org"))))) =C2=A0=C2=A0=C2=A0 (progn
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (org-babel-tang= le-file (expand-file-name "org-ref.org<= /a>" starter-kit-dir))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (load-file (e= xpand-file-name "org-ref.el" starter-kit-dir)))
=C2=A0 (requir= e 'org-ref))

2. the link inserted "looks" like a link (it's blue) but ther= e are
=C2=A0 =C2=A0 =C2=A0actually no [[...]] characters surrounding it.

There are no [[...]]. The links work fine witho= ut them for me. Are they necessary for some reason? I can add them, but sin= ce they do not do anything but disappear in this case, I leave them out.=C2= =A0 That is actually not totally true, if you write your link as [[cite:key= ][page 23]] the page 23 gets formatted in latex as \cite[page23]{key}.
=C2=A0

What am I missing? =C2=A0Am I expected to type the [[]] or use C-c C-l?

I don't think you need the [[]], and you do not h= ave to use C-c C-l. The only thing that C-c C-l offers is autocompletion on= bibtex keys for the cite link (I have not figured out a way to avoid a lot= of cut and paste code for the other types, and I rarely use this feature, = but I am leaving it in so I do not forget how I did it ;). I guess C-c C-l = might help entering the description too.

=C2=A0

Finally, looking at the code, it would appear that appending new
citations will only work for "cite:" links as the "cite:&quo= t; is hard-coded
into the code?

This is correct in the v= ersion you have. The current workaround is to use C-u C-c ], and select the= "A" format, which will output a leading comma and your selection= s. I have pushed a fix for this, that adds a requirement of dash.el and che= cks of the link is in a list of cite types defined in org-ref. Thanks for m= aking me think of a solution to that!


thanks again,
eric

PS - I'm a fellow Chemical Engineer but unfortunately have not yet had<= br> the opportunity to cite any of your papers but look forward to doing so
sometime soon using org-ref ;-)

<= div>That would be great! I hope the comments above help!
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.6-923-g233c11=

--f46d043c7ffe84bb2404f924479a--