emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-ref: citation types (insert full citation); bib style; bib scope
@ 2017-01-06 14:27 Matt Price
  2017-01-06 15:26 ` John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2017-01-06 14:27 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1784 bytes --]

After several years, I'm finally trying to move to bibtex from zotero,
partly because org-zotxt has stopped working for me (both link insertion
and html export seem at least temporarily broken).

The UI for org-ref is pretty fantastic, and I love it. I'm having trouble
getting the behaviour I want fro mthe actual links, though.  My needs may
be somewhat atypical but I'm hoping someone else has figured these
questions out already.

* citation types
The org-ref manual talks about different citation types, but the external
link it suggests is not loading:
http://ctan.unixbrain.com/macros/latex/contrib/natbib/natnotes.pdf

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? 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

* bib style
When I right-click on a link and select "copy the formatted citation", I
don't get the URL field, which my students need. I assume that's because
I'm not using the right bibliographic style. How do I set the citation
format?  Would I use the bibliographystyle link, or a header argument
somewhere?

Also, is it possible to set this option to use org formatting instead of
html formatting?

* Bibliography scope
I guess I don't really know how to build a bibliographic file to go with a
particular project.  At present I am using my full Zotero library exported
to bibtex as a default. Is there a way to just build the bibliography from
the set of sources cited in the paper?

Thanks everyone, and of course especially John for this amazing tool.

Matt

[-- Attachment #2: Type: text/html, Size: 2124 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: org-ref: citation types (insert full citation); bib style; bib scope
  2017-01-06 14:27 org-ref: citation types (insert full citation); bib style; bib scope Matt Price
@ 2017-01-06 15:26 ` John Kitchin
  2017-01-06 16:05   ` Matt Price
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2017-01-06 15:26 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode


Matt Price writes:

> After several years, I'm finally trying to move to bibtex from zotero,
> partly because org-zotxt has stopped working for me (both link insertion
> and html export seem at least temporarily broken).
>
> The UI for org-ref is pretty fantastic, and I love it. I'm having trouble
> getting the behaviour I want fro mthe actual links, though.  My needs may
> be somewhat atypical but I'm hoping someone else has figured these
> questions out already.
>
> * citation types
> The org-ref manual talks about different citation types, but the external
> link it suggests is not loading:
> http://ctan.unixbrain.com/macros/latex/contrib/natbib/natnotes.pdf

try: http://tug.ctan.org/macros/latex/contrib/natbib/natnotes.pdf

>
> 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'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

I do not follow what you want here. Another example would be helpful.

>
> * bib style
> When I right-click on a link and select "copy the formatted citation", I
> don't get the URL field, which my students need. I assume that's because
> I'm not using the right bibliographic style. How do I set the citation
> format?  Would I use the bibliographystyle link, or a header argument
> somewhere?

Support for this is kind of rudimentary, because it is really difficult
to get properly formatted strings for all references. 

When you click on a cite link and select copy formatted entry what
happens is the bibfile is opened to that entry and then the result of
org-ref-bib-citation is copied. It is pretty simple, and limited. At the
moment, I think helm-bibtex does the actual formatting if you load it,
and it does not appear to be customizable. See bibtex-completion-apa-format-reference

I will work on this a little bit and see if some improvements can be
made.

>
> Also, is it possible to set this option to use org formatting instead of
> html formatting?

You could use a function like this on a link to get something more
customizable.

(defun better-formatted-citation ()
  (interactive)
  (kill-new (org-ref-get-bibtex-entry-citation (car (org-ref-get-bibtex-key-and-file)))))

see the variable org-ref-bibliography-entry-format, you can set this to
be whatever format you want.

>
> * Bibliography scope
> I guess I don't really know how to build a bibliographic file to go with a
> particular project.  At present I am using my full Zotero library exported
> to bibtex as a default. Is there a way to just build the bibliography from
> the set of sources cited in the paper?

M-x org-ref-extract-bibtex-entries should put a new heading in the buffer
with the relevant bibtex entries.

>
> Thanks everyone, and of course especially John for this amazing tool.
>
> Matt


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: org-ref: citation types (insert full citation); bib style; bib scope
  2017-01-06 15:26 ` John Kitchin
