TransWikia.com

BibTeX loses capitals when creating .bbl file

TeX - LaTeX Asked by Crowley on December 19, 2020

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.

6 Answers

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}?"

Correct answer by Yossi Gil on December 19, 2020

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

Answered by Stefan Kottwitz on December 19, 2020

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}}

Answered by Lev Bishop on December 19, 2020

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.

Answered by user2478 on December 19, 2020

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.

Answered by alexis on December 19, 2020

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}
}

Answered by alvas on December 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP