jkitchin / org-ref

org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.
GNU General Public License v3.0
1.37k stars 244 forks source link

org-ref fails with BibLaTeX entry types #887

Closed benthamite closed 3 years ago

benthamite commented 3 years ago

After invoking helm-bibtex and inserting a citation with a BibLaTeX entry type (that isn't also a Bibtex entry type), org-ref returns an error. Here is an example:

@video{Bujot2013JorgeLuisBorges,
  title = {Jorge Luis Borges: entretien - janvier 1972 - Buenos Aires},
  editor = {Bujot, Suzanne and Marchand, Jean José},
  date = {2013},
  publisher = {{Montparnasse}},
  location = {{Paris}},
  abstract = {"À l'origine de quelques-uns des grands mythes littéraires contemporains, comme celui de La Bibliothèque de Babel, l'argentin Jorge Luis Borges (1899-1986) jouit d'une notoriété internationale et universelle. L'ampleur, la diversité et la qualité de son œuvre lui valent de nombreuses distinctions à travers le monde. Ses travaux dans les champs de l'essai et de la nouvelle sont considérés comme des classiques de la littérature du xxe siècle. Écrivain hors du commun et grand amateur de voyages, Jorge Luis Borges, reconnu comme l'un des pionniers du réalisme " magique " a toujours considéré la littérature comme un terrain d'évasion et d'absolu."},
  annotation = {OCLC: 1040511170},
  editortype = {director},
  isbn = {3346030025895},
  langid = {french}
}

If I change the entry to to e.g. book (so that the first line becomes @book{Bujot2013JorgeLuisBorges,) and reinsert a citation to it, org-ref works fine.

My understanding is that, while org-ref doesn't officially support BibLaTeX, users haven't generally reported problems with BibLaTeX entries, so I'm not sure what's going on. (Unfortunately, simply switching to BibTeX is not an option for me, since a sizeable portion of the entries I need to cite must include the day of publication, whereas BibTeX only supports publication month and year.)

GNU Emacs 28.0.50 Org mode version 9.4.6

Backtrace

``` Debugger entered--Lisp error: (wrong-type-argument listp "~/Dropbox/org/bibliography.bib") car("~/Dropbox/org/bibliography.bib") (or (cdr results) (car bibtex-completion-bibliography)) (let* ((results (org-ref-get-bibtex-key-and-file)) (key (car results)) (bibfile (or (cdr results) (car bibtex-completion-bibliography))) (bibtex-completion-bibliography (list bibfile)) (entry (bibtex-completion-get-entry key)) (pdf-file (funcall org-ref-get-pdf-filename-function key)) (pdf-bibtex-completion (car (bibtex-completion-find-pdf key))) (notes-p (cdr (assoc "=has-note=" entry))) (url (save-excursion (let (...) (save-current-buffer ... ...)))) (doi (save-excursion (let (...) (save-current-buffer ... ...)))) (candidates '(("Quit" . org-ref-citation-at-point) ("Open bibtex entry" . org-ref-open-citation-at-point)))) (if (string= doi "") (progn (setq doi nil))) (if (string= url "") (progn (setq url nil))) (cond ((file-exists-p pdf-file) (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates)))) (pdf-bibtex-completion (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates)))) (t (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))))) (if notes-p (if (memql '("Open notes" . org-ref-open-notes-at-point) candidates) (with-no-warnings candidates) (setq candidates (cons '... candidates))) (if (memql '("Add notes" . org-ref-open-notes-at-point) candidates) (with-no-warnings candidates) (setq candidates (cons '... candidates)))) (if (or url doi) (progn (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))))) (if doi (progn (mapc #'(lambda ... ...) '(... ... ... ... ... ...)))) (if (memql '("Insert new citation" lambda nil (org-ref-helm-insert-cite-link nil)) candidates) (with-no-warnings candidates) (setq candidates (cons '("Insert new citation" lambda nil ...) candidates))) (if (memql '("Delete key at point" . org-ref-delete-key-at-point) candidates) (with-no-warnings candidates) (setq candidates (cons '("Delete key at point" . org-ref-delete-key-at-point) candidates))) (if (memql '("Replace key at point" . org-ref-replace-key-at-point) candidates) (with-no-warnings candidates) (setq candidates (cons '("Replace key at point" . org-ref-replace-key-at-point) candidates))) (if (memql '("Delete citation at point" . org-ref-delete-cite-at-point) candidates) (with-no-warnings candidates) (setq candidates (cons '("Delete citation at point" . org-ref-delete-cite-at-point) candidates))) (if bibtex-completion-cite-prompt-for-optional-arguments (progn (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))))) (if (memql '("Sort keys by year" . org-ref-sort-citation-link) candidates) (with-no-warnings candidates) (setq candidates (cons '("Sort keys by year" . org-ref-sort-citation-link) candidates))) (if (memql '("Copy formatted citation to clipboard" . org-ref-copy-cite-as-summary) candidates) (with-no-warnings candidates) (setq candidates (cons '("Copy formatted citation to clipboard" . org-ref-copy-cite-as-summary) candidates))) (if (memql '("Copy key to clipboard" lambda nil (kill-new ...)) candidates) (with-no-warnings candidates) (setq candidates (cons '("Copy key to clipboard" lambda nil ...) candidates))) (if (memql '("Copy bibtex entry to file" . org-ref-copy-entry-at-point-to-file) candidates) (with-no-warnings candidates) (setq candidates (cons '("Copy bibtex entry to file" . org-ref-copy-entry-at-point-to-file) candidates))) (if (memql '("Email bibtex entry and pdf" lambda nil (save-excursion ... ...)) candidates) (with-no-warnings candidates) (setq candidates (cons '("Email bibtex entry and pdf" lambda nil ...) candidates))) (if (and (boundp '*scopus-api-key*) *scopus-api-key*) (progn (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))) (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))) (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))) (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))) (if (memql '... candidates) (with-no-warnings candidates) (setq candidates (cons ... candidates))))) (let* ((i 0) (--cl-var-- (reverse candidates)) (cell nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq cell (car --cl-var--)) (setq --cl-var-- (cons (cons ... ...) --cl-var--)) (setq i (+ i 1)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--))) org-ref-cite-candidates() (let ((name (org-ref-format-entry (org-ref-get-bibtex-key-under-cursor))) (candidates (org-ref-cite-candidates)) (cb (current-buffer))) (helm :sources (list (list (cons 'name name) (cons 'candidates candidates) (cons 'action (cons 'lambda (cons '... (cons ... ...))))) (list '(name . "User functions") (cons 'candidates org-ref-helm-user-candidates) (cons 'action (cons 'lambda (cons '... (cons ... ...)))))))) org-ref-cite-click-helm(nil) funcall(org-ref-cite-click-helm nil) (lambda (_) (funcall org-ref-cite-onclick-function nil))("Bujot2013JorgeLuisBorges") org-link-open((link (:type "cite" :path "Bujot2013JorgeLuisBorges" :format plain :raw-link "cite:Bujot2013JorgeLuisBorges" :application nil :search-option nil :begin 21621 :end 21650 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 21621 :end 21653 :contents-begin 21621 :contents-end 21651 :post-blank 2 :post-affiliated 21621 :parent nil)))) nil) org-open-at-point(nil) funcall-interactively(org-open-at-point nil) org-return(nil nil 1) funcall-interactively(org-return nil nil 1) command-execute(org-return) ```

jkitchin commented 3 years ago

There could be a few things happening. One is it looks like you haven’t configured the default bibliography as a list of strings. That is what the top of your trace back indicates.

Second you probably don’t have the biblatex dialect set in the bibtex file. That is how emacs knows which types are correct.

On Thu, Jul 8, 2021 at 6:28 PM Pablo Stafforini @.***> wrote:

After invoking helm-bibtex and inserting a citation with a BibLaTeX entry type (that isn't also a Bibtex entry type), org-ref returns an error. Here is an example:

@video{Bujot2013JorgeLuisBorges,

title = {Jorge Luis Borges: entretien - janvier 1972 - Buenos Aires},

editor = {Bujot, Suzanne and Marchand, Jean José},

date = {2013},

publisher = {{Montparnasse}},

location = {{Paris}},

abstract = {"À l'origine de quelques-uns des grands mythes littéraires contemporains, comme celui de La Bibliothèque de Babel, l'argentin Jorge Luis Borges (1899-1986) jouit d'une notoriété internationale et universelle. L'ampleur, la diversité et la qualité de son œuvre lui valent de nombreuses distinctions à travers le monde. Ses travaux dans les champs de l'essai et de la nouvelle sont considérés comme des classiques de la littérature du xxe siècle. Écrivain hors du commun et grand amateur de voyages, Jorge Luis Borges, reconnu comme l'un des pionniers du réalisme " magique " a toujours considéré la littérature comme un terrain d'évasion et d'absolu."},

annotation = {OCLC: 1040511170},

editortype = {director},

isbn = {3346030025895},

langid = {french}

}

If I change the entry to to e.g. book (so that the first line becomes @book{Bujot2013JorgeLuisBorges,) and reinsert a citation to it, org-ref works fine.

My understanding is that, while org-ref doesn't not officially support BibLaTeX, users haven't generally reported problems with BibLaTeX entries, so I'm not sure what's going on. (Unfortunately, I can't switch to BibTeX, since a sizeable portion of the entries I need to cite need to include the day of publication, whereas BibTeX only supports month and year.

GNU Emacs 28.0.50 Org mode version 9.4.6 Backtrace


"~/Dropbox/org/bibliography.bib") car("~/Dropbox/org/bibliography.bib") (or
(cdr results) (car bibtex-completion-bibliography)) (let* ((results
(org-ref-get-bibtex-key-and-file)) (key (car results)) (bibfile (or (cdr
results) (car bibtex-completion-bibliography)))
(bibtex-completion-bibliography (list bibfile)) (entry
(bibtex-completion-get-entry key)) (pdf-file (funcall
org-ref-get-pdf-filename-function key)) (pdf-bibtex-completion (car
(bibtex-completion-find-pdf key))) (notes-p (cdr (assoc "=has-note="
entry))) (url (save-excursion (let (...) (save-current-buffer ... ...))))
(doi (save-excursion (let (...) (save-current-buffer ... ...))))
(candidates '(("Quit" . org-ref-citation-at-point) ("Open bibtex entry" .
org-ref-open-citation-at-point)))) (if (string= doi "") (progn (setq doi
nil))) (if (string= url "") (progn (setq url nil))) (cond ((file-exists-p
pdf-file) (if (memql '... candidates) (with-no-warnings candidates) (setq
candidates (cons ... candidates)))) (pdf-bibtex-completion (if (memql '...
candidates) (with-no-warnings candidates) (setq candidates (cons ...
candidates)))) (t (if (memql '... candidates) (with-no-warnings candidates)
(setq candidates (cons ... candidates))))) (if notes-p (if (memql '("Open
notes" . org-ref-open-notes-at-point) candidates) (with-no-warnings
candidates) (setq candidates (cons '... candidates))) (if (memql '("Add
notes" . org-ref-open-notes-at-point) candidates) (with-no-warnings
candidates) (setq candidates (cons '... candidates)))) (if (or url doi)
(progn (if (memql '... candidates) (with-no-warnings candidates) (setq
candidates (cons ... candidates))))) (if doi (progn (mapc #'(lambda ...
...) '(... ... ... ... ... ...)))) (if (memql '("Insert new citation"
lambda nil (org-ref-helm-insert-cite-link nil)) candidates)
(with-no-warnings candidates) (setq candidates (cons '("Insert new
citation" lambda nil ...) candidates))) (if (memql '("Delete key at point"
. org-ref-delete-key-at-point) candidates) (with-no-warnings candidates)
(setq candidates (cons '("Delete key at point" .
org-ref-delete-key-at-point) candidates))) (if (memql '("Replace key at
point" . org-ref-replace-key-at-point) candidates) (with-no-warnings
candidates) (setq candidates (cons '("Replace key at point" .
org-ref-replace-key-at-point) candidates))) (if (memql '("Delete citation
at point" . org-ref-delete-cite-at-point) candidates) (with-no-warnings
candidates) (setq candidates (cons '("Delete citation at point" .
org-ref-delete-cite-at-point) candidates))) (if
bibtex-completion-cite-prompt-for-optional-arguments (progn (if (memql '...
candidates) (with-no-warnings candidates) (setq candidates (cons ...
candidates))))) (if (memql '("Sort keys by year" .
org-ref-sort-citation-link) candidates) (with-no-warnings candidates) (setq
candidates (cons '("Sort keys by year" . org-ref-sort-citation-link)
candidates))) (if (memql '("Copy formatted citation to clipboard" .
org-ref-copy-cite-as-summary) candidates) (with-no-warnings candidates)
(setq candidates (cons '("Copy formatted citation to clipboard" .
org-ref-copy-cite-as-summary) candidates))) (if (memql '("Copy key to
clipboard" lambda nil (kill-new ...)) candidates) (with-no-warnings
candidates) (setq candidates (cons '("Copy key to clipboard" lambda nil
...) candidates))) (if (memql '("Copy bibtex entry to file" .
org-ref-copy-entry-at-point-to-file) candidates) (with-no-warnings
candidates) (setq candidates (cons '("Copy bibtex entry to file" .
org-ref-copy-entry-at-point-to-file) candidates))) (if (memql '("Email
bibtex entry and pdf" lambda nil (save-excursion ... ...)) candidates)
(with-no-warnings candidates) (setq candidates (cons '("Email bibtex entry
and pdf" lambda nil ...) candidates))) (if (and (boundp '*scopus-api-key*)
*scopus-api-key*) (progn (if (memql '... candidates) (with-no-warnings
candidates) (setq candidates (cons ... candidates))) (if (memql '...
candidates) (with-no-warnings candidates) (setq candidates (cons ...
candidates))) (if (memql '... candidates) (with-no-warnings candidates)
(setq candidates (cons ... candidates))) (if (memql '... candidates)
(with-no-warnings candidates) (setq candidates (cons ... candidates))) (if
(memql '... candidates) (with-no-warnings candidates) (setq candidates
(cons ... candidates))))) (let* ((i 0) (--cl-var-- (reverse candidates))
(cell nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq cell (car
--cl-var--)) (setq --cl-var-- (cons (cons ... ...) --cl-var--)) (setq i (+
i 1)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))
org-ref-cite-candidates() (let ((name (org-ref-format-entry
(org-ref-get-bibtex-key-under-cursor))) (candidates
(org-ref-cite-candidates)) (cb (current-buffer))) (helm :sources (list
(list (cons 'name name) (cons 'candidates candidates) (cons 'action (cons
'lambda (cons '... (cons ... ...))))) (list '(name . "User functions")
(cons 'candidates org-ref-helm-user-candidates) (cons 'action (cons 'lambda
(cons '... (cons ... ...)))))))) org-ref-cite-click-helm(nil)
funcall(org-ref-cite-click-helm nil) (lambda (_) (funcall
org-ref-cite-onclick-function nil))("Bujot2013JorgeLuisBorges")
org-link-open((link (:type "cite" :path "Bujot2013JorgeLuisBorges" :format
plain :raw-link "cite:Bujot2013JorgeLuisBorges" :application nil
:search-option nil :begin 21621 :end 21650 :contents-begin nil
:contents-end nil :post-blank 0 :parent (paragraph (:begin 21621 :end 21653
:contents-begin 21621 :contents-end 21651 :post-blank 2 :post-affiliated
21621 :parent nil)))) nil) org-open-at-point(nil)
funcall-interactively(org-open-at-point nil) org-return(nil nil 1)
funcall-interactively(org-return nil nil 1) command-execute(org-return) ```

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/jkitchin/org-ref/issues/887>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMJCVREQ5HSKK4YAUE2R7DTWYRBRANCNFSM5ABTSVSQ>
.

-- 
John

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

benthamite commented 3 years ago

I appreciate the quick reply.

Your second suggestion fixed my problem. I had failed to set bibtex-dialect to 'biblatex. This is clearly explained in this section of the manual, so apologies for not figuring this out by myself.