<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <atom:link href="http://kitchingroup.cheme.cmu.edu/blog/feed/index.xml" rel="self" type="application/rss+xml" />
    <title>The Kitchin Research Group</title>
    <link>https://kitchingroup.cheme.cmu.edu/blog</link>
    <description>Chemical Engineering at Carnegie Mellon University</description>
    <pubDate>Sat, 01 Nov 2025 13:47:46 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    
    <item>
      <title>10 years ago - org mode is awesome video</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2024/07/04/10-years-ago-org-mode-is-awesome-video</link>
      <pubDate>Thu, 04 Jul 2024 07:52:26 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <guid isPermaLink="false">satKzsj20KTdCZO_E3SMztghNgI=</guid>
      <description>10 years ago - org mode is awesome video</description>
      <content:encoded><![CDATA[


&lt;p&gt;
Ten years ago I posted a video on YouTube titled "org mode is awesome". This 18 minute video was a tour of features in org-mode that ranged included, outlining, task management, agendas, tables, code, exporting to different formats, and extendability. That video has been viewed 92.9K times!
&lt;/p&gt;

&lt;iframe width="560" height="315" src="https://www.youtube.com/embed/fgizHHd7nOo?si=YtXo7_4jyxQh90AG" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;
A fair bit has changed since then, and a lot has stayed the same. org-mode is even more awesome! That video was made with what I called at the time &lt;code&gt;jmax&lt;/code&gt;, and that has evolved into &lt;code&gt;scimax&lt;/code&gt; today. I use &lt;code&gt;scimax&lt;/code&gt; on a daily basis in my research, teaching and other work. It is as important in my work today as it was 10 years ago, and has survived watching other editors come and go.
&lt;/p&gt;

&lt;p&gt;
I have had in mind to make an update of that video, but it has in my opinion really stood the test of time and is still highly relevant in its present form. The only thing that would really change is the background and font colors. 
&lt;/p&gt;

&lt;p&gt;
I have made over 200 other YouTube videos over that time, and many of them are on using Emacs and org-mode in a lot of different ways. These videos are organized in these playlists:
&lt;/p&gt;

&lt;dl class="org-dl"&gt;
&lt;dt&gt;&lt;a href="https://www.youtube.com/playlist?list=PL0sMmOaE_gs1Ox-wIIbHPLZ9O5uLJ_rQW"&gt;scimax-eln&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;Using scimax as an electronic lab notebook.&lt;/dd&gt;
&lt;dt&gt;&lt;a href="https://www.youtube.com/playlist?list=PL0sMmOaE_gs3E0OjExoI7vlCAVygj6S4I"&gt;scimax&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;Videos on libraries I developed in scimax, including org-ref&lt;/dd&gt;
&lt;dt&gt;&lt;a href="https://www.youtube.com/playlist?list=PL0sMmOaE_gs3GbuZV_sNjwMREw9rfElTV"&gt;org-mode&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;Videos exploring features in org-mode&lt;/dd&gt;
&lt;dt&gt;&lt;a href="https://www.youtube.com/playlist?list=PL0sMmOaE_gs2yzwy54kLZk5c1ZH-Nh-62"&gt;pycse&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;Videos on using Python in Emacs to solve engineering and science problems&lt;/dd&gt;
&lt;/dl&gt;

&lt;p&gt;
You can see how &lt;code&gt;scimax&lt;/code&gt; has evolved, and continues to evolve over this time through these videos, and of course through the &lt;code&gt;scimax&lt;/code&gt; repo at &lt;a href="https://github.com/jkitchin/scimax"&gt;https://github.com/jkitchin/scimax&lt;/a&gt;. There are still great things coming for &lt;code&gt;scimax&lt;/code&gt;, stay tuned!
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2024 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;
&lt;p&gt;&lt;a href="/org/2024/07/04/10-years-ago---org-mode-is-awesome-video.org"&gt;org-mode source&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Org-mode version = 9.7.5&lt;/p&gt;]]></content:encoded>
    </item>
    <item>
      <title>Exporting numbered citations in html with unsorted numbered bibliography</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2015/12/03/Exporting-numbered-citations-in-html-with-unsorted-numbered-bibliography</link>
      <pubDate>Thu, 03 Dec 2015 15:53:08 EST</pubDate>
      <category><![CDATA[org-mode]]></category>
      <guid isPermaLink="false">ERnp1KvwLx2fwXVPyZVYbRQvpeg=</guid>
      <description>Exporting numbered citations in html with unsorted numbered bibliography</description>
      <content:encoded><![CDATA[



&lt;p&gt;
In this &lt;a href="http://kitchingroup.cheme.cmu.edu/blog/2014/05/17/Exporting-citations-in-html/"&gt;post&lt;/a&gt; we illustrated a simple export of org-ref citations to html. This was a simple export that simply replaced each citation with a hyperlink as defined in the export function for each type of link. Today we look at formatting in text citations with superscripted numbers, and having an unsorted (i.e. in order of citation) numbered bibliography. This will take one pass to get the citations and calculate replacements and the bibliography, and one pass to replace them and insert the bibliography.
&lt;/p&gt;

&lt;p&gt;
This text is just some text with somewhat random citations in it for seeing it work. You might like my two data sharing articles &lt;sup&gt;&lt;a href="#kitchin-2015-examp"&gt;1&lt;/a&gt;,&lt;a href="#kitchin-2015-data-surfac-scien"&gt;2&lt;/a&gt;&lt;/sup&gt;. We illustrate the use of org-mode in publishing computational work &lt;sup&gt;&lt;a href="#xu-2015-tunin-oxide"&gt;3&lt;/a&gt;,&lt;a href="#mehta-2014-ident-poten"&gt;4&lt;/a&gt;,&lt;a href="#curnan-2014-effec-concen"&gt;5&lt;/a&gt;&lt;/sup&gt;, experimental &lt;sup&gt;&lt;a href="#hallenbeck-2013-effec-o2"&gt;6&lt;/a&gt;&lt;/sup&gt;and mixed computational and experimental work &lt;sup&gt;&lt;a href="#miller-2014-simul-temper"&gt;7&lt;/a&gt;,&lt;a href="#boes-2015-estim-bulk"&gt;8&lt;/a&gt;&lt;/sup&gt;. This example will correctly number multiple references to a citation, e.g.  &lt;sup&gt;&lt;a href="#kitchin-2015-examp"&gt;1&lt;/a&gt;&lt;/sup&gt;and &lt;sup&gt;&lt;a href="#kitchin-2015-data-surfac-scien"&gt;2&lt;/a&gt;&lt;/sup&gt;.
&lt;/p&gt;

&lt;p&gt;
This post is somewhat long, and the way I worked it out is at the end (&lt;a href="#sec-2"&gt;Long appendix illustrating how we got the code to work&lt;/a&gt;). The short version is that we do some preprocessing to get the citations in the document, calculate replacement values for them and the bibliography, replace them in the org-buffer &lt;i&gt;before&lt;/i&gt; the export in the backend (html) format we want, and then conclude with the export. This is proof of concept work.
&lt;/p&gt;

&lt;p&gt;
The main issues you can see are:
&lt;/p&gt;
&lt;ol class="org-ol"&gt;
&lt;li&gt;Our formatting code is very rudimentary, and relies on reftex. It is not as good as bibtex, or presumably some citation processor. Major improvements would require abandoning the reftex approach to use something that builds up the bibliography entry, allows modification of author names, and accomodates missing information gracefully.
&lt;/li&gt;
&lt;li&gt;The bibliography contents reflect the contents of my bibtex file, which is LaTeX compatible. We could clean it up more, by either post-processing to remove some things like escaped &amp;amp;, or by breaking compatibility with LaTeX.
&lt;/li&gt;
&lt;li&gt;The intext citations could use some fine tuning on spaces, e.g. to remove trailing spaces after words, or to move superscripts to the right of punctuation, or to adjust spaces after some citations.
&lt;/li&gt;
&lt;li&gt;Changing the bibliography style for each entry amounts to changing a variable for the bibliography. We have to modify a function to change the intext citation style, e.g. to brackets, or (author year).
&lt;/li&gt;
&lt;li&gt;I stuck with only cite links here, and only articles and books. It would not get a citenum format correct, e.g. it should not be superscripted in this case, or a citeauthor format correct. That would require some code in the replacement section that knows how to replace different types of citations.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
The  org-ref-unsrt-html-processor function could be broken up more, and could take some parameters to fine-tune some of these things, and generalize some things like getting the citation elements for the buffer. Overall, I think this shows that citations in org-mode with org-ref are actually pretty flexible. It is not as good as bibtex/LaTeX, and won't be for an unforseeably long time unless someone really needs high quality citations in a format other than LaTeX. Note for LaTeX export, we don't have to do any preprocessing at all. If you wanted to try Word export, you might make a pandoc processor that replaces everything in pandoc citation syntax, and then use pandoc for the conversion. If you didn't care to use the bibtex database for anything else, you could just use backend specific markup to make it exactly right for your output. I did this in reference &lt;sup&gt;&lt;a href="#boes-2015-estim-bulk"&gt;8&lt;/a&gt;&lt;/sup&gt;where you can see the chemical formulas are properly subscripted.
&lt;/p&gt;

&lt;p&gt;
If you would like to see the bibtex file used for this you can get it here: &lt;a href="/media/numbered.bib"&gt;numbered.bib&lt;/a&gt;
&lt;/p&gt;



&lt;h1&gt;Bibliography&lt;/h1&gt;&lt;ol&gt;&lt;li&gt;&lt;a name="kitchin-2015-examp"&gt;&lt;/a&gt;Kitchin, Examples of Effective Data Sharing in Scientific Publishing, &lt;i&gt;ACS Catalysis&lt;/i&gt;, &lt;b&gt;5(6)&lt;/b&gt;, 3894-3899 (2015). &lt;a href=" https://doi.org/10.1021/acscatal.5b00538 "&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/acscatal.5b00538"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="kitchin-2015-data-surfac-scien"&gt;&lt;/a&gt;John Kitchin, Data Sharing in Surface Science, &lt;i&gt;Surface Science &lt;/i&gt;, &lt;b&gt;(0)&lt;/b&gt;,  -  (2015). &lt;a href="http://www.sciencedirect.com/science/article/pii/S0039602815001326"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1016/j.susc.2015.05.007"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="xu-2015-tunin-oxide"&gt;&lt;/a&gt;Zhongnan Xu &amp; John R Kitchin, Tuning Oxide Activity Through Modification of the Crystal and  Electronic Structure: From Strain To Potential Polymorphs, &lt;i&gt;Phys. Chem. Chem. Phys.&lt;/i&gt;, &lt;b&gt;17()&lt;/b&gt;, 28943-28949 (2015). &lt;a href="https://doi.org/10.1039/C5CP04840K"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1039/c5cp04840k"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="mehta-2014-ident-poten"&gt;&lt;/a&gt;Prateek Mehta, Paul Salvador &amp; John Kitchin, Identifying Potential BO2 Oxide Polymorphs for Epitaxial  Growth Candidates, &lt;i&gt;ACS Appl. Mater. Interfaces&lt;/i&gt;, &lt;b&gt;6(5)&lt;/b&gt;, 3630-3639 (2014). &lt;a href="https://doi.org/10.1021/am4059149"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/am4059149"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="curnan-2014-effec-concen"&gt;&lt;/a&gt;Curnan &amp; Kitchin, Effects of Concentration, Crystal Structure, Magnetism, and  Electronic Structure Method on First-Principles Oxygen Vacancy  Formation Energy Trends in Perovskites, &lt;i&gt;The Journal of Physical Chemistry C&lt;/i&gt;, &lt;b&gt;118(49)&lt;/b&gt;, 28776-28790 (2014). &lt;a href="https://doi.org/10.1021/jp507957n"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/jp507957n"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="hallenbeck-2013-effec-o2"&gt;&lt;/a&gt;Hallenbeck &amp; Kitchin, Effects of O2 and SO2 on the Capture Capacity of a  Primary-Amine Based Polymeric CO2 Sorbent, &lt;i&gt;Industrial &amp; Engineering Chemistry Research&lt;/i&gt;, &lt;b&gt;52(31)&lt;/b&gt;, 10788-10794 (2013). &lt;a href="http://pubs.acs.org/doi/abs/10.1021/ie400582a"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/ie400582a"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="miller-2014-simul-temper"&gt;&lt;/a&gt;Spencer Miller, Vladimir Pushkarev, Andrew, Gellman &amp; John Kitchin, Simulating Temperature Programmed Desorption of Oxygen on  Pt(111) Using DFT Derived Coverage Dependent Desorption  Barriers, &lt;i&gt;Topics in Catalysis&lt;/i&gt;, &lt;b&gt;57(1-4)&lt;/b&gt;, 106-117 (2014). &lt;a href="https://doi.org/10.1007/s11244-013-0166-3"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1007/s11244-013-0166-3"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a name="boes-2015-estim-bulk"&gt;&lt;/a&gt;Jacob Boes, Gamze Gumuslu, James Miller, Andrew, Gellman &amp; John Kitchin, Estimating Bulk-Composition-Dependent H&lt;sub&gt;2&lt;/sub&gt; Adsorption Energies  on Cu&lt;sub&gt;x&lt;/sub&gt;Pd&lt;sub&gt;1-x&lt;/sub&gt; Alloy (111) Surfaces, &lt;i&gt;ACS Catalysis&lt;/i&gt;, &lt;b&gt;5()&lt;/b&gt;, 1020-1026 (2015). &lt;a href="https://doi.org/10.1021/cs501585k"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/cs501585k"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;

&lt;div id="outline-container-sec-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; The working code&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;p&gt;
Here is a function to process the org file prior parsing during the export process. This function goes into org-export-before-parsing-hook, and takes one argument, the backend. We simply replace all the citation links with formatted HTML snippets or blocks. If the snippets get longer than a line, it will break.
&lt;/p&gt;

&lt;p&gt;
We use org-ref-reftex-format-citation to generate the bibliography, which uses reftex to format a string with escape characters in it.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; org-ref-bibliography-entry-format
      '((&lt;span style="color: #008000;"&gt;"article"&lt;/span&gt; . &lt;span style="color: #008000;"&gt;"&amp;lt;li&amp;gt;&amp;lt;a name=\"\%k\"&amp;gt;&amp;lt;/a&amp;gt;%a, %t, &amp;lt;i&amp;gt;%j&amp;lt;/i&amp;gt;, &amp;lt;b&amp;gt;%v(%n)&amp;lt;/b&amp;gt;, %p (%y). &amp;lt;a href=\"%U\"&amp;gt;link&amp;lt;/a&amp;gt;. &amp;lt;a href=\"https://doi.org/%D\"&amp;gt;doi&amp;lt;/a&amp;gt;.&amp;lt;/li&amp;gt;"&lt;/span&gt;)
        (&lt;span style="color: #008000;"&gt;"book"&lt;/span&gt; . &lt;span style="color: #008000;"&gt;"&amp;lt;li&amp;gt;&amp;lt;a name=\"\%k\"&amp;gt;&amp;lt;/a&amp;gt;%a, %t, %u (%y).&amp;lt;/li&amp;gt;"&lt;/span&gt;)))

