From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: org-ref: citation types (insert full citation); bib style; bib scope Date: Fri, 6 Jan 2017 22:13:57 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11402b24772b8c05457886a0 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPhSD-0004Y5-Cy for emacs-orgmode@gnu.org; Fri, 06 Jan 2017 22:14:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPhSA-0005OM-Uq for emacs-orgmode@gnu.org; Fri, 06 Jan 2017 22:14:01 -0500 Received: from mail-io0-x236.google.com ([2607:f8b0:4001:c06::236]:34652) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cPhSA-0005OC-Mc for emacs-orgmode@gnu.org; Fri, 06 Jan 2017 22:13:58 -0500 Received: by mail-io0-x236.google.com with SMTP id f103so48235510ioi.1 for ; Fri, 06 Jan 2017 19:13:58 -0800 (PST) In-Reply-To: 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" To: John Kitchin Cc: Org Mode --001a11402b24772b8c05457886a0 Content-Type: text/plain; charset=UTF-8 Wow, this is pretty awesome, thank you. A couple of notes inline On Fri, Jan 6, 2017 at 3:42 PM, John Kitchin wrote: > > New org-ref update ;) > > I overhauled the formatted citation support in org-ref today. > > Now, you can do the following things: > > 1. from the C-c ] interface (helm-bibtex, helm-cite or ivy-cite) you can > mark some entries and choose an action that inserts formatted strings. > The default backend for this is text, but you can change that to > org, and add new backends to the variable > org-ref-formatted-citation-formats. The backend is defined in the variable > org-ref-formatted-citation-backend. > > It is better than it was (we used to use org-ref-reftex-format-citation > which had limited fields and character codes). Now the templates use > s-format and the bibtex-completion code, so you can access any bibtex > field that is there. This is not a real substitute for a citation > processor, e.g. if your template has ${volume}(${issue}), and those > fields do not exist, they will just be empty, e.g. 5(). I don't have > plans to address this limitation at this point. > As you say, it's imperfect, but still pretty good, thank you! > > 2. If you click on a citation link, you can select an action to copy the > formatted entry for that key. I had trouble with this. I constructed a minimal emacs config: #+BEGIN_SRC emacs-lisp ;;; elpa interface (setq package-archives ()) (add-to-list 'package-archives '("marmalade" . " http://marmalade-repo.org/packages/")) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) (add-to-list 'package-archives '("melpa" . " http://melpa.milkbox.net/packages/") t) ;; basic initialization, (require) non-ELPA packages, etc. (package-initialize) (require 'cl) (require 'org) (require 'helm-config) (require 'helm) (require 'helm-bibtex) ;; see org-ref for use of these variables (setq org-ref-bibliography-notes "~/Bibliography/notes.org" org-ref-default-bibliography '("~/Bibliography/Bibliography.bib") org-ref-pdf-directory "~/Bibliography/files/") (setq bibtex-completion-bibliography "~/Bibliography/Bibliography.bib" bibtex-completion-library-path "~/Bibliography/files" ) ;; org-define-error ;; for whatever reason, org wasn't finding this (defun org-define-error (name message) "Define NAME as a new error signal. MESSAGE is a string that will be output to the echo area if such an error is signaled without being caught by a `condition-case'. Implements `define-error' for older emacsen." (if (fboundp 'define-error) (define-error name message) (put name 'error-conditions (copy-sequence (cons name (get 'error 'error-conditions)))))) (setq org-ref-formatted-citation-backend "org") (setq org-ref-completion-library 'org-ref-helm-bibtex) (require 'org-ref) #+END_SRC The action proceeds without errors, but nothing seems to be copied ot the clipboard. > > 3. On a bibtex entry, you can use the org-ref-bibtex-hydra/body to copy > a formatted string of the entry. > this works great. Obviously I need to learn how to use hydra... > > > >> > Does anyone know what the other options are? In particular, for the > >> syllabi > >> > I'm currently creating I'd like to just insert the org-formatted citation > >> > information itself -- is this possible? > >> > >> Can you give an example? > >> > >> > > I htink I'm looking for something impossible. org-zotxt allowed me to use > > a link type "citation", which just inserted the full citation in org syntax: > > > > Hayles, K. (1999). /How we became posthuman: virtual bodies in cybernetics, > > literature, and informatics/. Chicago, Ill.: University of Chicago Press. [[ > > http://search.library.utoronto.ca/details?7949488&uuid=5aaa42cf-ffd2-41e3-ac6b-60e649f9f289 > > ]] > > You would want to have these settings with a new org-ref: > (setq org-ref-formatted-citation-backend "org") > > (setf (cdr (assoc "book" (cdr (assoc "org" > org-ref-formatted-citation-formats)))) > "${author} ${year}. /${title}/, ${address}:${publisher}. [[${url}]]") > > Then you can insert the citation and get this (there is no address for > the publisher in my entry). With helm bibtex as the backend, you would > type C-c ], select an entry, and press f8 (or tab and select the insert > formatted action). In the ivy backend, you type M-o f. Both of them > support multiple selections. Yeah, this is awesome, thank you. it's F7 though, not F8. > > > There is not a way to control the casing of the title here, it is > sentence cased by the bibtex-completion library. I also don't have plans > to address that. > > > > > rather than generating a link. If I had an option to do this in my > > syllabi, it would greatly simplify my work flow. > > > > > >> > I'd like to be able to point my > >> > students directly to my github repo, and it will ultimately be more > >> > convenient to have the links already present in the source code, since > >> > github doesn't reoslve org-ref > >> > >> What I mean is, that I'd like to stop building course websites and instead > >> just point students to github repos where my docs live in an org format. > >> This means I reallywant the citatiion information, and not citation links. > >> E.g.: > >> > > > > https://github.com/titaniumbones/New113/blob/master/New113Syllabus.org#2017-01-26-thu-state-surveillance > > Does this mean you have an entry with the url in it? Say you have it as > a misc entry. > > @misc{ase, > Title = {Atomic Simulation Environment}, > Howpublished = {https://wiki.fysik.dtu.dk/ase/}, > note = {The Atomic Simulation Environment is a set of Python libraries > for running molecular simulations and analyzing the results.} > } > > That entry type isn't defined in the formats (there should be a default > entry, but it isn't formatted the way you want), but you could add it like this: > > > (push '("misc" . "${author} ${year}. /${title}/, [[${howpublished}]]")(cdr (assoc "org" > org-ref-formatted-citation-formats))) > got it now. This is great, thanks. Moving forward now that you've solved my last problem... for properly formatted citations, is latex the only fully supported publication type? What about, say, pandoc md or odt? Thank you thank you thank you! --001a11402b24772b8c05457886a0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Wow, this is pretty awesome, thank you.