@ 2017-01-06 16:05   ` Matt Price
  2017-01-06 16:10     ` John Kitchin
  2017-01-06 20:42     ` John Kitchin
  0 siblings, 2 replies; 8+ messages in thread
From: Matt Price @ 2017-01-06 16:05 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 4419 bytes --]

On Fri, Jan 6, 2017 at 10:26 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

>
> Matt Price writes:
>
> > After several years, I'm finally trying to move to bibtex from zotero,
> > partly because org-zotxt has stopped working for me (both link insertion
> > and html export seem at least temporarily broken).
> >
> > The UI for org-ref is pretty fantastic, and I love it. I'm having trouble
> > getting the behaviour I want fro mthe actual links, though.  My needs may
> > be somewhat atypical but I'm hoping someone else has figured these
> > questions out already.
> >
> > * citation types
> > The org-ref manual talks about different citation types, but the external
> > link it suggests is not loading:
> > http://ctan.unixbrain.com/macros/latex/contrib/natbib/natnotes.pdf
>
> try: http://tug.ctan.org/macros/latex/contrib/natbib/natnotes.pdf


ok, thx.

>
>
> >
> > 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
]]

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



> >
> > * bib style
> > When I right-click on a link and select "copy the formatted citation", I
> > don't get the URL field, which my students need. I assume that's because
> > I'm not using the right bibliographic style. How do I set the citation
> > format?  Would I use the bibliographystyle link, or a header argument
> > somewhere?
>
> Support for this is kind of rudimentary, because it is really difficult
> to get properly formatted strings for all references.
>
> When you click on a cite link and select copy formatted entry what
> happens is the bibfile is opened to that entry and then the result of
> org-ref-bib-citation is copied. It is pretty simple, and limited. At the
> moment, I think helm-bibtex does the actual formatting if you load it,
> and it does not appear to be customizable. See
> bibtex-completion-apa-format-reference
>
> I will work on this a little bit and see if some improvements can be
> made.
>

thanks you John!

>
> >
> > Also, is it possible to set this option to use org formatting instead of
> > html formatting?
>
> You could use a function like this on a link to get something more
> customizable.
>
> (defun better-formatted-citation ()
>   (interactive)
>   (kill-new (org-ref-get-bibtex-entry-citation (car
> (org-ref-get-bibtex-key-and-file)))))
>
> see the variable org-ref-bibliography-entry-format, you can set this to
> be whatever format you want.
>
> ah, looks pretty simple, I should be able to do this.

> >
> > * Bibliography scope
> > I guess I don't really know how to build a bibliographic file to go with
> a
> > particular project.  At present I am using my full Zotero library
> exported
> > to bibtex as a default. Is there a way to just build the bibliography
> from
> > the set of sources cited in the paper?
>
> M-x org-ref-extract-bibtex-entries should put a new heading in the buffer
> with the relevant bibtex entries.
>
> excellent, thank you!


> >
> > Thanks everyone, and of course especially John for this amazing tool.
> >
> > Matt
>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>

[-- Attachment #2: Type: text/html, Size: 7288 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: org-ref: citation types (insert full citation); bib style; bib scope
  2017-01-06 16:05   ` Matt Price
@ 2017-01-06 16:10     ` John Kitchin
  2017-01-06 20:42     ` John Kitchin
  1 sibling, 0 replies; 8+ messages in thread
From: John Kitchin @ 2017-01-06 16:10 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 4997 bytes --]

That is possible. I am out now, but this afternoon I will send another note
on how to do it.


On Fri, Jan 6, 2017 at 11:05 AM Matt Price <moptop99@gmail.com> wrote:

