On a fresh install of Emacs I am unable to get org-ref to produce citations in my pdfs. I simply get question marks and in Org PDF Latex Output I get a lot of LaTeX Warning: Citation XXX on page XX undefined on input line XX.
Doing C-c ]
works fine and so does M-x org-ref
. However, if I run M-x org-ref
after inserting a citation somewhere in the document, I get the following error: org-ref-list-index: No catch for tag: --cl-block-nil--, 0
. So I wonder if that might have something to do with it.
My org file (thesis.org) and bib file (bibliography.bib) are in the same folder.
Edit 1: producing just the .tex file and then running pdflatex, then bibtex then two times pdflatex in terminal according to this answer works. Would still like to have org-ref work within Emacs.
Edit 2: Running with the debugger, I get this Backtrace:
Debugger entered--Lisp error: (no-catch --cl-block-nil-- 2)
throw(--cl-block-nil-- 2)
org-ref-list-index("einstein" ("knuthwebsite" "latexcompanion" "einstein"))
SOME CODE HERE THAT IS TOO LONG TO POST, LOOKS LIKE: #f(compiled-function (link) #<bytecode 0x174a8c1>)((link (:type "cite"...
org-ref-bad-cite-candidates()
org-ref()
funcall-interactively(org-ref)
call-interactively(org-ref record nil)
command-execute(org-ref record)
execute-extended-command(nil "org-ref" "org-ref")
funcall-interactively(execute-extended-command nil "org-ref" "org-ref")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
- Org-ref version: 20201013.1427
- OS: Ubuntu 20.10
- Emacs version: 26.3
The output of M-x org-ref
(when it does work) is: (I transcribed this from the screen, so please allow typos)
* Bibliography
Using the bibtex files: (bibliography.bib)
* Miscellaneous
org-latex-prefer-user-labels = nil
bibtex-dialect = BibTeX
biblatex is not required.
biblatex is not used.
org-version = 9.4
completion backend = org-ref-helm-bibtex
org-latex-pdf-process is defined as (%latex -interaction nonstopmode -output-directory %o %f %latex -interaction nonstopmode -output-directory %o %f %latex -interaction nonstopmode -output-directory %o %f)
natbib is not required.
natbib is not used.
cleveref is not required.
cleveref is not used.
* Utilities
Check buffer again
thesis.org
* Header
Some text. cite:knuthwebsite
bibliographystyle:unsrt
bibliography:bibliography.bib
bibliography.bib
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
init.el
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-buffer-menu nil)
'(inhibit-startup-screen t)
'(package-selected-packages
(quote
(helm-swoop org-superstar org-brain org use-package tidal py-autopep8 org-bullets flycheck elpy))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; -------------------------------------------------------------
;; org
(add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))
;; -------------------------------------------------------------
;; latex
(require 'ox-latex)
(add-to-list 'org-latex-classes
'("mimosis"
"\\documentclass{mimosis}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\mboxparagraph{%s}" . "\\mboxparagraph*{%s}")
("\\mboxsubparagraph{%s}" . "\\mboxsubparagraph*{%s}")))
;; -------------------------------------------------------------
;; org-ref
(require 'org-ref)
(setq reftex-default-bibliography '("~/test/bibliography.bib"))
;; see org-ref for use of these variables
(setq org-ref-bibliography-notes "~/test/notes.org"
org-ref-default-bibliography '("~/test/bibliography.bib")
org-ref-pdf-directory "~/test/papers")
(setq bibtex-completion-bibliography "~/test/bibliography.bib"
bibtex-completion-library-path "~/test/papers"
bibtex-completion-notes-path "~/test/helm-bibtex-notes")
;; -------------------------------------------------------------
;; helm
(require 'helm)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
;; helm-swoop
(require 'helm-swoop)
(global-set-key (kbd "M-i") 'helm-swoop)
(global-set-key (kbd "M-I") 'helm-swoop-back-to-last-point)
(global-set-key (kbd "C-c M-i") 'helm-multi-swoop)
(global-set-key (kbd "C-x M-i") 'helm-multi-swoop-all)
(define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
(define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
(setq helm-multi-swoop-edit-save t)
(setq helm-swoop-use-fuzzy-match t)
debug-on-error
tot
and post the backtrace you get (assuming you get one). Can you also try with a very simple init.el (maybe just `(require 'org-ref)``?(org-ref-list-index "einstein" '("knuthwebsite" "latexcompanion" "einstein"))
in your scratch buffer; I get 2 as the answer, but I suspect you are going to get your usual error. Not sure why - yet.min-init.el
as above)