A coup= le of notes inline

On Fri, Jan 6, 2017 at 3:42 PM, John Kitchin <= jkitchin@andrew.cmu.edu> = wrote:
>
> New org-ref update ;)
>
> I overhauled t= he formatted citation support in org-ref today.
>
> Now, you ca= n do the following things:
>
> 1. from the C-c ] interface (hel= m-bibtex, helm-cite or ivy-cite) you can
> mark some entries and choo= se an action that inserts formatted strings.
> The default backend fo= r this is text, but you can change that to
> org, and add new backend= s to the variable
> org-ref-formatted-citation-formats. The backend i= s defined in the variable
> org-ref-formatted-citation-backend.
&g= t;
> It is better than it was (we used to use org-ref-reftex-format-c= itation
> which had limited fields and character codes). Now the temp= lates use
> s-format and the bibtex-completion code, so you can acces= s any bibtex
> field that is there. This is not a real substitute for= a citation
> processor, e.g. if your template has ${volume}(${issue}= ), and those
> fields do not exist, they will just be empty, e.g. 5()= . I don't have
> plans to address this limitation at this point.<= br>>
As you say, it's imperfect, but still pretty good, thank you= !
=C2=A0
>
> 2. If you click on a citation link, you can sel= ect an action to copy the
> formatted entry for that key.


= I had trouble with this. I constructed a minimal emacs config:

