I am using the following setting to get bibtex entries from doi. There are two issues in my setting.
One is the entry name. For example, I can get the following entry from doi. The entry name becomes 2023
. I want to change e.g., Lei_2023
. That is, "First name of the first author
+_
+year
".
Another is about pages. The following entry yields a weird expression on-page information after the latex compilation. Once I delete the -
and retype -
on my setting utf-8
, I can fix it. I want to remove the retype process.
https://www.anghyflawn.net/blog/2014/emacs-give-a-doi-get-a-bibtex-entry/
(defun get-bibtex-from-doi (doi)
"Get a BibTeX entry from the DOI"
(interactive "MDOI: ")
(let ((url-mime-accept-string "text/bibliography;style=bibtex"))
(with-current-buffer
(url-retrieve-synchronously
(format "http://dx.doi.org/%s"
(replace-regexp-in-string "http://dx.doi.org/" "" doi)))
(switch-to-buffer (current-buffer))
(goto-char (point-max))
(setq bibtex-entry
(buffer-substring
(string-match "@" (buffer-string))
(point)))
(kill-buffer (current-buffer))))
(insert (decode-coding-string bibtex-entry 'utf-8))
(bibtex-fill-entry))
@article{2023,
title = {Co-benefits of carbon neutrality in enhancing and
stabilizing solar and wind energy},
volume = {13},
ISSN = {1758-6798},
url = {http://dx.doi.org/10.1038/s41558-023-01692-7},
DOI = {10.1038/s41558-023-01692-7},
number = {7},
journal = {Nature Climate Change},
publisher = {Springer Science and Business Media LLC},
author = {Lei, Yadong and Wang, Zhili and Wang, Deying and
Zhang, Xiaoye and Che, Huizheng and Yue, Xu and
Tian, Chenguang and Zhong, Junting and Guo, Lifeng
and Li, Lei and Zhou, Hao and Liu, Lin and Xu,
Yangyang},
year = {2023},
month = {Jun},
pages = {693–700}
}