353

Titles of articles I'm about to cite contain upper case letters and when using BibTeX it converts them to lower case ones. This happens only in the title and only the first letter conserves its case. For example, when I cite an article about HF, the reader won't know if it is about Hafnium (Hf) or fluorine acid (HF).

I know that I can fix it manually in the .bbl file but I would like to avoid it, or fix it automatically.

binnev
  • 103
Crowley
  • 4,297
  • 3
    For the special case of chemical formulas I suggest to use \usepackage{mhchem} and write in the .bib file \ce{HF6Hf2}. – Jonas Stein May 21 '17 at 11:53
  • 3
    Is there any way to enforce Bibtex to just use the bibtex file AS IS??? Lev Bishop writes that "certain bst styles" leave everything as it should. Which? How? Thanks for an answer. This IS a bug, not a feature. Who on earth needs that? Why? (alexis is unconvincing) – Michael Aug 04 '20 at 06:09
  • @michael, a bit late for you but you didn't tag me so I never saw this before :-) People need the case-folding feature if they work in a field where both capitalization conventions are used. 1 minute of googling found me this review of citation styles on scribd, which includes this handy side-by-side comparison of APA vs. MLA style. Both are common in the humanities, but one capitalizes titles and one does not. Convinced yet? – alexis Dec 28 '22 at 09:25
  • "enforce Bibtex to just use the bibtex file AS IS" means use any style that capitalizes titles. I would spend another minute to find a bibstyle that does not fold capitalization, but that won't do anybody any good -- you need a style that matches the rest of your field's (or your publisher's) bibliographic conventions. – alexis Dec 28 '22 at 09:27

6 Answers6

370

This is not a bug; it's a feature. Depending on the bibliography style in use, BibTeX converts all characters in the title to lowercase, with the exception of the first character. If you want to override this, wrap the character(s) in curly braces, e.g.,

title = "Pascal, {C}, {Java}: were they all conceived in {ETH}?"
Mico
  • 506,678
Yossi Gil
  • 15,951
  • 36
    Well, bibtex does not always do this. Certain .bst files can choose to convert to ALL UPPERCASE, or to leave the capitalisation exactly as it was entered in the .bib file. – Lev Bishop Feb 10 '11 at 19:19
  • 4
    Incidentally, you should nearly always capitalise the subtitle, and I recommend capitalising all significant words, to allow for bibliography styles that want this. Then you get: title = "Pascal, {C}, {Java}: {Were} they all Conceived in {ETH}?" – Charles Stewart Feb 11 '11 at 09:38
  • Read the instractions if everyting else fails. – Igor Kotelnikov Mar 01 '11 at 15:28
  • Weird feature, given that the word "Árgon" will keep it's uppercase, probably because it's a special character. – A. Vieira Dec 04 '17 at 13:25
  • 49
    This is a crappy and annoying "feature" for people that want their titles to appear as they typed them. I have 100s of references that I have to manually add { } to, even though I carefully typed the titles already.

    Other styles e.g. rsc and asochem don't do this--but I need the APA style.

    – khaverim Jan 09 '18 at 23:03
  • 4
    @khaverim no need for doing it manually... you can use regexes to do that manually. title=\{([^{]+)\} matches titles with a single pair of {} around them and should be replaced with title={{\1}}. Might need some more love to catch all possible whitespaces and usage of " instead of {} but it's a start :) – stefanct Feb 08 '18 at 18:55
  • @stefanct: how exactly you do this? I tried to use the find/replace feature in bibdesk with the regex option and your idea above and couldn't make it work :( – Laura Sep 30 '18 at 05:59
  • 1
    @Laura: I was/am using Geany for such things (and pretty much everything else that is related to text files). I don't know bibdesk but debugging regex replacements is usually a two-step operation for me: 1. check that the search expression matches all required text, 2. ensure that the back-reference in the replacement text is working correctly. Possible problem areas often include escaping and line endings. Sorry for not being more specific. Maybe ask a dedicated question for bibdesk with some example input. – stefanct Oct 01 '18 at 08:47
  • @stefanct Thanks for bringing into knowledge of novices like me, the existence of regex. – kaka Jul 10 '21 at 21:05
  • If anyone needs a helper script for just making sure all titles are kept exactly as they are, here you go: (using R) https://gist.github.com/moritzpschwarz/1b42d687662ab63dd1ce206c35c8f038 – Moritz Schwarz Jan 22 '23 at 19:05
183

The loss of capitalization is by design: BibTeX does this because some, but not all citation styles require capitalization in titles (a.k.a. "title case"); other styles use ordinary case. Your bibliography database should work with both capitalization styles without modification, so BibTeX styles are designed to work as follows: You must write the title in the capitalized form, and your bst style either keeps it this way or converts it to lower case. Lower-casing works indiscriminately-- BibTeX does not try to guess which words are proper names, acronyms etc. (note that even letters in the middle of words get lower-cased). To protect words that should always be capitalized, you enclose them in braces.

Tl;dnr: Regardless of the capitalization style you want to see in your references, capitalize all content words in titles, and enclose proper names and the like in braces. Like this:

title = "A Short Grammar of {Middle} {English}: Graphemics, Phonemics and Morphemics"

NB: regular words must be capitalized, but not enclosed in braces. This is the only form that will work correctly with either citation style. With styles that use title case, it will appear as written (except for the braces). In citation styles that lowercase titles, it will appear as A short grammar of Middle English: Graphemics, phonemics and morphemics.

Notes:

  1. I've added this answer because all the existing answers are incomplete in my opinion: They show how to block BibTeX's lowercasing behavior, but not what it's for or how to use it properly. Even reputable references give bad advice in this respect.

  2. Although the BibTeX documentation suggests enclosing only the first letter in braces ({M}iddle {E}nglish), this interferes with proper kerning between letters and should be avoided. E.g., compare the spacing of Fo in {Font} (top: correct) and {F}ont (bottom: wrong).

    images of "Font" with kerning

  3. Watch out if you need braces in a title for other reasons: They will block lowercasing too, and title = "All About \emph{About}" will come out as All about \emph{About}. BibTeX actually used to deal with this properly: it will lowercase inside braces if they're immediately followed by a macro, as in old-style font commands like {\em About\/}. Unfortunately, this built-in behavior is no help with the modern syntax. You can still benefit from it, though, if you remember to type \emph{\relax About}. (Any command will work in place of \relax, as long as it immediately follows the offending brace.)

  4. Even the most careful authors will probably miss some capitals if their usual bst style lowercases everything, or some braces if it doesn't; so if you switch to a new style with different capitalization conventions, inspect your references carefully.

  5. There are in fact multiple styles of "title case", as detailed in this article. BibTeX cannot distinguish them: Either it preserves your title case or it doesn't. So choose one title-casing style, and use it in your titles.

alexis
  • 7,961
  • 2
    Can you elaborate on 2.: Do you have a reference for the kerning problem? Or even an example? So far, I always only enclosed the first letter. – boothby81 Oct 24 '13 at 11:43
  • 1
    Good question! I'm not sure where I read about it; at the moment I can only refer you to the discussion below Stefan Kottwitz's and Alan Munn's answers in this thread-- obviously I'm taking Stefan to be correct. The DIY example he suggests: "compare {T}ext to {Text} - the kerning between T and e." – alexis Oct 24 '13 at 13:12
  • 3
    @boothby81, I've constructed my own demonstration of the kerning problem, see above. – alexis Nov 15 '13 at 13:47
  • 3
    It's not just words that should always be capitalised. For example, "pH" should never be PH even in title case, the the lower case needs protecting. – Chris H Nov 15 '13 at 13:56
  • 3
    Actually, capital letters anywhere in the word must be protected, but the small "p" in "pH" does not need protection: Bibtex only changes upper case in titles to lower, never the reverse. – alexis Mar 03 '15 at 00:17
  • \emph{\relax About} does not work as expected: see https://tex.stackexchange.com/questions/276943/biblatex-how-to-to-emphasize-but-not-caps-protect – nickbart Nov 06 '15 at 11:01
  • 1
    @nickbart, thanks for the heads-up. As @egreg's answer to your question says, you're describing the behavior of biber (and biblatex), not bibtex. I can't say anything about either one. But the behavior you describe in your question and self-answer (especially the disappearance of italics with \emph{\relax Hello}) rather sounds like a bug to me. If someone more familiar with biber can clarify the situation, I'll add a note to this answer. – alexis Nov 07 '15 at 21:22
  • Does anyone have an example of a (readily-available) bibliography style that leaves the capitalization intact? – Patrick Sanan May 01 '19 at 15:08
  • 2
    It's 2019 now, but hopefully still useful for someone: hyphenated words which need capitalization protection are handled well. E.g. title={The Lattice-{Boltzmann} Method} and title={The {lattice-Boltzmann} Method} are displayed with the same kerning (with plain.bst and pdftex) – Bart Aug 18 '19 at 05:58
  • 1
    Jabref seems to warn me whenever I do not enclose all my capitals in braces. Should titles still be capitalized in this manner? – JessicaK Nov 19 '19 at 01:12
  • 1
    @JessikaK: Yes, they should. Bibtex's treatment of capitalization has not changed. Sounds like Jabref's "feature" was created by someone who doesn't understand the design rationale behind it (which I explained in my answer). – alexis Apr 08 '20 at 21:40
  • @alexis Doesn't "Graphemics, Phonemics and Morphemics" in your exemplary title also become lowercase? – ghx Apr 09 '20 at 13:56
  • 1
    I believe the first letter of a sentence (including after a colon) is not lower-cased, so "Graphemics" will not. – alexis Apr 10 '20 at 14:20
  • 3
    AFAIK, {M}iddle {E}nglish is most versatile—it even works with uppercase style. The kerning problem is not present with XeTeX or LuaTeX. If one works with pdfTeX and will never use uppercase style, it is good to use {Middle}; otherwise {M}iddle is better. – Eli4ph Nov 23 '20 at 09:20
  • 2
    All-uppercase style, interesting. – alexis Nov 26 '20 at 09:42
  • If anyone needs a helper script for just making sure all titles are kept exactly as they are, here you go: (using R) https://gist.github.com/moritzpschwarz/1b42d687662ab63dd1ce206c35c8f038 – Moritz Schwarz Jan 22 '23 at 19:05
62

If you do want to change all the bibliography entries then you can modify your style file. Copy it to mybst.bst and then edit the file to modify the function format.title to:

FUNCTION {format.title}
{ 
% title empty$
%    { "" }
%    { title "t" change.case$ }
%  if$
title
}

Then it didn't change the uppercase letters. Save the new file into your documents directory and try it. If it works, then you can move it into the local texmf tree.

Various styles can be downloaded from CTAN.

  • 11
    This is so far the best answer to this annoying bibtex styles "feature". Fortunately with biblatex we don't have to deal with this anymore. –  Jul 30 '15 at 10:56
  • 1
    @Joseph, it's annoying all right but it's a life-saver when you need to produce a bibliography in the opposite capitalization style from what you are used to. IF you've coded your bibliography to take advantage of this feature. – alexis Nov 30 '15 at 19:51
27

You could protect your titles by using additional braces: title = "{About HF}".

Stefan Kottwitz
  • 231,401
  • 6
    @Lev: In that case just around HF is ok. I would just not put braces around letters or parts of words, to preserve the kerning, so perhaps around whole words. It's not necessary to do it for a complete title. – Stefan Kottwitz Feb 10 '11 at 19:19
  • 4
    But if you put braces around whole words you lose hyphenation which seems like a worse thing to lose than kerning. – Alan Munn Feb 10 '11 at 19:32
  • 7
    @Alan: Braces don't need to prevent hyphenation. I verified it: also within a bibliography, words within braces in a BiBTeX's title were hyphenated. – Stefan Kottwitz Feb 10 '11 at 20:03
  • I needed two pairs of curly braces around the title to make this work in my setup. Hypenation works as expected. – Artem Pelenitsyn Dec 16 '18 at 15:09
21

The canonical reference for this kind of thing is Nicolas Markey's Tame the BeaST. For your example of HF, enter it as {HF} to keep the capitalisation.

Generally, it's better to only put the braces around the minimum part that needs fixed capitalization. Some publications want all UPPER CASE, some want Title Case, some want Sentence case. So for most flexibility an article about Hafnium and hydrofluoric acid should be entered as title = {The effects of {HF} on {Hf}}

Lev Bishop
  • 45,462
19

A neat trick to get the WYSIWYG effect in the titles of your bibtex is to use double curlies to encode the titles, e.g.:

@book{aitchison2001language,
  title={{Language Change: Progress or Decay?}},
  author={Aitchison, Jean},
  year={2001},
  publisher={Cambridge University Press}
}
alvas
  • 525
  • 4
    Wouldn't it suppress correct "capitalize all " when needed? – Crowley Apr 07 '15 at 13:29
  • 3
    It's a WYSIWYG effect, so if capitalize all is needed you need to see all caps to get all caps =) – alvas Apr 07 '15 at 13:59
  • 1
    This used to be the way to fix the problem of badly-written journal capitalization schemes interfering with your carefully-types title. Now I see biblatex overrides the double-curlies trick, at least when using IEEE (I haven't tested all the others yet). This is a bug, not a feature: it should honor this technique: if the .bib file is being generated from (correctly-capitalized) sources elsewhere, it is usually not possible to add curly braces around individual capitals. – Peter Flynn Jan 01 '18 at 23:00
  • @PeterFlynn I just tested the example and a few others with biblatex's standard styles (with sentence casing enabled) and biblatex-ieee and got the expected WYSIWYG result. If you get a different result then this could indeed be a bug, please report it at the biblatex bug tracker https://github.com/plk/biblatex/issues. – moewe May 22 '18 at 05:52
  • 2
    FWIW I think this is a bad approach. If you don't want the case changed, use a style that does not change the title to sentence case. Choosing this approach with styles that require sentence case (like APA) means that you do not conform to the style guide. – moewe May 22 '18 at 05:54
  • This works like a charm. A good technique for WYSIWYG despite aforementioned criticism. I personally liked this trick and it worked for my IEEE paper with IEEEtran.cls file included. – Amarjit Dhillon Jun 08 '18 at 05:12
  • A genius solution. Works like a charm and solved all the problems I've had. My boss gave me the work of someone else, and it is hard to go over a hundred references which all look like {PAMP}:an {PLOX}-based blabla on {S} and {B} or something. You've saved me a lot of pain, just searched and replaced. – Theo Dec 06 '18 at 16:00
  • This is a nice hack. I used the following regex to add double curlies to all the titles (it will not modify titles that already have double curlies). Search for: ^\s*title\s*=\s*\{([^{].*)\}, and replace with title={{$1}},. I used VSCode to do the job:) Note, this will work on single-line titles only. – Ivan Oct 23 '23 at 15:24
  • @moewe but what styles don't do this? – Clark Mar 05 '24 at 21:54
  • @Clark The standard biblatex styles come to mind. I don't use BibTeX all that often, so I can't name a style that doesn't do that off the top of my head (the core BibTeX and natbib styles do apply some sentence casing if I recall correctly). But either way, you could also modify the style to stop the sentence casing instead of WYSIWYG-ing your titles. – moewe Mar 06 '24 at 06:14
  • @moewe So BibTex styles do this, but most BibLatex styles don't? And how do you modify styles? And thanks a lot! – Clark Mar 07 '24 at 20:54
  • @Clark There are definitely BibTeX styles that don't do this, but since I'm not so familiar with them, I can't name one at the moment. The general procedure to change this is described in https://tex.stackexchange.com/a/10776/35864. You need to modify a renamed copy of the .bst file where you basically drop the "t" change.case$ calls. – moewe Mar 08 '24 at 06:47
  • @moewe Thanks! It is insane that this is so complicated... – Clark Mar 08 '24 at 07:57
  • @Clark Yes, .bst files are ... interesting. That's why Philipp Lehman invented biblatex: You can do everything 'from within LaTeX' there. – moewe Mar 08 '24 at 08:09
  • @moewe Yeah, I would switch to Biblatex in a heartbeat, but I heard it's not so easy to submit to arxiv this way, which I will one day do.. – Clark Mar 09 '24 at 10:17