The first thing we need is a list of all the citation links, in the order cited. Here they are.
(mapcar
(lambda (link) (org-element-property :path link))
(loop for link in (org-element-map (org-element-parse-buffer) 'link 'identity)
if (-contains? org-ref-cite-types (org-element-property :type link))
collect link))
kitchin-2015-examp,kitchin-2015-data-surfac-scien |
xu-2015-tunin-oxide,mehta-2014-ident-poten,curnan-2014-effec-concen |
hallenbeck-2013-effec-o2 |
miller-2014-simul-temper,boes-2015-estim-bulk |
kitchin-2015-examp |
kitchin-2015-data-surfac-scien |
boes-2015-estim-bulk |
Now, we need to compute replacements for each citation link, and construct the bibliography. We will make a numbered, unsorted bibliography, and we want to replace each citation with the corresponding numbers, hyperlinked to the entry.
We start with a list of the keys in the order cited, and a number we will use for each one.
(loop for i from 1
for key in (org-ref-get-bibtex-keys)
collect (list key i))
kitchin-2015-examp |
1 |
kitchin-2015-data-surfac-scien |
2 |
xu-2015-tunin-oxide |
3 |
mehta-2014-ident-poten |
4 |
curnan-2014-effec-concen |
5 |
hallenbeck-2013-effec-o2 |
6 |
miller-2014-simul-temper |
7 |
boes-2015-estim-bulk |
8 |
Now, we need to compute replacements for each cite link. This will be replacing each key with the number above. We will return a list of ((start end) . "replacement text") that we can use to replace each link. For fun, we make these superscripted html.
(let ((links (loop for link in (org-element-map (org-element-parse-buffer) 'link 'identity)
if (-contains? org-ref-cite-types (org-element-property :type link))
collect link))
(replacements (loop for i from 1
for key in (org-ref-get-bibtex-keys)
collect (list key (number-to-string i)))))
(loop for link in links
collect (let ((path (org-element-property :path link)))
(dolist (repl replacements)
(setq path (replace-regexp-in-string (car repl) (nth 1 repl) path)))
(list (org-element-property :begin link)
(org-element-property :end link)
(format "<sup>%s</sup>" path)))))
950 |
1004 |
<sup>1,2</sup> |
1073 |
1145 |
<sup>3,4,5</sup> |
1160 |
1190 |
<sup>6</sup> |
1236 |
1286 |
<sup>7,8</sup> |
1364 |
1388 |
<sup>1</sup> |
1392 |
1427 |
<sup>2</sup> |
4091 |
4117 |
<sup>8</sup> |
We also need to compute the bibliography for each key. We will use org-ref-reftex-format-citation to do this. For that we need the parsed bibtex entries, and a format string. org-ref provides most of this.
(setq org-ref-bibliography-entry-format
'(("article" . "<li>%a, %t, <i>%j</i>, <b>%v(%n)</b>, %p (%y). <a href=\"%U\">link</a>. <a href=\"https://doi.org/%D\">doi</a>.</li>")
("book" . "<li>%a, %t, %u (%y).</li>")))
(concat "<h1>Bibliography</h1><br><ol>"
(mapconcat
'identity
(loop for key in (org-ref-get-bibtex-keys)
collect
(let* ((result (org-ref-get-bibtex-key-and-file key))
(bibfile (cdr result))
(entry (save-excursion
(with-temp-buffer
(insert-file-contents bibfile)
(bibtex-set-dialect (parsebib-find-bibtex-dialect) t)
(bibtex-search-entry key)
(bibtex-parse-entry)))))
(org-ref-reftex-format-citation
entry
(cdr (assoc (cdr (assoc "=type=" entry))
org-ref-bibliography-entry-format)))))
"")
"</ol>")
Bibliography
- Kitchin, Examples of Effective Data Sharing in Scientific Publishing, {ACS Catalysis}, 5(6), 3894-3899 (2015). link. doi.
- "John Kitchin", Data Sharing in Surface Science, "Surface Science ", (0), - (2015). link. doi.
- Zhongnan Xu \& John R Kitchin, Tuning Oxide Activity Through Modification of the Crystal and Electronic Structure: From Strain To Potential Polymorphs, {Phys. Chem. Chem. Phys.}, 17(), 28943-28949 (2015). link. doi.
- Prateek Mehta, Paul Salvador \& John Kitchin, Identifying Potential BO2 Oxide Polymorphs for Epitaxial Growth Candidates, {ACS Appl. Mater. Interfaces}, 6(5), 3630-3639 (2014). link. doi.
- Curnan \& Kitchin, Effects of Concentration, Crystal Structure, Magnetism, and Electronic Structure Method on First-Principles Oxygen Vacancy Formation Energy Trends in Perovskites, {The Journal of Physical Chemistry C}, 118(49), 28776-28790 (2014). link. doi.
- "Hallenbeck \& Kitchin, Effects of O2 and SO2 on the Capture Capacity of a Primary-Amine Based Polymeric CO2 Sorbent, "Industrial \& Engineering Chemistry Research", 52(31), 10788-10794 (2013). link. doi.
- Spencer Miller, Vladimir Pushkarev, Andrew, Gellman \& John Kitchin, Simulating Temperature Programmed Desorption of Oxygen on Pt(111) Using DFT Derived Coverage Dependent Desorption Barriers, {Topics in Catalysis}, 57(1-4), 106-117 (2014). link. doi.
- Jacob Boes, Gamze Gumuslu, James Miller, Andrew, Gellman \& John Kitchin, Estimating Bulk-Composition-Dependent H2 Adsorption Energies on CuxPd1-x Alloy (111) Surfaces, {ACS Catalysis}, 5(), 1020-1026 (2015). link. doi.