org-ref
org-ref copied to clipboard
Bibliography link not being detected?
I have a bibliography link like so at the bottom of my document:
bibliography:references.bib
bibliographystyle:ieeetr
However, when I use C-]
to insert a link, there are no references displayed in the list. If I put
#+BIBLIOGRAPHY: ./references.bib
at the top of the document and use helm-bibtex-with-local-bibliography
, the references are detected with no problem. In addition, I can work around the problem by adding
# -*- bibtex-completion-bibliography: ("./references.bib"); -*-
to the top of the file, and then C-]
detects my references as expected. It is just when I rely solely on the bibliography link at the bottom of my document that it doesn't work.
This is only something I've noticed recently; I've had org-ref working just like this in the past. In addition, helm-bibtex works fine in LaTeX mode, it's just in org-mode that it breaks.
Any ideas on how I could fix this?
EDIT: ~~Additionally, I have just noticed that this also causes the LaTeX exporter not to work, so even this is not detecting the bibliography link.~~ This was just because I hadn't set up my config properly. If I ensure bibtex is called in the LaTeX export command, the references are added to the document correctly.
hm. is the link active, i.e. is it blue, and can you click on the bibliography link to open it and there is a tooltip on it?
Yes, the link is blue, clicking it opens the file and hovering over it says either "Bibliography link" or "File exists at references.bib", dependent on where I hover.
I've just discovered that it seems to detect it fine without setting bibtex-completion-bibliography
if I use org-ref-insert-cite-link
rather than helm-bibtex; I can start typing the name of a reference and it autocompletes quite happily. It seems to just be helm-bibtex that isn't working. So perhaps more an issue on their end than with org-ref.
I see. if you have just updated from org-ref 2 to org-ref-3, there is probably some reconfiguration to do.
I think you need:
(require 'org-ref)
(require 'org-ref-helm)
The helm command is org-ref-cite-insert-helm
, which I guess you need to put into
(setq org-ref-insert-cite-function 'org-ref-cite-insert-helm)
. Then I think the key binding should use helm.
I should already have these things in my config, The full configuration in my init.el
is
(use-package org-ref
:ensure t
:config
(require 'org-ref)
(require 'org-ref-helm)
(define-key org-mode-map (kbd "C-c ]") 'org-ref-insert-link)
(setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body
org-ref-insert-cite-function 'org-ref-cite-insert-helm
org-ref-insert-label-function 'org-ref-insert-label-link
org-ref-insert-ref-function 'org-ref-insert-ref-link
org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body)))
(message "org-ref is installed")
)
I don't know what the issue is then. With that setup, C-c ] should insert a link from your bibliography. It should look like it comes from helm-bibtex, but I think it doesn't actually come from helm-bibtex. You can't do that directly from helm-bibtex I think.
It maybe used to be that way, I think in v2 I directly monkey-patched helm-bibtex actions to do this, but in v3, that is not the case I think.