<?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>Sentence casing your bibtex entry journal titles</title>
      <link>https://kitchingroup.cheme.cmu.edu/blog/2014/10/14/Sentence-casing-your-bibtex-entry-journal-titles</link>
      <pubDate>Tue, 14 Oct 2014 08:48:19 EDT</pubDate>
      <category><![CDATA[bib]]></category>
      <guid isPermaLink="false">AJfx6-r6V4FGphWcdqmm0wkJAGU=</guid>
      <description>Sentence casing your bibtex entry journal titles</description>
      <content:encoded><![CDATA[



&lt;p&gt;
I previously talked about &lt;a href="http://kitchingroup.cheme.cmu.edu/blog/2014/10/12/Title-casing-bibtex-entry-journal-titles/"&gt;title-casing&lt;/a&gt; the titles of journal articles in bibtex entries. Here we describe an alternative transformation: sentence-casing. In sentence case the first word is capitalized, and all others (except proper nouns). We also should capitalize the first word of any subtitles, which we take to be the first word after a :. That is usually correct. We should also ignore any LaTeX commands, or protected words in the title.
&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;jmax-sentence-case-article&lt;/span&gt; (&lt;span style="color: #4682b4;"&gt;&amp;amp;optional&lt;/span&gt; key start end)
  &lt;span style="color: #228b22;"&gt;"Convert a bibtex entry article title to sentence-case. The&lt;/span&gt;
&lt;span style="color: #228b22;"&gt;arguments are optional, and are only there so you can use this&lt;/span&gt;
&lt;span style="color: #228b22;"&gt;function with `&lt;/span&gt;&lt;span style="color: #cd0000;"&gt;bibtex-map-entries&lt;/span&gt;&lt;span style="color: #228b22;"&gt;' to change all the title&lt;/span&gt;
&lt;span style="color: #228b22;"&gt;entries in articles."&lt;/span&gt;
  (interactive)
  (bibtex-beginning-of-entry)

  (&lt;span style="color: #8b0000;"&gt;let*&lt;/span&gt; ((title (bibtex-autokey-get-field &lt;span style="color: #228b22;"&gt;"title"&lt;/span&gt;))
         (words (split-string title))
         (start 0))
    (&lt;span style="color: #8b0000;"&gt;when&lt;/span&gt;
        (string= &lt;span style="color: #228b22;"&gt;"article"&lt;/span&gt; (downcase (cdr (assoc &lt;span style="color: #228b22;"&gt;"=type="&lt;/span&gt; (bibtex-parse-entry)))))
      (setq words (mapcar
                   (&lt;span style="color: #8b0000;"&gt;lambda&lt;/span&gt; (word)
                     (&lt;span style="color: #8b0000;"&gt;if&lt;/span&gt;
                         ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;match words containing {} or \ which are probably&lt;/span&gt;
                         ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;LaTeX or protected words&lt;/span&gt;
                         (string-match &lt;span style="color: #228b22;"&gt;"\\$&lt;/span&gt;&lt;span style="color: #228b22;"&gt;\\&lt;/span&gt;&lt;span style="color: #228b22;"&gt;|&lt;/span&gt;&lt;span style="color: #228b22;"&gt;{&lt;/span&gt;&lt;span style="color: #228b22;"&gt;\\&lt;/span&gt;&lt;span style="color: #228b22;"&gt;|&lt;/span&gt;&lt;span style="color: #228b22;"&gt;}&lt;/span&gt;&lt;span style="color: #228b22;"&gt;\\&lt;/span&gt;&lt;span style="color: #228b22;"&gt;|&lt;/span&gt;&lt;span style="color: #228b22;"&gt;\\\\"&lt;/span&gt; word)
                         word
                       (s-downcase word)))
                   words))
      
      ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;capitalize first word&lt;/span&gt;
      (setf (car words) (s-capitalize (car words)))

      ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;join the words&lt;/span&gt;
      (setq title (mapconcat 'identity words &lt;span style="color: #228b22;"&gt;" "&lt;/span&gt;))

      ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;capitalize a word after a :, eg. a subtitle, and protect it&lt;/span&gt;
      (&lt;span style="color: #8b0000;"&gt;while&lt;/span&gt;
          (string-match &lt;span style="color: #228b22;"&gt;"[a-z]:\\s-+&lt;/span&gt;&lt;span style="color: #228b22;"&gt;\\&lt;/span&gt;&lt;span style="color: #228b22;"&gt;(&lt;/span&gt;&lt;span style="color: #228b22;"&gt;[A-Z]&lt;/span&gt;&lt;span style="color: #228b22;"&gt;\\&lt;/span&gt;&lt;span style="color: #228b22;"&gt;)&lt;/span&gt;&lt;span style="color: #228b22;"&gt;"&lt;/span&gt; title start)
        (&lt;span style="color: #8b0000;"&gt;let&lt;/span&gt; ((char (substring title (match-beginning 1) (match-end 1))))
          (setf (substring title (match-beginning 1) (match-end 1))
                (format &lt;span style="color: #228b22;"&gt;"%s"&lt;/span&gt; (upcase char)))
          (setq start (match-end 1))))
            
      ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;this is defined in doi-utils&lt;/span&gt;
      (bibtex-set-field
       &lt;span style="color: #228b22;"&gt;"title"&lt;/span&gt; title)

      ;; &lt;span style="color: #ff0000; font-weight: bold;"&gt;clean and refill entry so it looks nice&lt;/span&gt;
      (bibtex-clean-entry)
      (bibtex-fill-entry))))
&lt;/pre&gt;
&lt;/div&gt;

&lt;pre class="example"&gt;
jmax-sentence-case-article
&lt;/pre&gt;

&lt;p&gt;
Now, we can easily convert this entry in title-case:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-bibtex"&gt;&lt;span style="color: #8b2323;"&gt;@article&lt;/span&gt;{&lt;span style="color: #cd0000;"&gt;arroyave-2005-ab-ni&lt;/span&gt;,
  &lt;span style="color: #8b008b;"&gt;author&lt;/span&gt; =       {R. Arroyave and D. Shin and Z.-K. Liu},
  &lt;span style="color: #8b008b;"&gt;title&lt;/span&gt; =        {Ab Initio Thermodynamic Properties of Stoichiometric
                  Phases in the {Ni-Al} System},
  &lt;span style="color: #8b008b;"&gt;journal&lt;/span&gt; =      {Acta Materialia },
  &lt;span style="color: #8b008b;"&gt;volume&lt;/span&gt; =       53,
  &lt;span style="color: #8b008b;"&gt;number&lt;/span&gt; =       6,
  &lt;span style="color: #8b008b;"&gt;pages&lt;/span&gt; =        {1809 - 1819},
  &lt;span style="color: #8b008b;"&gt;year&lt;/span&gt; =         2005,
  &lt;span style="color: #8b008b;"&gt;doi&lt;/span&gt; =          {&lt;span style="color: #3a5fcd; text-decoration: underline;"&gt;10.1016/j.actamat.2004.12.030&lt;/span&gt;},
  &lt;span style="color: #8b008b;"&gt;url&lt;/span&gt; =
                  {http://www.sciencedirect.com/science/article/pii/S1359645404007669},
  &lt;span style="color: #8b008b;"&gt;issn&lt;/span&gt; =         {1359-6454},
  &lt;span style="color: #8b008b;"&gt;keywords&lt;/span&gt; =     {Ab initio},
}
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
To this in sentence case:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-bibtex"&gt;&lt;span style="color: #8b2323;"&gt;@article&lt;/span&gt;{&lt;span style="color: #cd0000;"&gt;arroyave-2005-ab-ni&lt;/span&gt;,
  &lt;span style="color: #8b008b;"&gt;author&lt;/span&gt; =       {R. Arroyave and D. Shin and Z.-K. Liu},
  &lt;span style="color: #8b008b;"&gt;title&lt;/span&gt; =        {Ab initio thermodynamic properties of stoichiometric
                  phases in the {Ni-Al} system},
  &lt;span style="color: #8b008b;"&gt;journal&lt;/span&gt; =      {Acta Materialia },
  &lt;span style="color: #8b008b;"&gt;volume&lt;/span&gt; =       53,
  &lt;span style="color: #8b008b;"&gt;number&lt;/span&gt; =       6,
  &lt;span style="color: #8b008b;"&gt;pages&lt;/span&gt; =        {1809 - 1819},
  &lt;span style="color: #8b008b;"&gt;year&lt;/span&gt; =         2005,
  &lt;span style="color: #8b008b;"&gt;doi&lt;/span&gt; =          {&lt;span style="color: #3a5fcd; text-decoration: underline;"&gt;10.1016/j.actamat.2004.12.030&lt;/span&gt;},
  &lt;span style="color: #8b008b;"&gt;url&lt;/span&gt; =
                  {http://www.sciencedirect.com/science/article/pii/S1359645404007669},
  &lt;span style="color: #8b008b;"&gt;issn&lt;/span&gt; =         {1359-6454},
  &lt;span style="color: #8b008b;"&gt;keywords&lt;/span&gt; =     {Ab initio},
}
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
The function is written so you can use it with bibtex-map-entries to change all the titles in one shot like this:
&lt;/p&gt;

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

&lt;pre class="src src-bibtex"&gt;&lt;span style="color: #ff0000; font-weight: bold;"&gt;% (bibtex-map-entries 'jmax-sentence-case-article)&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
The function is &lt;i&gt;not&lt;/i&gt; perfect. For example in this next entry, the chemical symbols Mn, Fe, Co, Ni, are incorrectly lower-cased.
&lt;/p&gt;

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

&lt;pre class="src src-bibtex"&gt;&lt;span style="color: #8b2323;"&gt;@article&lt;/span&gt;{&lt;span style="color: #cd0000;"&gt;arroyo-2010-first-princ&lt;/span&gt;,
  &lt;span style="color: #8b008b;"&gt;author&lt;/span&gt; =       {Arroyo y de Dompablo, M. E. and Lee, Yueh-Lin and
                  Morgan, D.},
  &lt;span style="color: #8b008b;"&gt;title&lt;/span&gt; =        {First principles investigation of oxygen vacancies
                  in columbite \ce{MNb_2O_6} ({M = Mn, Fe, Co, Ni,
                  Cu})},
  &lt;span style="color: #8b008b;"&gt;journal&lt;/span&gt; =      {Chemistry of Materials},
  &lt;span style="color: #8b008b;"&gt;volume&lt;/span&gt; =       22,
  &lt;span style="color: #8b008b;"&gt;number&lt;/span&gt; =       3,
  &lt;span style="color: #8b008b;"&gt;pages&lt;/span&gt; =        {906-913},
  &lt;span style="color: #8b008b;"&gt;year&lt;/span&gt; =         2010,
  &lt;span style="color: #8b008b;"&gt;doi&lt;/span&gt; =          {&lt;span style="color: #3a5fcd; text-decoration: underline;"&gt;10.1021/cm901723j&lt;/span&gt;},
  &lt;span style="color: #8b008b;"&gt;url&lt;/span&gt; =          {&lt;span style="color: #3a5fcd; text-decoration: underline;"&gt;http://pubs.acs.org/doi/abs/10.1021/cm901723j&lt;/span&gt;},
  &lt;span style="color: #8b008b;"&gt;eprint&lt;/span&gt; =       {http://pubs.acs.org/doi/pdf/10.1021/cm901723j},
}
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
Here is the result of sentence casing:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;

&lt;pre class="src src-bibtex"&gt;&lt;span style="color: #8b2323;"&gt;@article&lt;/span&gt;{&lt;span style="color: #cd0000;"&gt;arroyo-2010-first-princ&lt;/span&gt;,
  &lt;span style="color: #8b008b;"&gt;author&lt;/span&gt; =       {Arroyo y de Dompablo, M. E. and Lee, Yueh-Lin and
                  Morgan, D.},
  &lt;span style="color: #8b008b;"&gt;title&lt;/span&gt; =        {First principles investigation of oxygen vacancies
                  in columbite \ce{MNb_2O_6} ({M = mn, fe, co, ni,
                  Cu})},
  &lt;span style="color: #8b008b;"&gt;journal&lt;/span&gt; =      {Chemistry of Materials},
  &lt;span style="color: #8b008b;"&gt;volume&lt;/span&gt; =       22,
  &lt;span style="color: #8b008b;"&gt;number&lt;/span&gt; =       3,
  &lt;span style="color: #8b008b;"&gt;pages&lt;/span&gt; =        {906-913},
  &lt;span style="color: #8b008b;"&gt;year&lt;/span&gt; =         2010,
  &lt;span style="color: #8b008b;"&gt;doi&lt;/span&gt; =          {&lt;span style="color: #3a5fcd; text-decoration: underline;"&gt;10.1021/cm901723j&lt;/span&gt;},
  &lt;span style="color: #8b008b;"&gt;url&lt;/span&gt; =          {&lt;span style="color: #3a5fcd; text-decoration: underline;"&gt;http://pubs.acs.org/doi/abs/10.1021/cm901723j&lt;/span&gt;},
  &lt;span style="color: #8b008b;"&gt;eprint&lt;/span&gt; =       {http://pubs.acs.org/doi/pdf/10.1021/cm901723j},
}
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
The Cu is not lower-cased because it has a } attached to it after the title is split into words. The original entry is not properly formatted, in my opinion. I was lazy in wrapping the whole string in braces, {M = Mn, Fe, Co, Ni, Cu}, to protect the capitalization of the elements in bibtex. The correct way to do this is the more verbose: {M} = {M}n, {F}e, {C}o, {N}i, {C}u, where each letter is individually protected.
&lt;/p&gt;

&lt;p&gt;
Still, the function can save a lot of keystrokes. You should still inspect the final results, to catch any unusual modifications. You do have your bibtex file under version control right?
&lt;/p&gt;

&lt;p&gt;
This function can also be found at &lt;a href="https://github.com/jkitchin/jmax/blob/master/jmax-bibtex.el"&gt;https://github.com/jkitchin/jmax/blob/master/jmax-bibtex.el&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/10/14/Sentence-casing-your-bibtex-entry-journal-titles.org"&gt;org-mode source&lt;/a&gt;&lt;p&gt;&lt;p&gt;Org-mode version = 8.2.7c&lt;/p&gt;]]></content:encoded>
    </item>
  </channel>
</rss>