#+BEG= IN_SRC emacs-lisp
;;; elpa interface
(setq package-archives ())
(a= dd-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/package= s/"))
(add-to-list 'package-archives '("gnu" = . "http://elpa.gnu.org/packa= ges/"))
(add-to-list 'package-archives '("org"= ; . "http://orgmode.org/elpa/= ") t)
(add-to-list 'package-archives '("melpa" . = "http://melpa.milkbox.n= et/packages/") t)
;; basic initialization, (require) non-ELPA p= ackages, etc.
(package-initialize)

(require 'cl)
(require 'org)
(require 'helm-config)
(require 'helm)(require 'helm-bibtex)

;; see org-ref for use of these variabl= es
(setq org-ref-bibliography-notes "~/Bibliography/notes.org"
=C2=A0 =C2=A0 =C2=A0 org-ref-default-b= ibliography '("~/Bibliography/Bibliography.bib")
=C2=A0 = =C2=A0 =C2=A0 org-ref-pdf-directory "~/Bibliography/files/")
<= br>(setq bibtex-completion-bibliography "~/Bibliography/Bibliography.b= ib"
=C2=A0 =C2=A0 =C2=A0 bibtex-completion-library-path "~/Bib= liography/files"
=C2=A0 =C2=A0 =C2=A0 )

;; org-define-error<= br>
;; for whatever reason, org wasn't finding this
=
(defun org-define-error (name message)
=C2=A0 "Define NAME as = a new error signal.
MESSAGE is a string that will be output to the echo = area if such
an error is signaled without being caught by a `condition-c= ase'.
Implements `define-error' for older emacsen."
=C2= =A0 (if (fboundp 'define-error) (define-error name message)
=C2=A0 = =C2=A0 (put name 'error-conditions
=C2=A0 =C2=A0 =C2=A0(copy-sequenc= e (cons name (get 'error 'error-conditions))))))

(setq org-r= ef-formatted-citation-backend "org")
(setq org-ref-completion-= library 'org-ref-helm-bibtex)

(require 'org-ref)

#+EN= D_SRC

The action proceeds without errors, but nothing see= ms to be copied ot the clipboard.

>
> 3. On a bi= btex entry, you can use the org-ref-bibtex-hydra/body to copy
> a for= matted string of the entry.
>
this works great.=C2=A0 Obviously I = need to learn how to use hydra...
>
>
> >> > Doe= s anyone know what the other options are? In particular, for the
> &g= t;> syllabi
> >> > I'm currently creating I'd lik= e to just insert the org-formatted citation
> >> > informati= on itself -- is this possible?
> >>
> >> Can you gi= ve an example?
> >>
> >>
> > I htink I'= ;m looking for something impossible. =C2=A0org-zotxt allowed me to use
&= gt; > a link type "citation", which just inserted the full cit= ation in org syntax:
> >
> > Hayles, K. (1999). /How we b= ecame posthuman: virtual bodies in cybernetics,
> > literature, an= d informatics/. Chicago, Ill.: University of Chicago Press. [[
> >= http://search.library.utoronto.ca/detai= ls?7949488&uuid=3D5aaa42cf-ffd2-41e3-ac6b-60e649f9f289
> >= ]]
>
> You would want to have these settings with a new org-re= f:
> (setq org-ref-formatted-citation-backend "org")
>= ;
> (setf (cdr (assoc "book" (cdr (assoc "org"> org-ref-formatted-citation-formats))))
> =C2=A0"${author} = ${year}. /${title}/, ${address}:${publisher}. [[${url}]]")
>
= > Then you can insert the citation and get this (there is no address for=
> the publisher in my entry). With helm bibtex as the backend, you w= ould
> type C-c ], select an entry, and press f8 (or tab and select t= he insert
> formatted action). In the ivy backend, you type M-o f. Bo= th of them
> support multiple selections.

Yeah, thi= s is awesome, thank you.=C2=A0 it's F7 though, not F8.=C2=A0
=
>
>
> There is not a way to control the casing of the t= itle here, it is
> sentence cased by the bibtex-completion library. I= also don't have plans
> to address that.
>
> >> > rather than generating a link.=C2=A0 If I had an option to do th= is in my
> > syllabi, it would greatly simplify my work flow.
&= gt; >
> >
> >> > I'd like to be able to poin= t my
> >> > students directly to my github repo, and it will= ultimately be more
> >> > convenient to have the links alre= ady present in the source code, since
> >> > github doesn= 9;t reoslve org-ref
> >>
> >> What I mean is, that = I'd like to stop building course websites and instead
> >> = just point students to github repos where my docs live in an org format.> >> This means I reallywant the citatiion information, and not c= itation links.
> >> E.g.:
> >>
> >
>= > https://github.com/titanium= bones/New113/blob/master/New113Syllabus.org#2017-01-26-thu-state-surveillan= ce
>
> Does this mean you have an entry with the url in it?= Say you have it as
> a misc entry.
>
> @misc{ase,
>= ; =C2=A0 Title =3D =C2=A0 =C2=A0 =C2=A0 =C2=A0{Atomic Simulation Environmen= t},
> =C2=A0 Howpublished =3D {https://wiki.fysik.dtu.dk/ase/},
> =C2=A0 note =3D =C2=A0 = =C2=A0 =C2=A0 =C2=A0 {The Atomic Simulation Environment is a set of Python = libraries
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 for running molecular simulations and analyzing the results.}
>= ; }
>
> That entry type isn't defined in the formats (there= should be a default
> entry, but it isn't formatted the way you = want), but you could add it like this:
>
>
> (push '(= "misc" . "${author} ${year}. /${title}/, [[${howpublished}]]= ")(cdr (assoc "org"
> org-ref-formatted-citation-forma= ts)))
>

got it now.=C2=A0 This is great, thanks.=C2= =A0 Moving forward now that you've solved my last problem... for proper= ly formatted citations, is latex the only fully supported publication type?= What about, say, pandoc md or odt?

Thank you thank you t= hank you!

--001a11402b24772b8c05457886a0--