0

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)
4
  • FWIW, I cannot reproduce the error. Try setting debug-on-error to t 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)``? – NickD Nov 17 '20 at 20:05
  • I have now tried this with a minimal init. The Backtrace is posted as Edit 2. – Bertil Johannes Ipsen Nov 17 '20 at 21:52
  • So try evaluating (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. – NickD Nov 17 '20 at 22:27
  • (would post this as a comment but i don't have enough reputation). I have the same issue and it is still present in GNU Emacs 28.0.50 (snapshot from emacs.ganneff.de) on bullseye/sid (with minimal min-init.el as above) – Ruben Nov 19 '20 at 18:03
1

I have pushed a lot of commits to fix issues like these in the last two weeks. The issues were due to differences in dolist, and cl-lib, etc. I think they are all working now.

The answer is probably to update to the latest org-ref, and all the issues should go away. If not, I would consider it a bug in org-ref still and it would be helpful to report it at https://github.com/jkitchin/org-ref/issues.

1

[This is not an answer: it's more debugging suggestions to avoid a long comment thread]

I evaluated (org-ref-list-index "einstein" '("knuthwebsite" "latexcompanion" "einstein")) in 26.3 and I get 2 there as well: no error (I started with emacs -q and initialized the package system by hand in order to load org-ref which I installed from MELPA).

Note that org-ref-list-index uses dolist.dolist in 26.3 is a macro that does not have any advice around it: please confirm with C-h f dolist RET. In 28.50.0 however, there is an advice: the doc string says:

dolist is a Lisp macro in ‘subr.el’.

(dolist (VAR LIST [RESULT]) BODY...)

  Probably introduced at or before Emacs version 21.1.

This macro has :around advice: ‘cl--wrap-in-nil-block’.

Loop over a list.
Evaluate BODY with VAR bound to each car from LIST, in turn.
Then evaluate RESULT to get return value, default nil.

That sounds to me as if there is some incompatibility: it seems that somethings throws --cl-block-nil-- but dolist does not catch it and you end up with the error. In a vanilla 26.3 system, nobody should throw that, but apparently somebody does in your setup. OTOH, in 28.50.0, dolist has an advice that I'm guessing adds a catch for that, presumably because somebody does throw it. So you seem to have something that throws that condition but a dolist that is incapable of catching it.

BTW, this is mostly guesswork - just in case it wasn't clear :-)

TODO:

  • try evaluating (org-ref-list-index "einstein" '("knuthwebsite" "latexcompanion" "einstein")) in your *scratch* buffer and see if you get the error.
  • try the same thing but with emacs -q -l min-init.el so as to avoid most of your initializations. You will still need something like this in your min-init.el:
(require 'package)
(package-initialize)
(require 'org-ref)

If you get the error with both of those, something would seem to be curdled in your installation: I would upgrade emacs and start from scratch.

2
  • Thanks so much for your answer. C-h f dolist RET does indeed give me the same doc string as the one you posted. Do you have any idea of where to go from here? Should I get a new version of Emacs? – Bertil Johannes Ipsen Nov 18 '20 at 10:47
  • Remote debugging is hard :-) I added a few suggestions in the TODO list. – NickD Nov 18 '20 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.