(&lt;span style="color: #0000FF;"&gt;defun&lt;/span&gt; &lt;span style="color: #006699;"&gt;org-ref-unsrt-latex-processor&lt;/span&gt; () nil)
(&lt;span style="color: #0000FF;"&gt;defun&lt;/span&gt; &lt;span style="color: #006699;"&gt;org-ref-unsrt-html-processor&lt;/span&gt; ()
  &lt;span style="color: #036A07;"&gt;"Citation processor function for the unsrt style with html output."&lt;/span&gt;
  (&lt;span style="color: #0000FF;"&gt;let&lt;/span&gt; (links
        unique-keys numbered-keys
        replacements
        bibliography-link
        bibliographystyle-link
        bibliography)
    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;step 1 - get the citation links&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; links (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in (org-element-map
                                      (org-element-parse-buffer) 'link 'identity)
                      if (-contains?
                          org-ref-cite-types
                          (org-element-property &lt;span style="color: #006FE0;"&gt;:type&lt;/span&gt; link))
                      collect link))

    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;list of unique numbered keys. '((key number))&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; unique-keys (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for i from 1
                            for key in (org-ref-get-bibtex-keys)
                            collect (list key (number-to-string i))))


    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;(start end replacement-text)&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; replacements
          (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in links
                collect
                (&lt;span style="color: #0000FF;"&gt;let&lt;/span&gt; ((path (org-element-property &lt;span style="color: #006FE0;"&gt;:path&lt;/span&gt; link)))
                  (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for (key number) in unique-keys
                        do
                        (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt;
                         path
                         (replace-regexp-in-string
                          key (format &lt;span style="color: #008000;"&gt;"&amp;lt;a href=\"#%s\"&amp;gt;%s&amp;lt;/a&amp;gt;"&lt;/span&gt; key number)
                          path)))
                  (list (org-element-property &lt;span style="color: #006FE0;"&gt;:begin&lt;/span&gt; link)
                        (org-element-property &lt;span style="color: #006FE0;"&gt;:end&lt;/span&gt; link)
                        (format &lt;span style="color: #008000;"&gt;"@@html:&amp;lt;sup&amp;gt;%s&amp;lt;/sup&amp;gt;@@"&lt;/span&gt; path)))))

    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;construct the bibliography string&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; bibliography
          (concat &lt;span style="color: #008000;"&gt;"#+begin_html&lt;/span&gt;
&lt;span style="color: #008000;"&gt;&amp;lt;h1&amp;gt;Bibliography&amp;lt;/h1&amp;gt;&amp;lt;ol&amp;gt;"&lt;/span&gt;
                  (mapconcat
                   'identity
                   (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for (key number) in unique-keys
                         collect
                         (&lt;span style="color: #0000FF;"&gt;let*&lt;/span&gt; ((result (org-ref-get-bibtex-key-and-file key))
                                (bibfile (cdr result))
                                (entry (&lt;span style="color: #0000FF;"&gt;save-excursion&lt;/span&gt;
                                         (&lt;span style="color: #0000FF;"&gt;with-temp-buffer&lt;/span&gt;
                                           (insert-file-contents bibfile)
                                           (bibtex-set-dialect
                                            (parsebib-find-bibtex-dialect) t)
                                           (bibtex-search-entry key)
                                           (bibtex-parse-entry t)))))
                           &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;remove escaped &amp;amp; in the strings&lt;/span&gt;
                           (replace-regexp-in-string &lt;span style="color: #008000;"&gt;"\\\\&amp;amp;"&lt;/span&gt; &lt;span style="color: #008000;"&gt;"&amp;amp;"&lt;/span&gt;
                                           (org-ref-reftex-format-citation
                                            entry
                                            (cdr (assoc (cdr (assoc &lt;span style="color: #008000;"&gt;"=type="&lt;/span&gt; entry))
                                                        org-ref-bibliography-entry-format))))))
                   &lt;span style="color: #008000;"&gt;""&lt;/span&gt;)
                  &lt;span style="color: #008000;"&gt;"&amp;lt;/ol&amp;gt;&lt;/span&gt;
&lt;span style="color: #008000;"&gt;#+end_html"&lt;/span&gt;))

    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;now, we need to replace each citation. We do that in reverse order so the&lt;/span&gt;
    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;positions do not change.&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for (start end replacement) in (reverse replacements)
          do
          (&lt;span style="color: #0000FF;"&gt;setf&lt;/span&gt; (buffer-substring start end) replacement))

    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;Eliminate bibliography style links&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in (org-element-map
                          (org-element-parse-buffer) 'link 'identity)
          if (string= &lt;span style="color: #008000;"&gt;"bibliographystyle"&lt;/span&gt;
                      (org-element-property &lt;span style="color: #006FE0;"&gt;:type&lt;/span&gt; link))
          do
          (&lt;span style="color: #0000FF;"&gt;setf&lt;/span&gt; (buffer-substring (org-element-property &lt;span style="color: #006FE0;"&gt;:begin&lt;/span&gt; link)
                                  (org-element-property &lt;span style="color: #006FE0;"&gt;:end&lt;/span&gt; link))
                &lt;span style="color: #008000;"&gt;""&lt;/span&gt;))

    &lt;span style="color: #8D8D84;"&gt;;; &lt;/span&gt;&lt;span style="color: #8D8D84; font-style: italic;"&gt;replace the bibliography link with the bibliography text&lt;/span&gt;
    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; bibliography-link (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in (org-element-map
                                                  (org-element-parse-buffer) 'link 'identity)
                                  if (string= &lt;span style="color: #008000;"&gt;"bibliography"&lt;/span&gt;
                                              (org-element-property &lt;span style="color: #006FE0;"&gt;:type&lt;/span&gt; link))
                                  collect link))
    (&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt; (&amp;gt; (length bibliography-link) 1)
        (&lt;span style="color: #ff0000; font-weight: bold;"&gt;error&lt;/span&gt; &lt;span style="color: #008000;"&gt;"Only one bibliography link allowed"&lt;/span&gt;))

    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; bibliography-link (car bibliography-link))
    (&lt;span style="color: #0000FF;"&gt;setf&lt;/span&gt; (buffer-substring (org-element-property &lt;span style="color: #006FE0;"&gt;:begin&lt;/span&gt; bibliography-link)
                            (org-element-property &lt;span style="color: #006FE0;"&gt;:end&lt;/span&gt; bibliography-link))
          bibliography)))


(&lt;span style="color: #0000FF;"&gt;defun&lt;/span&gt; &lt;span style="color: #006699;"&gt;org-ref-citation-processor&lt;/span&gt; (backend)
  &lt;span style="color: #036A07;"&gt;"Figure out what to call and call it"&lt;/span&gt;
  (&lt;span style="color: #0000FF;"&gt;let&lt;/span&gt; (bibliographystyle)
    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt;
     bibliographystyle
     (org-element-property
      &lt;span style="color: #006FE0;"&gt;:path&lt;/span&gt; (car
             (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in
                   (org-element-map
                       (org-element-parse-buffer) 'link 'identity)
                   if (string= &lt;span style="color: #008000;"&gt;"bibliographystyle"&lt;/span&gt;
                               (org-element-property &lt;span style="color: #006FE0;"&gt;:type&lt;/span&gt; link))
                   collect link))))
    (funcall (intern (format &lt;span style="color: #008000;"&gt;"org-ref-%s-%s-processor"&lt;/span&gt; bibliographystyle backend)))))

(add-hook 'org-export-before-parsing-hook 'org-ref-citation-processor)

(browse-url (org-html-export-to-html))
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
#&amp;lt;process open ./blog.html&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;


&lt;div id="outline-container-sec-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;&lt;a id="ID-1D63E1FB-55CD-48B7-B5E1-D0AC5E4D989B" name="ID-1D63E1FB-55CD-48B7-B5E1-D0AC5E4D989B"&gt;&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Long appendix illustrating how we got the code to work&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;
&lt;p&gt;
The first thing we need is a list of all the citation links, in the order cited. Here they are.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(mapcar
 (&lt;span style="color: #0000FF;"&gt;lambda&lt;/span&gt; (link) (org-element-property &lt;span style="color: #006FE0;"&gt;:path&lt;/span&gt; link))
 (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in (org-element-map (org-element-parse-buffer) 'link 'identity)
       if (-contains? org-ref-cite-types (org-element-property &lt;span style="color: #006FE0;"&gt;:type&lt;/span&gt; link))
       collect link))
&lt;/pre&gt;
&lt;/div&gt;
&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="left"&gt;kitchin-2015-examp,kitchin-2015-data-surfac-scien&lt;/td&gt;
&lt;td class="left"&gt;xu-2015-tunin-oxide,mehta-2014-ident-poten,curnan-2014-effec-concen&lt;/td&gt;
&lt;td class="left"&gt;hallenbeck-2013-effec-o2&lt;/td&gt;
&lt;td class="left"&gt;miller-2014-simul-temper,boes-2015-estim-bulk&lt;/td&gt;
&lt;td class="left"&gt;kitchin-2015-examp&lt;/td&gt;
&lt;td class="left"&gt;kitchin-2015-data-surfac-scien&lt;/td&gt;
&lt;td class="left"&gt;boes-2015-estim-bulk&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
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.
&lt;/p&gt;

&lt;p&gt;
We start with a list of the keys in the order cited, and a number we will use for each one.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for i from 1
      for key in (org-ref-get-bibtex-keys)
      collect (list key i))
&lt;/pre&gt;
&lt;/div&gt;

&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="left" /&gt;

&lt;col  class="right" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="left"&gt;kitchin-2015-examp&lt;/td&gt;
&lt;td class="right"&gt;1&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;kitchin-2015-data-surfac-scien&lt;/td&gt;
&lt;td class="right"&gt;2&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;xu-2015-tunin-oxide&lt;/td&gt;
&lt;td class="right"&gt;3&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;mehta-2014-ident-poten&lt;/td&gt;
&lt;td class="right"&gt;4&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;curnan-2014-effec-concen&lt;/td&gt;
&lt;td class="right"&gt;5&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;hallenbeck-2013-effec-o2&lt;/td&gt;
&lt;td class="right"&gt;6&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;miller-2014-simul-temper&lt;/td&gt;
&lt;td class="right"&gt;7&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="left"&gt;boes-2015-estim-bulk&lt;/td&gt;
&lt;td class="right"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
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.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #0000FF;"&gt;let&lt;/span&gt; ((links (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in (org-element-map (org-element-parse-buffer) 'link 'identity)
                   if (-contains? org-ref-cite-types (org-element-property &lt;span style="color: #006FE0;"&gt;:type&lt;/span&gt; link))
                   collect link))
      (replacements (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for i from 1
                          for key in (org-ref-get-bibtex-keys)
                          collect (list key (number-to-string i)))))
  (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for link in links
        collect (&lt;span style="color: #0000FF;"&gt;let&lt;/span&gt; ((path (org-element-property &lt;span style="color: #006FE0;"&gt;:path&lt;/span&gt; link)))
                  (&lt;span style="color: #0000FF;"&gt;dolist&lt;/span&gt; (repl replacements)
                    (&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; path (replace-regexp-in-string (car repl) (nth 1 repl) path)))
                  (list (org-element-property &lt;span style="color: #006FE0;"&gt;:begin&lt;/span&gt; link)
                        (org-element-property &lt;span style="color: #006FE0;"&gt;:end&lt;/span&gt; link)
                        (format &lt;span style="color: #008000;"&gt;"&amp;lt;sup&amp;gt;%s&amp;lt;/sup&amp;gt;"&lt;/span&gt; path)))))
&lt;/pre&gt;
&lt;/div&gt;

&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="right" /&gt;

&lt;col  class="right" /&gt;

&lt;col  class="left" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="right"&gt;950&lt;/td&gt;
&lt;td class="right"&gt;1004&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;1,2&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="right"&gt;1073&lt;/td&gt;
&lt;td class="right"&gt;1145&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;3,4,5&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="right"&gt;1160&lt;/td&gt;
&lt;td class="right"&gt;1190&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;6&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="right"&gt;1236&lt;/td&gt;
&lt;td class="right"&gt;1286&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;7,8&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="right"&gt;1364&lt;/td&gt;
&lt;td class="right"&gt;1388&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="right"&gt;1392&lt;/td&gt;
&lt;td class="right"&gt;1427&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td class="right"&gt;4091&lt;/td&gt;
&lt;td class="right"&gt;4117&lt;/td&gt;
&lt;td class="left"&gt;&amp;lt;sup&amp;gt;8&amp;lt;/sup&amp;gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
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.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #0000FF;"&gt;setq&lt;/span&gt; org-ref-bibliography-entry-format
      '((&lt;span style="color: #008000;"&gt;"article"&lt;/span&gt; . &lt;span style="color: #008000;"&gt;"&amp;lt;li&amp;gt;%a, %t, &amp;lt;i&amp;gt;%j&amp;lt;/i&amp;gt;, &amp;lt;b&amp;gt;%v(%n)&amp;lt;/b&amp;gt;, %p (%y). &amp;lt;a href=\"%U\"&amp;gt;link&amp;lt;/a&amp;gt;. &amp;lt;a href=\"https://doi.org/%D\"&amp;gt;doi&amp;lt;/a&amp;gt;.&amp;lt;/li&amp;gt;"&lt;/span&gt;)
        (&lt;span style="color: #008000;"&gt;"book"&lt;/span&gt; . &lt;span style="color: #008000;"&gt;"&amp;lt;li&amp;gt;%a, %t, %u (%y).&amp;lt;/li&amp;gt;"&lt;/span&gt;)))

(concat &lt;span style="color: #008000;"&gt;"&amp;lt;h1&amp;gt;Bibliography&amp;lt;/h1&amp;gt;&amp;lt;br&amp;gt;&amp;lt;ol&amp;gt;"&lt;/span&gt;
        (mapconcat
         'identity
         (&lt;span style="color: #0000FF;"&gt;loop&lt;/span&gt; for key in (org-ref-get-bibtex-keys)
               collect
               (&lt;span style="color: #0000FF;"&gt;let*&lt;/span&gt; ((result (org-ref-get-bibtex-key-and-file key))
                      (bibfile (cdr result))
                      (entry (&lt;span style="color: #0000FF;"&gt;save-excursion&lt;/span&gt;
                               (&lt;span style="color: #0000FF;"&gt;with-temp-buffer&lt;/span&gt;
                                 (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 &lt;span style="color: #008000;"&gt;"=type="&lt;/span&gt; entry))
                              org-ref-bibliography-entry-format)))))
         &lt;span style="color: #008000;"&gt;""&lt;/span&gt;)
        &lt;span style="color: #008000;"&gt;"&amp;lt;/ol&amp;gt;"&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;

&lt;h1&gt;Bibliography&lt;/h1&gt;&lt;br&gt;&lt;ol&gt;&lt;li&gt;Kitchin, Examples of Effective Data Sharing in Scientific Publishing, &lt;i&gt;{ACS Catalysis}&lt;/i&gt;, &lt;b&gt;5(6)&lt;/b&gt;, 3894-3899 (2015). &lt;a href=" https://doi.org/10.1021/acscatal.5b00538 "&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/acscatal.5b00538"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;"John Kitchin", Data Sharing in Surface Science, &lt;i&gt;"Surface Science "&lt;/i&gt;, &lt;b&gt;(0)&lt;/b&gt;,  -  (2015). &lt;a href="http://www.sciencedirect.com/science/article/pii/S0039602815001326"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1016/j.susc.2015.05.007"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Zhongnan Xu \&amp; John R Kitchin, Tuning Oxide Activity Through Modification of the Crystal and  Electronic Structure: From Strain To Potential Polymorphs, &lt;i&gt;{Phys. Chem. Chem. Phys.}&lt;/i&gt;, &lt;b&gt;17()&lt;/b&gt;, 28943-28949 (2015). &lt;a href="https://doi.org/10.1039/C5CP04840K"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1039/c5cp04840k"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Prateek Mehta, Paul Salvador \&amp; John Kitchin, Identifying Potential BO2 Oxide Polymorphs for Epitaxial  Growth Candidates, &lt;i&gt;{ACS Appl. Mater. Interfaces}&lt;/i&gt;, &lt;b&gt;6(5)&lt;/b&gt;, 3630-3639 (2014). &lt;a href="https://doi.org/10.1021/am4059149"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/am4059149"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Curnan \&amp; Kitchin, Effects of Concentration, Crystal Structure, Magnetism, and  Electronic Structure Method on First-Principles Oxygen Vacancy  Formation Energy Trends in Perovskites, &lt;i&gt;{The Journal of Physical Chemistry C}&lt;/i&gt;, &lt;b&gt;118(49)&lt;/b&gt;, 28776-28790 (2014). &lt;a href="https://doi.org/10.1021/jp507957n"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/jp507957n"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;"Hallenbeck \&amp; Kitchin, Effects of O2 and SO2 on the Capture Capacity of a  Primary-Amine Based Polymeric CO2 Sorbent, &lt;i&gt;"Industrial \&amp; Engineering Chemistry Research"&lt;/i&gt;, &lt;b&gt;52(31)&lt;/b&gt;, 10788-10794 (2013). &lt;a href="http://pubs.acs.org/doi/abs/10.1021/ie400582a"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/ie400582a"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Spencer Miller, Vladimir Pushkarev, Andrew, Gellman \&amp; John Kitchin, Simulating Temperature Programmed Desorption of Oxygen on  Pt(111) Using DFT Derived Coverage Dependent Desorption  Barriers, &lt;i&gt;{Topics in Catalysis}&lt;/i&gt;, &lt;b&gt;57(1-4)&lt;/b&gt;, 106-117 (2014). &lt;a href="https://doi.org/10.1007/s11244-013-0166-3"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1007/s11244-013-0166-3"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Jacob Boes, Gamze Gumuslu, James Miller, Andrew, Gellman \&amp; John Kitchin, Estimating Bulk-Composition-Dependent H&lt;sub&gt;2&lt;/sub&gt; Adsorption Energies  on Cu&lt;sub&gt;x&lt;/sub&gt;Pd&lt;sub&gt;1-x&lt;/sub&gt; Alloy (111) Surfaces, &lt;i&gt;{ACS Catalysis}&lt;/i&gt;, &lt;b&gt;5()&lt;/b&gt;, 1020-1026 (2015). &lt;a href="https://doi.org/10.1021/cs501585k"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/cs501585k"&gt;doi&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Copyright (C) 2015 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2015/12/03/Exporting-numbered-citations-in-html-with-unsorted-numbered-bibliography.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.10&lt;/p&gt;
]]></content:encoded>
    </item>
    <item>
      <title>Another parsing of links for citations with pre and post text.</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text</link>
      <pubDate>Thu, 26 Jun 2014 20:16:43 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <category><![CDATA[emacs]]></category>
      <category><![CDATA[org-ref]]></category>
      <guid isPermaLink="false">y0RRshHWnJDYrR30xt8Gha-MeNc=</guid>
      <description>Another parsing of links for citations with pre and post text.</description>
      <content:encoded><![CDATA[



&lt;p&gt;
Some LaTeX citations look like \cite[pretext][post text]{key}. Here I explore parsing a link like &lt;a href="#(pre text)(post text)key"&gt;(pre text)(post text)key&lt;/a&gt;. Note you cannot use [] inside the link, as it breaks the link syntax. Also, these links must be wrapped in &lt;code&gt;[[]]&lt;/code&gt; because of the parentheses and spaces in the parentheses. This is a very different approach than used &lt;a href="http://kitchingroup.cheme.cmu.edu/blog/2014/05/19/Exporting-citations-with-biblatex/"&gt;here&lt;/a&gt; which used the description of the link to define the pre and post text. The disadvantage of that approach is that the key is hidden, whereas in this approach it is not; you can see the key and pre/post text.
&lt;/p&gt;

&lt;p&gt;
The basic strategy will be to use a regexp to parse the link path. The regexp below is pretty hairy, but basically it looks for optional text in () and uses numbered groups to store what is found. Then, we use what we found to construct the LaTeX syntax. We redefine the function in org-ref that gets the key for clicking, and we redefine the cite format function. The result is that we retain the click functionality that shows us what the key refers to.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun org-ref-parse-key (s)
  "return pretext, posttext and bibtex key from a string like \"(pre text)(post text)bibtexkey\""
  (string-match "\\(?1:(\\(?2:[^)]*\\))\\)?\\(?3:(\\(?4:[^]]*\\))\\)?\\(?5:.*\\)" s)
  ;; return pretext postext key
  (list (match-string 2 s) (match-string 4 s) (match-string 5 s)))

(defun org-ref-get-bibtex-key-and-file (&amp;amp;optional key)
  "returns the bibtex key and file that it is in. If no key is provided, get one under point"
 (interactive)
 (let ((org-ref-bibliography-files (org-ref-find-bibliography))
       (file))
   (unless key
     ;; get the key
     (setq key (nth 2 (org-ref-parse-key (org-ref-get-bibtex-key-under-cursor)))))
   (setq file     (catch 'result
		    (loop for file in org-ref-bibliography-files do
			  (if (org-ref-key-in-file-p key (file-truename file)) 
			      (throw 'result file)))))
   (cons key file)))

(defun org-ref-format-cite (keyword desc format)
   (cond
    ((eq format 'latex)
     (let* ((results (org-ref-parse-key keyword))
	    (pretext (nth 0 results))
	    (posttext (nth 1 results))
	    (key (nth 2 results)))
       (concat "\\cite" 
	       (when pretext (format "[%s]" pretext))
	       (when posttext (format "[%s]" posttext))
	       (format "{%s}" key))))))
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
org-ref-format-cite
&lt;/pre&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(org-ref-format-cite "(pre text)(post text)key" nil 'latex)
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
\cite[pre text][post text]{key}
&lt;/pre&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(org-ref-format-cite "(pre text)key" nil 'latex)
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
\cite[pre text]{key}
&lt;/pre&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(org-ref-format-cite "key" nil 'latex)
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
\cite{key}
&lt;/pre&gt;

&lt;p&gt;
It looks like they all work! Let us test the links: &lt;a href="#mehta-2014-ident-poten"&gt;mehta-2014-ident-poten&lt;/a&gt;, &lt;a href="#(pre text)mehta-2014-ident-poten"&gt;(pre text)mehta-2014-ident-poten&lt;/a&gt; and &lt;a href="#(pre text)(post text)biskup-2014-insul-ferrom-films"&gt;(pre text)(post text)biskup-2014-insul-ferrom-films&lt;/a&gt;. a multiple citation &lt;a href="#mehta-2014-ident-poten"&gt;mehta-2014-ident-poten&lt;/a&gt;,&lt;a href="#thompson-2014-co2-react"&gt;thompson-2014-co2-react&lt;/a&gt;,&lt;a href="#calle-vallejo-2013-number"&gt;calle-vallejo-2013-number&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
This seems to work from an export point of view. You can not mix multiple citations with this syntax, and I did not define the html export above. Otherwise, it looks like this might be a reasonable addition to org-ref.
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text..org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;]]></content:encoded>
    </item>
    <item>
      <title>Using org-files like el-files</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/06/24/Using-org-files-like-el-files</link>
      <pubDate>Tue, 24 Jun 2014 21:32:58 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <category><![CDATA[emacs]]></category>
      <guid isPermaLink="false">nb1TWbf4Ve04dTZL_8IMeWVea0A=</guid>
      <description>Using org-files like el-files</description>
      <content:encoded><![CDATA[


&lt;p&gt;
I wrote some emacs-lisp code in org-mode, and load them with org-babel-load-file. I thought it would be nice if there was load path for org-files, similar to the one for lisp files. Here I document what it might look like.
&lt;/p&gt;

&lt;p&gt;
We need a load path to search for the org-file.
&lt;/p&gt;
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(setq org-load-path '("~/Dropbox/kitchingroup/jmax/"))
&lt;/pre&gt;
&lt;/div&gt;

&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="left" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="left"&gt;~/Dropbox/kitchingroup/jmax/&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
Next, we need the function to do the loading. We need to find the org-file, and then load it.
&lt;/p&gt;



&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun org-require (orgfile)
  "orgfile is a symbol to be loaded"
  (let ((org-file (concat (symbol-name orgfile) ".org"))
	(path))

  ;; find the org-file
  (catch 'result
    (loop for dir in org-load-path do
	  (when (file-exists-p
		 (setq path
		       (concat
			(directory-file-name dir)
			"/"
			org-file)))
	    (throw 'result path))))
  (org-babel-load-file path)))


(org-require 'org-ref)
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
Loaded ~/Dropbox/kitchingroup/jmax/org-ref.el
&lt;/pre&gt;

&lt;p&gt;
That looks pretty simple. You do need write access to the location where the org-file is though. Let us look at a version that copies the file to a temporary directory. For some reason, I am not able to use org-babel-load-file with this. But, it does look like I can tangle the file, and assuming (big assumption) that the file tangles to a regularly named .el file, this seems to work too.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun org-require (orgfile)
  "orgfile is a symbol to be loaded"
  (let ((org-file (concat (symbol-name orgfile) ".org"))
        (el-file (concat (symbol-name orgfile) ".el"))
	(path))

  ;; find the org-file
  (catch 'result
    (loop for dir in org-load-path do
	  (when (file-exists-p
		 (setq path
		       (concat
			(directory-file-name dir)
			"/"
			org-file)))
	    (throw 'result path))))
  (copy-file path temporary-file-directory t)

  (org-babel-tangle-file (concat temporary-file-directory (file-name-nondirectory path)))
  (load-file (concat temporary-file-directory el-file))
))

(org-require 'org-ref)
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
t
&lt;/pre&gt;

&lt;p&gt;
This actually seems pretty reasonable. I have not thought about complications but for simple cases, e.g. single org-file, it looks ok.
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/06/24/Using-org-files-like-el-files.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;]]></content:encoded>
    </item>
    <item>
      <title>Better integration of org-mode and email</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/06/08/Better-integration-of-org-mode-and-email</link>
      <pubDate>Sun, 08 Jun 2014 20:57:53 EDT</pubDate>
      <category><![CDATA[email]]></category>
      <category><![CDATA[org-mode]]></category>
      <guid isPermaLink="false">yUG_aneLEa20f-MW4nCmuz3mT-Q=</guid>
      <description>Better integration of org-mode and email</description>
      <content:encoded><![CDATA[


&lt;p&gt;
I like to email org-mode headings and content to people. It would be nice to have some records of when a heading was sent, and to whom. We store this information in a heading. It is pretty easy to write a simple function that emails a selected region.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun email-region (start end)
  "Send region as the body of an email."
  (interactive "r")
  (let ((content (buffer-substring start end)))
    (compose-mail)
    (message-goto-body)
    (insert content)
    (message-goto-to)))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
that function is not glamorous, and you still have to fill in the email fields, and unless you use gnus and org-contacts, the only record keeping is through the email provider. 
&lt;/p&gt;

&lt;p&gt;
What I would like is to send a whole heading in an email. The headline should be the subject, and if there are TO, CC or BCC properties, those should be used. If there is &lt;i&gt;no TO&lt;/i&gt;, then I want to grab the TO from the email after you enter it and store it as a property. You should be able to set OTHER-HEADERS as a property (this is just for fun. There is no practical reason for this yet). After you send the email, it should record in the heading when it was sent.
&lt;/p&gt;

&lt;p&gt;
It turned out that is a relatively tall order. While it is easy to setup the email if you have everything in place, it is tricky to get the information on TO and the time sent &lt;i&gt;after&lt;/i&gt; the email is sent. Past lispers had a lot of ideas to make this possible, and a day of digging got me to the answer. You can specify some "action" functions that get called at various times, e.g. after sending, and a return action when the compose window is done. Unfortunately, I could not figure out any way to do things except to communicate through some global variables.
&lt;/p&gt;

&lt;p&gt;
So here is the code that lets me send org-headings, with the TO, CC, BCC properties, and that records when I sent the email after it is sent.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defvar *email-heading-point* nil
  "global variable to store point in for returning")

(defvar *email-to-addresses* nil
  "global variable to store to address in email")

(defun email-heading-return ()
  "after returning from compose do this"
  (switch-to-buffer (marker-buffer  *email-heading-point*))
  (goto-char (marker-position  *email-heading-point*))
  (setq *email-heading-point* nil)
  (org-set-property "SENT-ON" (current-time-string))
  ;; reset this incase you added new ones
  (org-set-property "TO" *email-to-addresses*)
  )

(defun email-send-action ()
  "send action for compose-mail"
  (setq *email-to-addresses* (mail-fetch-field "To")))

(defun email-heading ()
  "Send the current org-mode heading as the body of an email, with headline as the subject.

use these properties
TO
OTHER-HEADERS is an alist specifying additional
header fields.  Elements look like (HEADER . VALUE) where both
HEADER and VALUE are strings.

save when it was sent as s SENT property. this is overwritten on
subsequent sends. could save them all in a logbook?
"
  (interactive)
  ; store location.
  (setq *email-heading-point* (set-marker (make-marker) (point)))
  (org-mark-subtree)
  (let ((content (buffer-substring (point) (mark)))
	(TO (org-entry-get (point) "TO" t))
	(CC (org-entry-get (point) "CC" t))
	(BCC (org-entry-get (point) "BCC" t))
	(SUBJECT (nth 4 (org-heading-components)))
	(OTHER-HEADERS (eval (org-entry-get (point) "OTHER-HEADERS")))
	(continue nil)
	(switch-function nil)
	(yank-action nil)
	(send-actions '((email-send-action . nil)))
	(return-action '(email-heading-return)))
    
    (compose-mail TO SUBJECT OTHER-HEADERS continue switch-function yank-action send-actions return-action)
    (message-goto-body)
    (insert content)
    (when CC
      (message-goto-cc)
      (insert CC))
    (when BCC
      (message-goto-bcc)
      (insert BCC))
    (if TO
	(message-goto-body)
      (message-goto-to))       
    ))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
This works pretty well for me. Since I normally use this to send tasks to people, it keeps the task organized where I want it, and I can embed an org-id in the email so if the person replies to it telling me the task is done, I can easily navigate to the task to mark it off. Pretty handy.
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/06/08/Better-integration-of-org-mode-and-email.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;]]></content:encoded>
    </item>
    <item>
      <title>Finding emails from tags from org-contacts database</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/06/05/Finding-emails-from-tags-from-org-contacts-database</link>
      <pubDate>Thu, 05 Jun 2014 14:42:21 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <guid isPermaLink="false">7kCzIZg8P0_u9J-GU5uXQWV5xr8=</guid>
      <description>Finding emails from tags from org-contacts database</description>
      <content:encoded><![CDATA[



&lt;p&gt;
Org-mode has a contacts manager called org-contacts. If you set it up, you can use it to insert email addresses using a tag in message-mode. Out of the box though, it only works on one tag. You cannot do something like +group-phd to get entries tagged group but not tagged phd. Here we develop a function to do that for us. 
&lt;/p&gt;

&lt;p&gt;
We could use the org-files and map the headings to do this, but org-contacts has already done this and has a database we can use instead. We get the database from org-contacts-filter. Here is the first entry.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(car (org-contacts-filter))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
(Chris Jones #&amp;lt;marker at 1 in contacts.org&amp;gt; ((FILE . c:/Users/jkitchin/Dropbox/org-mode/contacts.org) (TAGS . :co2:) (ALLTAGS . :co2:) (BLOCKED . ) (COMPANY . Georgia Tech, Chemical Engineering) (EMAIL . Christopher.Jones@chbe.gatech.edu) (CATEGORY . contacts)))
&lt;/p&gt;

&lt;p&gt;
It looks like we have (name marker (cons cells)) for each entry. We can get the tags associated with that entry like this.
&lt;/p&gt;

&lt;p&gt;
We can get the tags for an entry with this code:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(let ((entry (car (org-contacts-filter))))
  (cdr (assoc "TAGS" (nth 2 entry))))
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
:co2:
&lt;/pre&gt;

&lt;p&gt;
We will use some code for org tags. Notably, from a tags expression, we can automatically generate code that tells us if we have a match. Here we generate the code to test for a match on "+co2-group".
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(let ((todo-only nil))
  (cdr (org-make-tags-matcher "+co2-group")))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
(and (progn (setq org-cached-props nil) (and (not (member group tags-list)) (member co2 tags-list))) t)
&lt;/p&gt;

&lt;p&gt;
Note we will have to bind tags-list before we eval this.
&lt;/p&gt;

&lt;p&gt;
So to use it, we need to split the tags from an org-contacts entry into a list of strings. It appears each entry just has the tag string, so we split the substring (skipping first and last characters) by ":" to get the list. We do that here, and test if a list of tags containing "co2" is matched by the expression "co2-junior".
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(let* ((tags-list (split-string (substring ":co2:" 1 -1) ":"))
       (todo-only nil))
  (eval (cdr (org-make-tags-matcher "co2-junior"))))
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
t
&lt;/pre&gt;

&lt;p&gt;
It is. So, now we just need to loop through the database, and collect entries that match.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun insert-emails-from-tags (tag-expression)
  "insert emails from org-contacts that match the tags expression. For example:
group-phd will match entries tagged with group but not with phd."
  (interactive "sTags: ")
  (insert
   (mapconcat 'identity
	      (loop for contact in (org-contacts-filter)
		    for contact-name = (car contact)
		    for email = (org-contacts-strip-link (car (org-contacts-split-property
							       (or
								(cdr (assoc-string org-contacts-email-property
										   (caddr contact)))
								""))))
		    for tags = (cdr (assoc "TAGS" (nth 2 contact)))
		    for tags-list = (if tags
					(split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":")
				      '())
		    if (let ((todo-only nil))
			 (eval (cdr (org-make-tags-matcher tag-expression))))
		    
		    collect (org-contacts-format-email contact-name email))
	      ",")))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
This is not quite completion in message-mode, but it is good enough. You put your cursor in the To field, and run that command, enter the tag expression, and you will get your emails!
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/06/05/Finding-emails-from-tags-from-org-contacts-database.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;]]></content:encoded>
    </item>
    <item>
      <title>org-shift hooks for ordering citations</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/05/21/org-shift-hooks-for-ordering-citations</link>
      <pubDate>Wed, 21 May 2014 11:11:56 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <category><![CDATA[bibtex]]></category>
      <guid isPermaLink="false">7KY-zIMPuu1Q12Q-Rtiw1N_CItg=</guid>
      <description>org-shift hooks for ordering citations</description>
      <content:encoded><![CDATA[


&lt;p&gt;
I wrote a function that sorts citations by year, but there might be a reason to order them some other way. Here we develop a method to use shift-arrow keys to do the ordering. We will need to write a function that gets the citations in a link, gets the key under point, and then swap with neighboring keys depending on the arrow pressed. It is trivial to get the key under point (org-ref-get-bibtex-key-under-cursor), and we saw before it is easy to get the keys in a link. Let us examine swapping elements of a list here. This is an old algorithm, we store the first value, replace it with the second value, and then set the second value.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun org-ref-swap-keys (i j keys)
 "swap the keys in a list with index i and j"
 (let ((tempi (nth i keys)))
   (setf (nth i keys) (nth j keys))
   (setf (nth j keys) tempi))
  keys)

(org-ref-swap-keys 2 3 '(1 2 3 4))
&lt;/pre&gt;
&lt;/div&gt;

&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="right" /&gt;

&lt;col  class="right" /&gt;

&lt;col  class="right" /&gt;

&lt;col  class="right" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="right"&gt;1&lt;/td&gt;
&lt;td class="right"&gt;2&lt;/td&gt;
&lt;td class="right"&gt;4&lt;/td&gt;
&lt;td class="right"&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
So, we need to get the keys in the link at point, the key at point, the index of the key at point, and then we can swap them, and reconstruct the link. Here is the function that does this, and that adds the hooks.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun org-ref-swap-citation-link (direction)
 "move citation at point in direction +1 is to the right, -1 to the left"
 (interactive)
 (let* ((object (org-element-context))	 
        (type (org-element-property :type object))
	(begin (org-element-property :begin object))
	(end (org-element-property :end object))
	(link-string (org-element-property :path object))
        (key (org-ref-get-bibtex-key-under-cursor))
	(keys (org-ref-split-and-strip-string link-string))
        (i (index key keys)) point) ;; defined in org-ref
   (if (&amp;gt; direction 0) ;; shift right
     (org-ref-swap-keys i (+ i 1) keys)
     (org-ref-swap-keys i (- i 1) keys))	
  (setq keys (mapconcat 'identity keys ","))
  ;; and replace the link with the sorted keys
  (cl--set-buffer-substring begin end (concat type ":" keys))
  ;; now go forward to key so we can move with the key
  (re-search-forward key) 
  (goto-char (match-beginning 0))))

(add-hook 'org-shiftright-hook (lambda () (org-ref-swap-citation-link 1)))
(add-hook 'org-shiftleft-hook (lambda () (org-ref-swap-citation-link -1)))
&lt;/pre&gt;
&lt;/div&gt;

&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="left"&gt;lambda&lt;/td&gt;
&lt;td class="left"&gt;nil&lt;/td&gt;
&lt;td class="left"&gt;(org-ref-swap-citation-link -1)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
&lt;a href="#kanan-2008-in-situ"&gt;kanan-2008-in-situ&lt;/a&gt;,&lt;a href="#kanan-2009-cobal"&gt;kanan-2009-cobal&lt;/a&gt;,&lt;a href="#lutterman-2009-self-healin"&gt;lutterman-2009-self-healin&lt;/a&gt;,&lt;a href="#mcalpin-2010-epr-eviden"&gt;mcalpin-2010-epr-eviden&lt;/a&gt;,&lt;a href="#liu-2014-spect-studies"&gt;liu-2014-spect-studies&lt;/a&gt;! 
&lt;/p&gt;

&lt;p&gt;
That is it! Wow, not hard at all. Check out this video of the code in action: &lt;a href="http://screencast.com/t/YmgA0fnZ1Ogl"&gt;http://screencast.com/t/YmgA0fnZ1Ogl&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/05/21/org-shift-hooks-for-ordering-citations.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;]]></content:encoded>
    </item>
    <item>
      <title>Exporting citations with biblatex</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/05/19/Exporting-citations-with-biblatex</link>
      <pubDate>Mon, 19 May 2014 07:29:18 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <guid isPermaLink="false">5Wi56asC_1d7sPhu6dW4n1chTso=</guid>
      <description>Exporting citations with biblatex</description>
      <content:encoded><![CDATA[


&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-1"&gt;1. Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;
This post illustrates that org-ref works with biblatex. We create a simple document and export it to pdf, and HTML for this post. We also explore how to modify the export behavior of a link. You should look at the org-source at the bottom to see the whole setup; it does not all export to either format.
&lt;/p&gt;

&lt;p&gt;
We need a simple export type with no default packages to avoid the natbib packages I have setup in my default list. Here is the setup. Just run C-c C-c in the block to temporarily add this to your setup.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(add-to-list 'org-latex-classes
	     '("article-biblatex"
	       "\\documentclass{article}
 [NO-DEFAULT-PACKAGES]
 [PACKAGES]
 [EXTRA]"
	       ("\\section{%s}" . "\\section*{%s}")
	       ("\\subsection{%s}" . "\\subsection*a{%s}")
	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
	       ("\\paragraph{%s}" . "\\paragraph*{%s}")
	       ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
Add some citations &lt;a href="#andriotis-2014-infor"&gt;andriotis-2014-infor&lt;/a&gt;,&lt;a href="#armiento-2014-high"&gt;armiento-2014-high&lt;/a&gt;,&lt;a href="#biskup-2014-insul-ferrom-films"&gt;biskup-2014-insul-ferrom-films&lt;/a&gt;,&lt;a href="#chemelewski-2014-amorp-feooh"&gt;chemelewski-2014-amorp-feooh&lt;/a&gt;,&lt;a href="#chen-2014-inter-effec"&gt;chen-2014-inter-effec&lt;/a&gt;
 and then a single citation &lt;a href="#chen-2014-inter-effec"&gt;chen-2014-inter-effec&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
and a complicated latex \cite[pre text][post text]{chen-2014-inter-effec}. Note this one will export to LaTeX fine, but not to HTML.
&lt;/p&gt;

&lt;p&gt;
I would like to create a citation link that exports that way. We will do it by using a parseable syntax in the description of a link. We will have to temporarily define a new format function to achieve this. Here it is, just for the autocite command.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(defun org-ref-format-autocite (keyword desc format)
  (when (eq format 'latex)
    (concat "\\autocite"
	    (cond
	     ((string-match "::" desc)
	      (format "[%s][%s]" (car (setq results (split-string desc "::"))) (cadr results)))
	     (desc (format "[%s]" desc)))
	    (format "{%s}" keyword))))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
This is the syntax:
&lt;/p&gt;
&lt;pre class="example"&gt;
a citation with post text: [[autocite:armiento-2014-high][post text]]

a citation with pre and post text:  [[autocite:andriotis-2014-infor][pre text::post text]]
&lt;/pre&gt;
&lt;p&gt;
a citation with post text: &lt;a href="#armiento-2014-high"&gt;armiento-2014-high&lt;/a&gt; (the post text is not rendered in html).
&lt;/p&gt;

&lt;p&gt;
a citation with pre and post text:  &lt;a href="#andriotis-2014-infor"&gt;andriotis-2014-infor&lt;/a&gt; (the pre/post text is not rendered in html).
&lt;/p&gt;

&lt;p&gt;
The links in org-mode are no longer that readable when they are collapsed as descriptive links, but they are not too bad as literal links.
&lt;/p&gt;

&lt;p&gt;
Here is the file  and &lt;a href="/media/2014-05-19-Exporting-citations-with-biblatex/exporting-with-biblatex.pdf"&gt;exporting-with-biblatex.pdf&lt;/a&gt; . One of those links is for the pdf, and one is for the HTML file.
&lt;/p&gt;

&lt;div id="outline-container-sec-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Summary&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;p&gt;
org-ref seems to work pretty well with biblatex now.
&lt;/p&gt;

&lt;p&gt;
We use a printbibliography link here. This exports to the latex command, or an html bibliography.
&lt;h1&gt;Bibliography&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a id="andriotis-2014-infor"&gt;[andriotis-2014-infor] Andriotis, Antonis N. and Mpourmpakis, Giannis and  Broderick, Scott and Rajan, Krishna and Datta,  Somnath and Sunkara, Mahendra and Menon, Madhu, "Informatics guided discovery of surface  structure-chemistry relationships in catalytic  nanoparticles", The Journal of Chemical Physics, 140:094705 (2014). &lt;a href="http://scitation.aip.org/content/aip/journal/jcp/140/9/10.1063/1.4867010"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1063/1.4867010"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="armiento-2014-high"&gt;[armiento-2014-high] Armiento, R. and Kozinsky, B. and Hautier, G. and  Fornari, M. and Ceder, G., "High-throughput screening of perovskite alloys for  piezoelectric performance and thermodynamic  stability", Phys. Rev. B, 89:134103 (2014). &lt;a href="http://link.aps.org/doi/10.1103/PhysRevB.89.134103"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1103/PhysRevB.89.134103"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="biskup-2014-insul-ferrom-films"&gt;[biskup-2014-insul-ferrom-films] Bi{\v{s}}kup, Neven and  Salafranca, Juan and Mehta, Virat and Oxley, Mark  P. and Suzuki, Yuri and Pennycook, Stephen J. and  Pantelides, Sokrates T. and Varela, Maria, "Insulating Ferromagnetic \ce{LaCoO_{3-$\delta$}}  Films: A Phase Induced by Ordering of Oxygen  Vacancies", Phys. Rev. Lett., 112:087202 (2014). &lt;a href="http://link.aps.org/doi/10.1103/PhysRevLett.112.087202"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1103/PhysRevLett.112.087202"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="chemelewski-2014-amorp-feooh"&gt;[chemelewski-2014-amorp-feooh] Chemelewski, William D. and Lee, Heung-Chan and Lin,  Jung-Fu and Bard, Allen J. and Mullins, C. Buddie, "Amorphous \ce{FeOOH} Oxygen Evolution Reaction Catalyst  for Photoelectrochemical Water Splitting", Journal of the American Chemical Society, 136:2843-2850 (2014). &lt;a href=""&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1021/ja411835a"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="chen-2014-inter-effec"&gt;[chen-2014-inter-effec] Chen, Guangxu and Zhao, Yun and Fu, Gang and  Duchesne, Paul N. and Gu, Lin and Zheng, Yanping and  Weng, Xuefei and Chen, Mingshu and Zhang, Peng and  Pao, Chih-Wen and Lee, Jyh-Fu and Zheng, Nanfeng, "Interfacial Effects in Iron-Nickel  Hydroxide-Platinum Nanoparticles Enhance Catalytic  Oxidation", Science, 344:495-499 (2014). &lt;a href="http://www.sciencemag.org/content/344/6183/495.abstract"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1126/science.1252553"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/05/19/Exporting-citations-with-biblatex.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;
]]></content:encoded>
    </item>
    <item>
      <title>Creating bibliographies in other formats with org-ref</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/05/18/Creating-bibliographies-in-other-formats-with-org-ref</link>
      <pubDate>Sun, 18 May 2014 10:11:18 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <category><![CDATA[bibtex]]></category>
      <guid isPermaLink="false">wieL2k9MV3MVAIHJiFZsfkfiC5A=</guid>
      <description>Creating bibliographies in other formats with org-ref</description>
      <content:encoded><![CDATA[



&lt;p&gt;
org-ref automatically generates bibliographies in LaTeX export, and it does a reasonable job automatically generating HTML bibliographies (ox-bibtex probably does this better, but it relies on an external program, whereas this approach is all elisp). Here we illustrate how to generate other formats, e.g. plain text, or org-mode formatted.
&lt;/p&gt;

&lt;p&gt;
org-ref provides a convenient function that generates a bibliography entry for a key formatted according to the variable org-ref-bibliography-entry-format. This variable is a string that uses the reftex percent escapes to create an entry. The default is setup for an HTML entry like this:
&lt;/p&gt;

&lt;pre class="example"&gt;
  "%a, %t, &amp;lt;i&amp;gt;%j&amp;lt;/i&amp;gt;, &amp;lt;b&amp;gt;%v(%n)&amp;lt;/b&amp;gt;, %p (%y). &amp;lt;a href=\"%U\"&amp;gt;link&amp;lt;/a&amp;gt;. &amp;lt;a href=\"https://doi.org/%D\"&amp;gt;doi&amp;lt;/a&amp;gt;."
&lt;/pre&gt;

&lt;p&gt;
We can redefine it temporarily to get other formats. Here is an example of getting an org-formatted entry with some italics and bold text.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(let ((org-ref-bibliography-entry-format "%a, %t, /%j/, *%v(%n)*, %p (%y). [[%U][link]]. [[https://doi.org/%D][doi]]."))
(org-ref-get-bibtex-entry-citation "andriotis-2014-infor"))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
"Andriotis, Mpourmpakis, , Broderick, Rajan, Datta, Somnath, Sunkara \&amp;amp; Menon, Informatics guided discovery of surface  structure-chemistry relationships in catalytic  nanoparticles, &lt;i&gt;The Journal of Chemical Physics&lt;/i&gt;, &lt;b&gt;140(9)&lt;/b&gt;, 094705 (2014). &lt;a href="http://scitation.aip.org/content/aip/journal/jcp/140/9/10.1063/1.4867010"&gt;link&lt;/a&gt; . &lt;a href="https://doi.org/10.1063/1.4867010"&gt;doi&lt;/a&gt; .
&lt;/p&gt;

&lt;p&gt;
Now, we put some citations of various types in for water splitting &lt;a href="#mccrory-2013-bench-heter"&gt;mccrory-2013-bench-heter&lt;/a&gt;, CO&lt;sub&gt;2&lt;/sub&gt; capture &lt;a href="#alesi-2012-evaluat-primar"&gt;alesi-2012-evaluat-primar&lt;/a&gt;, and microfluidic devices &lt;a href="#voicu-2014-microf-studies"&gt;voicu-2014-microf-studies&lt;/a&gt;. We will convert these links to a bibliography shortly.
&lt;/p&gt;

&lt;p&gt;
Next, we generate an org-formatted bibliography. We will create a bracketed label at the beginning of the entry, and the org-format after that. This is a functional enough bibliography to be useful I think, and it illustrates the ideas. We will do some light transforming to replace escaped &amp;amp; with regular &amp;amp; in the bibliography.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;;; temorarily redefine the format
(let ((org-ref-bibliography-entry-format "%a, %t, /%j/, *%v(%n)*, %p (%y). [[%U][link]]. [[https://doi.org/%D][doi]]."))

  (mapconcat
   (lambda (key)
     (format "[%s] %s" key
	     (replace-regexp-in-string
	      "\\\\&amp;amp;"
	      "&amp;amp;" (org-ref-get-bibtex-entry-citation key))))
   (org-ref-get-bibtex-keys) "\n\n"))
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
[alesi-2012-evaluat-primar] Alesi &amp;amp; Kitchin, Evaluation of a Primary Amine-Functionalized  Ion-Exchange Resin for \ce{CO_2} Capture, &lt;i&gt;Industrial &amp;amp; Engineering Chemistry Research&lt;/i&gt;, &lt;b&gt;51(19)&lt;/b&gt;, 6907-6915 (2012). &lt;a href="https://doi.org/10.1021/ie300452c"&gt;link&lt;/a&gt; . &lt;a href="https://doi.org/10.1021/ie300452c"&gt;doi&lt;/a&gt; .
&lt;/p&gt;

&lt;p&gt;
[mccrory-2013-bench-heter] McCrory, Jung, Peters, Jonas &amp;amp; Jaramillo, Benchmarking Heterogeneous Electrocatalysts for the  Oxygen Evolution Reaction, &lt;i&gt;J. Am. Chem. Soc.&lt;/i&gt;, &lt;b&gt;135(45)&lt;/b&gt;, 16977&amp;#x2013;16987 (2013). &lt;a href="https://doi.org/10.1021/ja407115p"&gt;link&lt;/a&gt; . &lt;a href="https://doi.org/10.1021/ja407115p"&gt;doi&lt;/a&gt; .
&lt;/p&gt;

&lt;p&gt;
[voicu-2014-microf-studies] Voicu, Abolhasani, Choueiri, Rachelle, Lestari, Seiler, , Menard, Greener, Guenther, Axel, Stephan &amp;amp; Kumacheva, Microfluidic Studies of \ce{CO_2} Sequestration by  Frustrated {L}ewis Pairs, &lt;i&gt;Journal of the American Chemical Society&lt;/i&gt;, &lt;b&gt;0(0)&lt;/b&gt;, null (2014). [[][link]]. &lt;a href="https://doi.org/10.1021/ja411601a"&gt;doi&lt;/a&gt; .
&lt;/p&gt;

&lt;p&gt;
You can see some minor issues with the formatting, e.g. sometimes the link is empty, if there is no url in the bibtex entry. There is no easy way to fix that. The 0 and null values in the last entry are because that is an ASAP article, and that is what is in the bibtex entry. I do not try to expand the latex code, and do not plan to do that. I do not know why there appears to be a blank author in the last entry, or why the author full names are not used. Those are reftex issues and  low priority to fix for me. They do not exist in the LaTeX export. The main point here is to get a reasonably useful bibliography that you can adapt as you want.
&lt;/p&gt;


&lt;p&gt;
&lt;h1&gt;Bibliography&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a id="alesi-2012-evaluat-primar"&gt;[alesi-2012-evaluat-primar] Alesi \&amp; Kitchin, Evaluation of a Primary Amine-Functionalized  Ion-Exchange Resin for \ce{CO_2} Capture, &lt;i&gt;Industrial \&amp; Engineering Chemistry Research&lt;/i&gt;, &lt;b&gt;51(19)&lt;/b&gt;, 6907-6915 (2012). &lt;a href="https://doi.org/10.1021/ie300452c"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/ie300452c"&gt;doi&lt;/a&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="mccrory-2013-bench-heter"&gt;[mccrory-2013-bench-heter] McCrory, Jung, Peters, Jonas \&amp; Jaramillo, Benchmarking Heterogeneous Electrocatalysts for the  Oxygen Evolution Reaction, &lt;i&gt;J. Am. Chem. Soc.&lt;/i&gt;, &lt;b&gt;135(45)&lt;/b&gt;, 16977--16987 (2013). &lt;a href="https://doi.org/10.1021/ja407115p"&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/ja407115p"&gt;doi&lt;/a&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="voicu-2014-microf-studies"&gt;[voicu-2014-microf-studies] Voicu, Abolhasani, Choueiri, Rachelle, Lestari, Seiler, , Menard, Greener, Guenther, Axel, Stephan \&amp; Kumacheva, Microfluidic Studies of \ce{CO_2} Sequestration by  Frustrated {L}ewis Pairs, &lt;i&gt;Journal of the American Chemical Society&lt;/i&gt;, &lt;b&gt;0(0)&lt;/b&gt;, null (2014). &lt;a href=""&gt;link&lt;/a&gt;. &lt;a href="https://doi.org/10.1021/ja411601a"&gt;doi&lt;/a&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/05/18/Creating-bibliographies-in-other-formats-with-org-ref.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;
]]></content:encoded>
    </item>
    <item>
      <title>Exporting citations in html</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/05/17/Exporting-citations-in-html</link>
      <pubDate>Sat, 17 May 2014 14:41:43 EDT</pubDate>
      <category><![CDATA[org-mode]]></category>
      <guid isPermaLink="false">b7f2t4lLhvZjsoIwNQk59asUQeA=</guid>
      <description>Exporting citations in html</description>
      <content:encoded><![CDATA[



&lt;p&gt;
Now that org-ref works well for LaTeX, I want to explore a simple approach to exporting citations with a bibliography in html. This will enable me to put citations in blogposts, like this one &lt;a href="#armiento-2014-high"&gt;armiento-2014-high&lt;/a&gt; and these ones &lt;a href="#daza-2014-carbon-dioxid"&gt;daza-2014-carbon-dioxid&lt;/a&gt;,&lt;a href="#mehta-2014-ident-poten"&gt;mehta-2014-ident-poten&lt;/a&gt;,&lt;a href="#suntivich-2014-estim-hybrid"&gt;suntivich-2014-estim-hybrid&lt;/a&gt;. We should be able to have the same citation in more than one place like this  &lt;a href="#armiento-2014-high"&gt;armiento-2014-high&lt;/a&gt;, but only have one entry in the bibliography. The bibliography should be sorted if we ask for it &lt;a href="#alesi-2012-evaluat-primar"&gt;alesi-2012-evaluat-primar&lt;/a&gt;. I am curious to see this book citation: &lt;a href="#day-1995-scien-englis"&gt;day-1995-scien-englis&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
The first thing we need is a list of bibtex keys cited in this buffer.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #8b0000;"&gt;defun&lt;/span&gt; &lt;span style="color: #8b2323;"&gt;org-ref-get-bibtex-keys&lt;/span&gt; ()
  &lt;span style="color: #228b22;"&gt;"return a list of unique keys in the buffer"&lt;/span&gt;
  (interactive)
  (&lt;span style="color: #8b0000;"&gt;let&lt;/span&gt; ((keys '()))
    (org-element-map (org-element-parse-buffer) 'link
      (&lt;span style="color: #8b0000;"&gt;lambda&lt;/span&gt; (link)
        (&lt;span style="color: #8b0000;"&gt;let&lt;/span&gt; ((plist (nth 1 link)))
          (&lt;span style="color: #8b0000;"&gt;when&lt;/span&gt; (-contains? org-ref-cite-types (plist-get plist '&lt;span style="color: #cd0000;"&gt;:type&lt;/span&gt;))
            (&lt;span style="color: #8b0000;"&gt;dolist&lt;/span&gt;
                (key
                 (org-ref-split-and-strip-string (plist-get plist '&lt;span style="color: #cd0000;"&gt;:path&lt;/span&gt;)))
              (&lt;span style="color: #8b0000;"&gt;when&lt;/span&gt; (not (-contains? keys key))
                (setq keys (append keys (list key)))))))))
    keys))

(org-ref-get-bibtex-keys)
&lt;/pre&gt;
&lt;/div&gt;
&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;


&lt;colgroup&gt;
&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;

&lt;col  class="left" /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="left"&gt;armiento-2014-high&lt;/td&gt;
&lt;td class="left"&gt;daza-2014-carbon-dioxid&lt;/td&gt;
&lt;td class="left"&gt;mehta-2014-ident-poten&lt;/td&gt;
&lt;td class="left"&gt;suntivich-2014-estim-hybrid&lt;/td&gt;
&lt;td class="left"&gt;alesi-2012-evaluat-primar&lt;/td&gt;
&lt;td class="left"&gt;day-1995-scien-englis&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;
Good. Now, we need to create an HTML string for the bibliography. For each key, we will create an unordered list of simple citations. Each citation will be a named anchor in html. Let us start with a function that takes a key, and generates the HTML for that entry.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #8b0000;"&gt;defun&lt;/span&gt; &lt;span style="color: #8b2323;"&gt;org-ref-get-bibtex-entry-html&lt;/span&gt; (key)
(interactive)

 (&lt;span style="color: #8b0000;"&gt;let&lt;/span&gt; ((org-ref-bibliography-files (org-ref-find-bibliography))
       (cb (current-buffer))
       (file) (entry))

   (setq file (&lt;span style="color: #8b0000;"&gt;catch&lt;/span&gt; '&lt;span style="color: #cd0000;"&gt;result&lt;/span&gt;
                (loop for file in org-ref-bibliography-files do
                      (message &lt;span style="color: #228b22;"&gt;"looking for %s in %s"&lt;/span&gt; key file)
                      (&lt;span style="color: #8b0000;"&gt;if&lt;/span&gt; (org-ref-key-in-file-p key (file-truename file))
                          (&lt;span style="color: #8b0000;"&gt;throw&lt;/span&gt; '&lt;span style="color: #cd0000;"&gt;result&lt;/span&gt; file)
                        (message &lt;span style="color: #228b22;"&gt;"%s not found in %s"&lt;/span&gt; key (file-truename file))))))
   (set-buffer (find-file-noselect file))
   (&lt;span style="color: #8b0000;"&gt;prog1&lt;/span&gt;
       (bibtex-search-entry key nil 0)
     (setq entry (org-ref-bib-citation))
     (set-buffer cb))

   (format &lt;span style="color: #228b22;"&gt;"&amp;lt;li&amp;gt;&amp;lt;a name=\"#%s\"&amp;gt;[%s] %s&amp;lt;\\a&amp;gt;&amp;lt;li&amp;gt;"&lt;/span&gt; key key entry)))

(org-ref-get-bibtex-entry-html &lt;span style="color: #228b22;"&gt;"mehta-2014-ident-poten"&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#mehta-2014-ident-poten"&amp;gt;[mehta-2014-ident-poten] Mehta, Prateek and Salvador, Paul A. and Kitchin,  John R., "Identifying Potential \ce{BO_2} Oxide Polymorphs for  Epitaxial Growth Candidates", ACS Applied Materials \&amp;amp; Interfaces, 0:null (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
That looks excellent. Now we simply map that function over the list of keys.
&lt;/p&gt;

&lt;div class="org-src-container"&gt;

&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #8b0000;"&gt;defun&lt;/span&gt; &lt;span style="color: #8b2323;"&gt;org-ref-get-html-bibliography&lt;/span&gt; ()
(interactive)
(&lt;span style="color: #8b0000;"&gt;let&lt;/span&gt; ((keys (org-ref-get-bibtex-keys)))
(&lt;span style="color: #8b0000;"&gt;when&lt;/span&gt; keys
(concat &lt;span style="color: #228b22;"&gt;"&amp;lt;h1&amp;gt;Bibliography&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span style="color: #228b22;"&gt;&amp;lt;ul&amp;gt;"&lt;/span&gt;
(mapconcat (&lt;span style="color: #8b0000;"&gt;lambda&lt;/span&gt; (x) (org-ref-get-bibtex-entry-html x)) keys &lt;span style="color: #228b22;"&gt;"\n"&lt;/span&gt;)
&lt;span style="color: #228b22;"&gt;"\n&amp;lt;/ul&amp;gt;"&lt;/span&gt;))))

(org-ref-get-html-bibliography)
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
&amp;lt;h1&amp;gt;Bibliography&amp;lt;/h1&amp;gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a name="#armiento-2014-high"&amp;gt;[armiento-2014-high] Armiento, R. and Kozinsky, B. and Hautier, G. and  Fornari, M. and Ceder, G., "High-throughput screening of perovskite alloys for  piezoelectric performance and thermodynamic  stability", Phys. Rev. B, 89:134103 (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#daza-2014-carbon-dioxid"&amp;gt;[daza-2014-carbon-dioxid] Daza, Yolanda A. and Kent, Ryan A. and Yung, Matthew  M. and Kuhn, John N., "Carbon Dioxide Conversion by Reverse Water-Gas Shift  Chemical Looping on Perovskite-Type Oxides", Industrial \&amp;amp; Engineering Chemistry Research, 53:5828-5837 (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#mehta-2014-ident-poten"&amp;gt;[mehta-2014-ident-poten] Mehta, Prateek and Salvador, Paul A. and Kitchin,  John R., "Identifying Potential \ce{BO_2} Oxide Polymorphs for  Epitaxial Growth Candidates", ACS Applied Materials \&amp;amp; Interfaces, 0:null (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#suntivich-2014-estim-hybrid"&amp;gt;[suntivich-2014-estim-hybrid] Suntivich, Jin and Hong, Wesley T. and Lee, Yueh-Lin  and Rondinelli, James M. and Yang, Wanli and  Goodenough, John B. and Dabrowski, Bogdan and  Freeland, John W. and Shao-Horn, Yang, "Estimating Hybridization of Transition Metal and  Oxygen States in Perovskites from O K-edge X-ray  Absorption Spectroscopy", The Journal of Physical Chemistry C, 118:1856-1863 (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#alesi-2012-evaluat-primar"&amp;gt;[alesi-2012-evaluat-primar] Alesi, W. Richard and Kitchin, John R., "Evaluation of a Primary Amine-Functionalized  Ion-Exchange Resin for \ce{CO_2} Capture", Industrial \&amp;amp; Engineering Chemistry Research, 51:6907-6915 (2012)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#day-1995-scien-englis"&amp;gt;[day-1995-scien-englis] Robert A. Day, "Scientific English: A Guide for Scientists and Other Profesionals", , : (1995)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;/ul&amp;gt;
&amp;lt;h1&amp;gt;Bibliography&amp;lt;/h1&amp;gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;a name="#armiento-2014-high"&amp;gt;[armiento-2014-high] Armiento, R. and Kozinsky, B. and Hautier, G. and  Fornari, M. and Ceder, G., "High-throughput screening of perovskite alloys for  piezoelectric performance and thermodynamic  stability", Phys. Rev. B, 89:134103 (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#daza-2014-carbon-dioxid"&amp;gt;[daza-2014-carbon-dioxid] Daza, Yolanda A. and Kent, Ryan A. and Yung, Matthew  M. and Kuhn, John N., "Carbon Dioxide Conversion by Reverse Water-Gas Shift  Chemical Looping on Perovskite-Type Oxides", Industrial \&amp;amp; Engineering Chemistry Research, 53:5828-5837 (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#mehta-2014-ident-poten"&amp;gt;[mehta-2014-ident-poten] Mehta, Prateek and Salvador, Paul A. and Kitchin,  John R., "Identifying Potential \ce{BO_2} Oxide Polymorphs for  Epitaxial Growth Candidates", ACS Applied Materials \&amp;amp; Interfaces, 0:null (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;li&amp;gt;&amp;lt;a name="#suntivich-2014-estim-hybrid"&amp;gt;[suntivich-2014-estim-hybrid] Suntivich, Jin and Hong, Wesley T. and Lee, Yueh-Lin  and Rondinelli, James M. and Yang, Wanli and  Goodenough, John B. and Dabrowski, Bogdan and  Freeland, John W. and Shao-Horn, Yang, "Estimating Hybridization of Transition Metal and  Oxygen States in Perovskites from O K-edge X-ray  Absorption Spectroscopy", The Journal of Physical Chemistry C, 118:1856-1863 (2014)&amp;lt;\a&amp;gt;&amp;lt;li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/p&gt;


&lt;p&gt;
That is basically all we need. The citation links will export as hrefs to these named targets, so they should work fine. All we need to do is modify the blogofile code a bit to use this, and add those functions to org-ref, and we should get a bibliography in our blogposts.
&lt;/p&gt;

&lt;p&gt;
&lt;h1&gt;Bibliography&lt;/h1&gt;
&lt;ul&gt;&lt;li&gt;&lt;a id="armiento-2014-high"&gt;[armiento-2014-high] Armiento, R. and Kozinsky, B. and Hautier, G. and  Fornari, M. and Ceder, G., "High-throughput screening of perovskite alloys for  piezoelectric performance and thermodynamic  stability", Phys. Rev. B, 89:134103 (2014). &lt;a href="http://link.aps.org/doi/10.1103/PhysRevB.89.134103"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1103/PhysRevB.89.134103"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="daza-2014-carbon-dioxid"&gt;[daza-2014-carbon-dioxid] Daza, Yolanda A. and Kent, Ryan A. and Yung, Matthew  M. and Kuhn, John N., "Carbon Dioxide Conversion by Reverse Water-Gas Shift  Chemical Looping on Perovskite-Type Oxides", Industrial \&amp; Engineering Chemistry Research, 53:5828-5837 (2014). &lt;a href="http://pubs.acs.org/doi/abs/10.1021/ie5002185"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1021/ie5002185"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="mehta-2014-ident-poten"&gt;[mehta-2014-ident-poten] Mehta, Prateek and Salvador, Paul A. and Kitchin,  John R., "Identifying Potential \ce{BO_2} Oxide Polymorphs for  Epitaxial Growth Candidates", ACS Applied Materials \&amp; Interfaces, 0:null (2014). &lt;a href="http://pubs.acs.org/doi/abs/10.1021/am4059149"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1021/am4059149"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="suntivich-2014-estim-hybrid"&gt;[suntivich-2014-estim-hybrid] Suntivich, Jin and Hong, Wesley T. and Lee, Yueh-Lin  and Rondinelli, James M. and Yang, Wanli and  Goodenough, John B. and Dabrowski, Bogdan and  Freeland, John W. and Shao-Horn, Yang, "Estimating Hybridization of Transition Metal and  Oxygen States in Perovskites from O K-edge X-ray  Absorption Spectroscopy", The Journal of Physical Chemistry C, 118:1856-1863 (2014). &lt;a href="http://pubs.acs.org/doi/abs/10.1021/jp410644j"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1021/jp410644j"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="alesi-2012-evaluat-primar"&gt;[alesi-2012-evaluat-primar] Alesi, W. Richard and Kitchin, John R., "Evaluation of a Primary Amine-Functionalized  Ion-Exchange Resin for \ce{CO_2} Capture", Industrial \&amp; Engineering Chemistry Research, 51:6907-6915 (2012). &lt;a href="https://doi.org/10.1021/ie300452c"&gt;link&lt;/a&gt; &lt;a href="https://doi.org/10.1021/ie300452c"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a id="day-1995-scien-englis"&gt;[day-1995-scien-englis] Robert A. Day, "Scientific English: A Guide for Scientists and Other Profesionals", , : (1995). &lt;a href=""&gt;link&lt;/a&gt; &lt;a href="https://doi.org/"&gt;doi&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;Copyright (C) 2014 by John Kitchin. See the &lt;a href="/copying.html"&gt;License&lt;/a&gt; for information about copying.&lt;p&gt;&lt;p&gt;&lt;a href="/org/2014/05/17/Exporting-citations-in-html.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.6&lt;/p&gt;
]]></content:encoded>
    </item>
  </channel>
</rss>