> On Fri, Jan 6, 2017 at 10:26 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>
>
>
> Matt Price writes:
>
>
>
>
>
> > After several years, I'm finally trying to move to bibtex from zotero,
>
>
> > partly because org-zotxt has stopped working for me (both link insertion
>
>
> > and html export seem at least temporarily broken).
>
>
> >
>
>
> > The UI for org-ref is pretty fantastic, and I love it. I'm having trouble
>
>
> > getting the behaviour I want fro mthe actual links, though.  My needs may
>
>
> > be somewhat atypical but I'm hoping someone else has figured these
>
>
> > questions out already.
>
>
> >
>
>
> > * citation types
>
>
> > The org-ref manual talks about different citation types, but the external
>
>
> > link it suggests is not loading:
>
>
> > http://ctan.unixbrain.com/macros/latex/contrib/natbib/natnotes.pdf
>
>
>
>
>
> try: http://tug.ctan.org/macros/latex/contrib/natbib/natnotes.pdf
>
>
> ok, thx.
>
>
>
>
>
>
>
> >
>
>
> > 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
> ]]
>
> 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
>
>
>
>
>
>
>
> >
>
>
> > * bib style
>
>
> > When I right-click on a link and select "copy the formatted citation", I
>
>
> > don't get the URL field, which my students need. I assume that's because
>
>
> > I'm not using the right bibliographic style. How do I set the citation
>
>
> > format?  Would I use the bibliographystyle link, or a header argument
>
>
> > somewhere?
>
>
>
>
>
> Support for this is kind of rudimentary, because it is really difficult
>
>
> to get properly formatted strings for all references.
>
>
>
>
>
> When you click on a cite link and select copy formatted entry what
>
>
> happens is the bibfile is opened to that entry and then the result of
>
>
> org-ref-bib-citation is copied. It is pretty simple, and limited. At the
>
>
> moment, I think helm-bibtex does the actual formatting if you load it,
>
>
> and it does not appear to be customizable. See
> bibtex-completion-apa-format-reference
>
>
>
>
>
> I will work on this a little bit and see if some improvements can be
>
>
> made.
>
>
> thanks you John!
>
>
>
>
>
>
> >
>
>
> > Also, is it possible to set this option to use org formatting instead of
>
>
> > html formatting?
>
>
>
>
>
> You could use a function like this on a link to get something more
>
>
> customizable.
>
>
>
>
>
> (defun better-formatted-citation ()
>
>
>   (interactive)
>
>
>   (kill-new (org-ref-get-bibtex-entry-citation (car
> (org-ref-get-bibtex-key-and-file)))))
>
>
>
>
>
> see the variable org-ref-bibliography-entry-format, you can set this to
>
>
> be whatever format you want.
>
>
>
> ah, looks pretty simple, I should be able to do this.
>
>
>
> >
>
>
> > * Bibliography scope
>
>
> > I guess I don't really know how to build a bibliographic file to go with
> a
>
>
> > particular project.  At present I am using my full Zotero library
> exported
>
>
> > to bibtex as a default. Is there a way to just build the bibliography
> from
>
>
> > the set of sources cited in the paper?
>
>
>
>
>
> M-x org-ref-extract-bibtex-entries should put a new heading in the buffer
>
>
> with the relevant bibtex entries.
>
>
>
> excellent, thank you!
>
>
>
>
> >
>
>
> > Thanks everyone, and of course especially John for this amazing tool.
>
>
> >
>
>
> > Matt
>
>
>
>
>
>
>
>
> --
>
>
> Professor John Kitchin
>
>
> Doherty Hall A207F
>
>
> Department of Chemical Engineering
>
>
> Carnegie Mellon University
>
>
> Pittsburgh, PA 15213
>
>
> 412-268-7803
>
>
> @johnkitchin
>
>
> http://kitchingroup.cheme.cmu.edu
>
>
>

