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.36k stars 242 forks source link

Mandatory field 'journaltitle' is missing #40

Closed xarthurx closed 9 years ago

xarthurx commented 9 years ago

When using command: doi-utils-add-bibtex-entry-from-doi, the minibuffer tells:

Mandatory field 'journaltitle' is missing

And no notes is created...

jkitchin commented 9 years ago

What doi are you trying this on?

jkitchin commented 9 years ago

Also, does anything get put into the bibtex file? If so, what?

xarthurx commented 9 years ago

Trying: 10.1680/coma.12.00033 I also tried the other DOIs, same problem... There is nothing in the bibtex file, I just start to build my bib from scratch.

xarthurx commented 9 years ago

The commend do put things in the bib file, but only that file. The contents got put is:

@article{rippmann-2013-rethin-struc-mason, author = {Matthias Rippmann and Philippe Block}, title = {Rethinking Structural Masonry: Unreinforced, Stone-Cut Shells}, journal = {Proceedings of the ICE - Construction Materials}, volume = {166}, number = {6}, pages = {378-389}, year = {2013}, doi = {10.1680/coma.12.00033}, url = {http://dx.doi.org/10.1680/coma.12.00033}, date_added = {Sun May 31 23:30:41 2015}, }

xarthurx commented 9 years ago

I think it might be some problem that certain commands got the "journal" but still try to get the "journaltitle".

jkitchin commented 9 years ago

hm.. I cannot reproduce your error. I get the right behavior when I try that. There is only one place where journaltitle is used, and that is only after the journal field is not found. How current is your org-ref version?

xarthurx commented 9 years ago

I downloaded it from github this week, so it should be the newest version.

On 1 June 2015 at 01:47, John Kitchin notifications@github.com wrote:

hm.. I cannot reproduce your error. I get the right behavior when I try that. There is only one place where journaltitle is used, and that is only after the journal field is not found. How current is your org-ref version?

— Reply to this email directly or view it on GitHub https://github.com/jkitchin/org-ref/issues/40#issuecomment-107257698.

MA Zhao

"SAVE PAPER - PLEASE THINK BEFORE YOU PRINT!"

xarthurx commented 9 years ago

The whole debug file:

Debugger entered--Lisp error: (error "Mandatory field journaltitle' is missing") signal(error ("Mandatory fieldjournaltitle' is missing")) error("Mandatory field `%s' is missing" "journaltitle") bibtex-format-entry() bibtex-clean-entry() (cond ((string= (downcase type) "article") (bibtex-kill-entry) (insert (concat "@article{" key ",\n" (mapconcat (function (lambda (field) (if ... ...))) master "\n") (mapconcat (function (lambda (field) (format "%s = %s," ... ...))) other-fields "\n") "\n}\n\n")) (bibtex-find-entry key) (bibtex-fill-entry) (bibtex-clean-entry))) (let* ((master (quote ("author" "title" "journal" "volume" "number" "pages" "year" "doi" "url"))) (entry (bibtex-parse-entry)) (entry-fields) (other-fields) (type (cdr (assoc "=type=" entry))) (key (cdr (assoc "=key=" entry)))) (setq entry-fields (mapcar (function (lambda (x) (car x))) entry)) (setq entry-fields (remove "=key=" entry-fields)) (setq entry-fields (remove "=type=" entry-fields)) (setq other-fields (remove-if-not (function (lambda (x) (not (member x master)))) entry-fields)) (cond ((string= (downcase type) "article") (bibtex-kill-entry) (insert (concat "@article{" key ",\n" (mapconcat (function (lambda ... ...)) master "\n") (mapconcat (function (lambda ... ...)) other-fields "\n") "\n}\n\n")) (bibtex-find-entry key) (bibtex-fill-entry) (bibtex-clean-entry)))) org-ref-sort-bibtex-entry() (let ((entry (bibtex-parse-entry)) (pages (bibtex-autokey-get-field "pages")) (year (bibtex-autokey-get-field "year")) (doi (bibtex-autokey-get-field "doi")) (eid (bibtex-autokey-get-field "eid"))) (if (string-match "^http://dx.doi.org/" doi) (progn (bibtex-beginning-of-entry) (goto-char (car (cdr (bibtex-search-forward-field "doi" t)))) (bibtex-kill-field) (bibtex-make-field "doi") (backward-char) (insert (replace-regexp-in-string "^http://dx.doi.org/" "" doi)))) (if (string= "0" year) (progn (bibtex-beginning-of-entry) (goto-char (car (cdr (bibtex-search-forward-field "year" t)))) (bibtex-kill-field) (bibtex-make-field "year") (backward-char) (insert (read-string "Enter year: ")))) (if (string= "-" pages) (progn (if eid (progn (bibtex-beginning-of-entry) (goto-char (car (cdr ...))) (bibtex-kill-field) (bibtex-make-field "pages") (backward-char) (insert eid))))) (save-restriction (bibtex-narrow-to-entry) (bibtex-beginning-of-entry) (message "checking &") (replace-regexp " & " " \& ") (widen)) (if keep-key nil (let ((key (bibtex-generate-autokey))) (bibtex-beginning-of-entry) (re-search-forward bibtex-entry-maybe-empty-head) (if (match-beginning bibtex-key-in-head) (delete-region (match-beginning bibtex-key-in-head) (match-end bibtex-key-in-head))) (if (save-excursion (bibtex-search-entry key)) (progn (save-excursion (bibtex-search-entry key) (bibtex-copy-entry-as-kill) (switch-to-buffer-other-window "duplicate entry") (bibtex-yank)) (setq key (bibtex-read-key "Duplicate Key found, edit: " key)))) (insert key) (kill-new key))) (mapcar (function (lambda (x) (save-restriction (save-excursion (funcall x))))) org-ref-clean-bibtex-entry-hook) (org-ref-sort-bibtex-entry) (occur "[^[:ascii:]]")) org-ref-clean-bibtex-entry() (if (bibtex-key-in-head nil) (org-ref-clean-bibtex-entry t) (org-ref-clean-bibtex-entry)) doi-utils-insert-bibtex-entry-from-doi("10.1680/coma.12.00033") (if (search-forward doi nil t) (message "%s is already in this file" doi) (end-of-buffer) (insert "\n\n") (doi-utils-insert-bibtex-entry-from-doi doi) (save-buffer)) (save-current-buffer (set-buffer (find-file-noselect bibfile)) (goto-char (point-min)) (if (search-forward doi nil t) (message "%s is already in this file" doi) (end-of-buffer) (insert "\n\n") (doi-utils-insert-bibtex-entry-from-doi doi) (save-buffer))) (progn (save-current-buffer (set-buffer (find-file-noselect bibfile)) (goto-char (point-min)) (if (search-forward doi nil t) (message "%s is already in this file" doi) (end-of-buffer) (insert "\n\n") (doi-utils-insert-bibtex-entry-from-doi doi) (save-buffer)))) (unwind-protect (progn (save-current-buffer (set-buffer (find-file-noselect bibfile)) (goto-char (point-min)) (if (search-forward doi nil t) (message "%s is already in this file" doi) (end-of-buffer) (insert "\n\n") (doi-utils-insert-bibtex-entry-from-doi doi) (save-buffer)))) (set-window-configuration wconfig)) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (save-current-buffer (set-buffer (find-file-noselect bibfile)) (goto-char (point-min)) (if (search-forward doi nil t) (message "%s is already in this file" doi) (end-of-buffer) (insert "\n\n") (doi-utils-insert-bibtex-entry-from-doi doi) (save-buffer)))) (set-window-configuration wconfig))) doi-utils-add-bibtex-entry-from-doi("10.1680/coma.12.00033" "/cygdrive/d/Documents/Dropbox (Personal)/Papers/bibliography/references.bib") call-interactively(doi-utils-add-bibtex-entry-from-doi record nil) command-execute(doi-utils-add-bibtex-entry-from-doi record) execute-extended-command(nil "doi-utils-add-bibtex-entry-from-doi") smex-read-and-run(("doi-utils-add-bibtex-entry-from-doi" "list-packages" "package-install" "org-ref-clean-bibtex-entry" "doi-utils-add-entry-from-crossref-query" "eval-buffer" "org-ref-cite-hydra/body" "eval-expression" "cd" "jb" "5x5" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "orc" "orn" "oro" "orp" "oru" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "ebib" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "mail" "mpuz" "orcb" "orib" "oric" "orir" "ornr" ...)) smex() call-interactively(smex nil nil) command-execute(smex)

xarthurx commented 9 years ago

I saw: (bibtex-set-dialect 'biblatex)

And in the documentation of biblatex, it says "journaltitle" is a required field.

Maybe this is the cause?

xarthurx commented 9 years ago

I comment that line out in my settings, then everything is fine.

jkitchin commented 9 years ago

Where do you see (bibtex-set-dialect 'biblatex)?

Your problem is not coming from org-ref/doi-utils directly, but in bibtex-format-entry, which is evidently expecting your bib file to be in biblatex compatible form, where journaltitle is required for articles.

xarthurx commented 9 years ago

Under bibtex settings.

Yes, sorry about that.

On 1 June 2015 at 14:40, John Kitchin notifications@github.com wrote:

Where do you see (bibtex-set-dialect 'biblatex)?

Your problem is not coming from org-ref/doi-utils directly, but in bibtex-format-entry, which is evidently expecting your bib file to be in biblatex compatible form, where journaltitle is required for articles.

— Reply to this email directly or view it on GitHub https://github.com/jkitchin/org-ref/issues/40#issuecomment-107426990.

MA Zhao

"SAVE PAPER - PLEASE THINK BEFORE YOU PRINT!"