emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to produce an org-ref citation from ivy-bibtex
@ 2023-02-26 16:18 Sven Bretfeld
  2023-02-28 17:07 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Bretfeld @ 2023-02-26 16:18 UTC (permalink / raw)
  To: Emacs Orgmode

Hi everybody

Is it at all possible to produce a correct org-ref citation format
from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
"correct" is the format: [[cite:&citekey]].

The problem seems to come down to the question what has to be inserted
in the 2nd line here:

(setq bibtex-completion-format-citation-functions
      '((org-mode      . ??????)
        (latex-mode    . bibtex-completion-format-citation-cite)
        (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
        (default       . bibtex-completion-format-citation-default)))

(A) Not setting the variable at all, defaults to producing an ebib
link which is of no use to me at all.

(B) Putting org-ref-helm-bibtex-insert-citation here (as found on
reddit) does not work, since the function does not seem to exist
anymore.

(C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing
that from the list of ivy-bibtex-actions, just calls the function
interactively, you have to search for the bib-entry again and the
resulting link looks like: [[cite:&citekey]]^&. The terminating '^&'
obviously makes subsequent LaTeX-exports fall.

(D) Putting "bibtex-completion-format-citation-org-cite" here,
produces standard org-links: [cite:@citekey]. These are not correctly
exported to a tex file when the org-ref package is loaded.

The only working solution I have found is to use org-ref's own cite
function org-ref-insert-cite-link. I know that ivy-bibtex can be set
as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
actions (like opening an associated PDF or note file) are lost.

It would be nice to be able to use a SINGLE key-binding to select a
bib-entry and then decide what to do with it (insert org reference,
insert tex reference, open pdf, etc.). This was possible earlier (I
did that for years with older versions of org-ref-helm) but is
apparently no longer possible now.

Many thanks for help and suggestions,

Sven


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

* Re: How to produce an org-ref citation from ivy-bibtex
  2023-02-26 16:18 How to produce an org-ref citation from ivy-bibtex Sven Bretfeld
@ 2023-02-28 17:07 ` John Kitchin
  2023-03-01 12:25   ` Sven Bretfeld
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2023-02-28 17:07 UTC (permalink / raw)
  To: Sven Bretfeld; +Cc: Emacs Orgmode

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

You can try something like this

#+BEGIN_SRC emacs-lisp
(setq bibtex-completion-format-citation-functions
      '((org-mode      . (lambda (keys) (org-ref-insert-cite-keys keys) ""))
        (latex-mode    . bibtex-completion-format-citation-cite)
        (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
        (default       . bibtex-completion-format-citation-default)))
#+END_SRC

it seems like ivy-bibtex at least expects some kind of string to be
returned, but org-ref-insert-cite-keys does the insertion for you.

On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld <sven.bretfeld@ntnu.no>
wrote:

> Hi everybody
>
> Is it at all possible to produce a correct org-ref citation format
> from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
> "correct" is the format: [[cite:&citekey]].
>
> The problem seems to come down to the question what has to be inserted
> in the 2nd line here:
>
> (setq bibtex-completion-format-citation-functions
>       '((org-mode      . ??????)
>         (latex-mode    . bibtex-completion-format-citation-cite)
>         (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
>         (default       . bibtex-completion-format-citation-default)))
>
> (A) Not setting the variable at all, defaults to producing an ebib
> link which is of no use to me at all.
>
> (B) Putting org-ref-helm-bibtex-insert-citation here (as found on
> reddit) does not work, since the function does not seem to exist
> anymore.
>
> (C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing
> that from the list of ivy-bibtex-actions, just calls the function
> interactively, you have to search for the bib-entry again and the
> resulting link looks like: [[cite:&citekey]]^&. The terminating '^&'
> obviously makes subsequent LaTeX-exports fall.
>
> (D) Putting "bibtex-completion-format-citation-org-cite" here,
> produces standard org-links: [cite:@citekey]. These are not correctly
> exported to a tex file when the org-ref package is loaded.
>
> The only working solution I have found is to use org-ref's own cite
> function org-ref-insert-cite-link. I know that ivy-bibtex can be set
> as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
> actions (like opening an associated PDF or note file) are lost.
>
> It would be nice to be able to use a SINGLE key-binding to select a
> bib-entry and then decide what to do with it (insert org reference,
> insert tex reference, open pdf, etc.). This was possible earlier (I
> did that for years with older versions of org-ref-helm) but is
> apparently no longer possible now.
>
> Many thanks for help and suggestions,
>
> Sven
>
>

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

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

* Re: How to produce an org-ref citation from ivy-bibtex
  2023-02-28 17:07 ` John Kitchin
@ 2023-03-01 12:25   ` Sven Bretfeld
  2023-03-01 12:29     ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Bretfeld @ 2023-03-01 12:25 UTC (permalink / raw)
  To: Emacs Orgmode

Hi John

Thank you very much again. Elegant solution, and it works.

I just wonder why I seem to be the only one on the list who had that
problem. Am I so out of fashion to use org-ref and ivy/helm-bibtex
together? I have been doing that for surely 10 years but had to stick
with an old version of org-ref until recently (because of a completely
different problem that I will post in another thread).

Have a nice day,

Sven


Am Tue, Feb 28, 2023 at 12:07:35PM -0500 schrieb John Kitchin:
> You can try something like this
> 
> #+BEGIN_SRC emacs-lisp
> (setq bibtex-completion-format-citation-functions
>       '((org-mode      . (lambda (keys) (org-ref-insert-cite-keys keys) ""))
>         (latex-mode    . bibtex-completion-format-citation-cite)
>         (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
>         (default       . bibtex-completion-format-citation-default)))
> #+END_SRC
> 
> it seems like ivy-bibtex at least expects some kind of string to be returned,
> but org-ref-insert-cite-keys does the insertion for you.
> 
> On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld <[1]sven.bretfeld@ntnu.no>
> wrote:
> 
>     Hi everybody
> 
>     Is it at all possible to produce a correct org-ref citation format
>     from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
>     "correct" is the format: [[cite:&citekey]].
> 
>     The problem seems to come down to the question what has to be inserted
>     in the 2nd line here:
> 
>     (setq bibtex-completion-format-citation-functions
>           '((org-mode      . ??????)
>             (latex-mode    . bibtex-completion-format-citation-cite)
>             (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
>             (default       . bibtex-completion-format-citation-default)))
> 
>     (A) Not setting the variable at all, defaults to producing an ebib
>     link which is of no use to me at all.
> 
>     (B) Putting org-ref-helm-bibtex-insert-citation here (as found on
>     reddit) does not work, since the function does not seem to exist
>     anymore.
> 
>     (C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing
>     that from the list of ivy-bibtex-actions, just calls the function
>     interactively, you have to search for the bib-entry again and the
>     resulting link looks like: [[cite:&citekey]]^&. The terminating '^&'
>     obviously makes subsequent LaTeX-exports fall.
> 
>     (D) Putting "bibtex-completion-format-citation-org-cite" here,
>     produces standard org-links: [cite:@citekey]. These are not correctly
>     exported to a tex file when the org-ref package is loaded.
> 
>     The only working solution I have found is to use org-ref's own cite
>     function org-ref-insert-cite-link. I know that ivy-bibtex can be set
>     as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
>     actions (like opening an associated PDF or note file) are lost.
> 
>     It would be nice to be able to use a SINGLE key-binding to select a
>     bib-entry and then decide what to do with it (insert org reference,
>     insert tex reference, open pdf, etc.). This was possible earlier (I
>     did that for years with older versions of org-ref-helm) but is
>     apparently no longer possible now.
> 
>     Many thanks for help and suggestions,
> 
>     Sven
> 
> 
> 
> References:
> 
> [1] mailto:sven.bretfeld@ntnu.no


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

* Re: How to produce an org-ref citation from ivy-bibtex
  2023-03-01 12:25   ` Sven Bretfeld
@ 2023-03-01 12:29     ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2023-03-01 12:29 UTC (permalink / raw)
  To: Sven Bretfeld; +Cc: Emacs Orgmode

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

The best place to report org-ref issues is
https://github.com/jkitchin/org-ref/issues.

On Wed, Mar 1, 2023 at 7:25 AM Sven Bretfeld <sven.bretfeld@ntnu.no> wrote:

> Hi John
>
> Thank you very much again. Elegant solution, and it works.
>
> I just wonder why I seem to be the only one on the list who had that
> problem. Am I so out of fashion to use org-ref and ivy/helm-bibtex
> together? I have been doing that for surely 10 years but had to stick
> with an old version of org-ref until recently (because of a completely
> different problem that I will post in another thread).
>
> Have a nice day,
>
> Sven
>
>
> Am Tue, Feb 28, 2023 at 12:07:35PM -0500 schrieb John Kitchin:
> > You can try something like this
> >
> > #+BEGIN_SRC emacs-lisp
> > (setq bibtex-completion-format-citation-functions
> >       '((org-mode      . (lambda (keys) (org-ref-insert-cite-keys keys)
> ""))
> >         (latex-mode    . bibtex-completion-format-citation-cite)
> >         (markdown-mode .
> bibtex-completion-format-citation-pandoc-citeproc)
> >         (default       . bibtex-completion-format-citation-default)))
> > #+END_SRC
> >
> > it seems like ivy-bibtex at least expects some kind of string to be
> returned,
> > but org-ref-insert-cite-keys does the insertion for you.
> >
> > On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld <[1]sven.bretfeld@ntnu.no
> >
> > wrote:
> >
> >     Hi everybody
> >
> >     Is it at all possible to produce a correct org-ref citation format
> >     from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
> >     "correct" is the format: [[cite:&citekey]].
> >
> >     The problem seems to come down to the question what has to be
> inserted
> >     in the 2nd line here:
> >
> >     (setq bibtex-completion-format-citation-functions
> >           '((org-mode      . ??????)
> >             (latex-mode    . bibtex-completion-format-citation-cite)
> >             (markdown-mode .
> bibtex-completion-format-citation-pandoc-citeproc)
> >             (default       . bibtex-completion-format-citation-default)))
> >
> >     (A) Not setting the variable at all, defaults to producing an ebib
> >     link which is of no use to me at all.
> >
> >     (B) Putting org-ref-helm-bibtex-insert-citation here (as found on
> >     reddit) does not work, since the function does not seem to exist
> >     anymore.
> >
> >     (C) Putting org-ref-insert-cite-link here is obviously wrong.
> Choosing
> >     that from the list of ivy-bibtex-actions, just calls the function
> >     interactively, you have to search for the bib-entry again and the
> >     resulting link looks like: [[cite:&citekey]]^&. The terminating '^&'
> >     obviously makes subsequent LaTeX-exports fall.
> >
> >     (D) Putting "bibtex-completion-format-citation-org-cite" here,
> >     produces standard org-links: [cite:@citekey]. These are not
> correctly
> >     exported to a tex file when the org-ref package is loaded.
> >
> >     The only working solution I have found is to use org-ref's own cite
> >     function org-ref-insert-cite-link. I know that ivy-bibtex can be set
> >     as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
> >     actions (like opening an associated PDF or note file) are lost.
> >
> >     It would be nice to be able to use a SINGLE key-binding to select a
> >     bib-entry and then decide what to do with it (insert org reference,
> >     insert tex reference, open pdf, etc.). This was possible earlier (I
> >     did that for years with older versions of org-ref-helm) but is
> >     apparently no longer possible now.
> >
> >     Many thanks for help and suggestions,
> >
> >     Sven
> >
> >
> >
> > References:
> >
> > [1] mailto:sven.bretfeld@ntnu.no
>
>

-- 
ohn

-----------------------------------
Professor John Kitchin (he/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
https://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore

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

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

end of thread, other threads:[~2023-03-01 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-26 16:18 How to produce an org-ref citation from ivy-bibtex Sven Bretfeld
2023-02-28 17:07 ` John Kitchin
2023-03-01 12:25   ` Sven Bretfeld
2023-03-01 12:29     ` John Kitchin

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