[-- Attachment #2: Type: text/html, Size: 12778 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: org-ref: citation types (insert full citation); bib style; bib scope
  2017-01-06 16:05   ` Matt Price
  2017-01-06 16:10     ` John Kitchin
@ 2017-01-06 20:42     ` John Kitchin
  2017-01-07  3:13       ` Matt Price
  1 sibling, 1 reply; 8+ messages in thread
From: John Kitchin @ 2017-01-06 20:42 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

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. 

2. If you click on a citation link, you can select an action to copy the
formatted entry for that key.

3. On a bibtex entry, you can use the org-ref-bibtex-hydra/body to copy
a formatted string of the entry.


>> > 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.

Dominik, C. 2014. /The org mode 8 reference manual - organize your life with gnu emacs/, :Samurai Media Limited. [[http://amazon.com/o/ASIN/9881327709/]]

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)))

then insert a citation from the entry that looks like this:

 . /Atomic Simulation Environment/, [[https://wiki.fysik.dtu.dk/ase/]]


>> >
>> > * bib style
>> > When I right-click on a link and select "copy the formatted citation", I
>> > don't get the URL field, which my students need. I assume that's because
>> > I'm not using the right bibliographic style. How do I set the citation
>> > format?  Would I use the bibliographystyle link, or a header argument
>> > somewhere?


You don't use the bibliographystyle, it is mostly only for building PDF
from LaTeX.

There is some more advanced code in the citeproc directory of org-ref,
but it is early in development (and has been for a year or more ;), and
it has a really limited set of styles. It is still a long time before it
is production ready.

This code has been tested about 1/2 a day now. Try it out and let me
know if you have any troubles.

>>
>> Support for this is kind of rudimentary, because it is really difficult
>> to get properly formatted strings for all references.
>>
>> When you click on a cite link and select copy formatted entry what
>> happens is the bibfile is opened to that entry and then the result of
>> org-ref-bib-citation is copied. It is pretty simple, and limited. At the
>> moment, I think helm-bibtex does the actual formatting if you load it,
>> and it does not appear to be customizable. See
>> bibtex-completion-apa-format-reference
>>
>> I will work on this a little bit and see if some improvements can be
>> made.
>>
>
> thanks you John!
>
>>
>> >
>> > Also, is it possible to set this option to use org formatting instead of
>> > html formatting?
>>
>> You could use a function like this on a link to get something more
>> customizable.
>>
>> (defun better-formatted-citation ()
>>   (interactive)
>>   (kill-new (org-ref-get-bibtex-entry-citation (car
>> (org-ref-get-bibtex-key-and-file)))))
>>
>> see the variable org-ref-bibliography-entry-format, you can set this to
>> be whatever format you want.
>>
>> ah, looks pretty simple, I should be able to do this.
>
>> >
>> > * Bibliography scope
>> > I guess I don't really know how to build a bibliographic file to go with
>> a
>> > particular project.  At present I am using my full Zotero library
>> exported
>> > to bibtex as a default. Is there a way to just build the bibliography
>> from
>> > the set of sources cited in the paper?
>>
>> M-x org-ref-extract-bibtex-entries should put a new heading in the buffer
>> with the relevant bibtex entries.
>>
>> excellent, thank you!
>
>
>> >
>> > Thanks everyone, and of course especially John for this amazing tool.
>> >
>> > Matt
>>
>>
>> --
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: org-ref: citation types (insert full citation); bib style; bib scope
  2017-01-06 20:42     ` John Kitchin
@ 2017-01-07  3:13       ` Matt Price
  2017-01-07 13:23         ` John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Price @ 2017-01-07  3:13 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 6361 bytes --]

Wow, this is pretty awesome, thank you.

A couple 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 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!

[-- Attachment #2: Type: text/html, Size: 8427 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: org-ref: citation types (insert full citation); bib style; bib scope
  2017-01-07  3:13       ` Matt Price
@ 2017-01-07 13:23         ` John Kitchin
  2019-08-30 19:12           ` org-ref: conditionally add url to formatted citation Matt Price
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2017-01-07 13:23 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

>
>>
>> 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

It is pretty weird about org-define-error. It is in org-compat.el. I am
using org-9.

> 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...

I go back and forth on liking ivy/hydra vs helm.

>> 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.

could be, the key is related to the number/order of actions in helm-bibtex.
>>
>>
>>
>> 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!

org-ref has some support to export citations in latex, html, org,
md/pandoc and text. I do not know how good it is, but the framework for
it mostly exists.


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* org-ref: conditionally add url to formatted citation
  2017-01-07 13:23         ` John Kitchin
@ 2019-08-30 19:12           ` Matt Price
  0 siblings, 0 replies; 8+ messages in thread
From: Matt Price @ 2019-08-30 19:12 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 6242 bytes --]

On Sat, Jan 7, 2017 at 8:23 AM John Kitchin <jkitchin@andrew.cmu.edu> wrote:

> >
> >>
> >> 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
>
> It is pretty weird about org-define-error. It is in org-compat.el. I am
> using org-9.
>
> > 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...
>
> I go back and forth on liking ivy/hydra vs helm.
>
> >> 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.
>
> could be, the key is related to the number/order of actions in helm-bibtex.
> >>
> >>
> >>
> >> 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!
>
> org-ref has some support to export citations in latex, html, org,
> md/pandoc and text. I do not know how good it is, but the framework for
> it mostly exists.
>
>
>
I rediscovered this thread recently and found it very helpful.  Hope the
necroposting isn't annoying to others.

Using a current org-ref, I was able to  use these hints to make my life
quite a bit easier when writing syllabi.  I'm just inserting formatted
citations for course texts; this is a bit different from most uses of
org-ref. I want the text to be as readable as possible, and to include a
link to the resource if it exists online, or to ignore the url field if it
doesn't exist.  I did this by lightly modifying
~org-ref-formatted-citation-formats~ and then modifying the function
org-ref uses to insert formatted citations:

-----------
(defun org-ref-format-bibtex-entry (entry)
  "Return a formatted citation for the bibtex entry at point.
Formats are from `org-ref-formatted-citation-formats'. The
variable `org-ref-formatted-citation-backend' determines the set
of format strings used."
  (save-excursion
    (bibtex-beginning-of-entry)
    (let* ((formats (cdr (assoc org-ref-formatted-citation-backend
 org-ref-formatted-citation-formats)))
  (format-string)
  (ref))
      (if (null entry)
          "!!! No entry found !!!"
        (setq format-string (cdr (or (assoc (downcase
(bibtex-completion-get-value "=type=" entry)) formats)
                                     (assoc nil formats))))
        (if (and (string-equal org-ref-formatted-citation-backend "org" )
                 (bibtex-completion-get-value "url" entry))
            (setq format-string
                  (replace-regexp-in-string "${title}"
"[[${url}][${title}]]" format-string)))

        (setq ref (s-format format-string 'bibtex-completion-apa-get-value
entry))
        (replace-regexp-in-string "\\([.?!]\\)\\." "\\1" ref)))))
---------------

The relevant section is the "if" near hte end of the function:

        (if (and (string-equal org-ref-formatted-citation-backend "org" )
                 (bibtex-completion-get-value "url" entry))
            (setq format-string
                  (replace-regexp-in-string "${title}"
"[[${url}][${title}]]" format-string)))

I thought it might possibly be useful for others -- like, it might be nice
to use when composing emails etc -- so I figured I'd post it here.  And
thanks again esp to John for this tool!

[-- Attachment #2: Type: text/html, Size: 8515 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-30 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 14:27 org-ref: citation types (insert full citation); bib style; bib scope Matt Price
2017-01-06 15:26 ` John Kitchin
2017-01-06 16:05   ` Matt Price
2017-01-06 16:10     ` John Kitchin
2017-01-06 20:42     ` John Kitchin
2017-01-07  3:13       ` Matt Price
2017-01-07 13:23         ` John Kitchin
2019-08-30 19:12           ` org-ref: conditionally add url to formatted citation Matt Price

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).