11

How is "title case" defined in bibtex? Which is the list of words not to capitalize, and in which file is it defined? Is it possible to change it? I checked the .bst file, but apparently it's delegated to a function change.case whose definition I cannot find.

  • 5
    As far as I know, there is no "title case implementation" in BibTeX (or biblatex). There is a function to convert everything to sentence case (that is only the first word is capitalised, words wrapped in curly braces {} are left alone). Normally, you would give the title in Title Case wrapping only those words in braces that always have to be in uppercase and choose a style that does not change casing (if you need title case) or one that converts everything to sentence case. Example title = {The Newest Discoveries of {NASA}, live from {Florida}}. – moewe Mar 20 '14 at 9:05
  • 1
    Add {....} around the words that should definitely not be lower cased. Note that many journals have their own rules as to how titles should be cased. So you might like Topology on Manifolds of Genus 2, but the journal style dictates Topology on manifolds of genus 2. Only protect those that are actual names etc. – daleif Mar 20 '14 at 9:06
  • @moewe I see, so it's not implemented at all. Thanks. If you turn your comment into an answer, I'll accept it. – Federico Poloni Mar 20 '14 at 9:23
11

As far as I am aware, there is no BibTeX (nor any biblatex) style that implements a "convert to title case" macro/function (there was a question a while back on how to achieve this with biblatex, the answer shows a way to get started with such a macro in biblatex with Biber).

There is, however, a function to turn titles into sentence case (uppercase first letter of the first word, rest lowercased). It depends on the style though, if this function is used. If your style does that you will probably find a line like this in the .bst file title "t" change.case$.

Generally, titles in .bib files should be given in title case, where additionally words that always have to be capitalised in a certain way (names, acronyms, formulae etc.) are enclosed in curly braces {}.

Example

title = {From {Brouwer} to {Hilbert}: {The} Debate on the Foundations of Mathematics in the 1920s}
title = {{NASA} Ends Unmanned Launchings in {Florida}}

See also BibTeX loses capitals when creating .bbl file, especially Alexis' answer.

  • 1
    It is also a problem with the language: titles capitalisation in French is very different from English (roughly, only the first noun is capitalised, and the adjective if it precedes the noun). So directives should be written in .lbx file, for the case (!) of biblatex. – Bernard Mar 20 '14 at 10:24
  • @Bernard It is indeed heavily language-dependent, in German, for example there is (normally) no difference between title and sentence case. Often it is very tedious though to implement a macro that converts sentence case to title case, so giving the title in title case and convert it to sentence case if need be, seems the way forward. (BTW. What is this about .lbx files?) – moewe Mar 20 '14 at 11:56
  • 1
    @ moewe: .lbx files contain language-dependent strings, punctuation and a few other things (for biblatex). so it's a natural idea | at least for me – to put something like "capitalisation patterns" in such a file. What makes it quite complex is that in an english bibliography,say , a title can be in german or french. So this would require using a new field such as "title language". – Bernard Mar 20 '14 at 13:19
  • @Bernard Well, you can already tell biblatex the title language (langid field; this feature will somewhat be extended in biblatex v. 3). But the point is that title casing macros require a whole lot of machinery that is not yet available, it is not just a matter of putting it into the .lbx file. – moewe Mar 20 '14 at 16:22
  • I see. 'Twas only a suggestion about what is conceptually interesting. I know real life is not so simple… – Bernard Mar 20 '14 at 17:11
6

The change.case$ built-in function is described in the source (texk/bibtex-x/bibtex-4.c in TeX Live):

* The |built_in| function change.case$ pops the top two (string)
* literals; it changes the case of the second according to the
* specifications of the first, as follows.  (Note: The word `letters' in
* the next sentence refers only to those at brace-level~0, the top-most
* brace level; no other characters are changed, except perhaps for
* special characters, described shortly.)  If the first literal is the
* string t, it converts to lower case all letters except the very
* first character in the string, which it leaves alone, and except the
* first character following any |colon| and then nonnull |white_space|,
* which it also leaves alone; if it's the string l, it converts all
* letters to lower case; if it's the string u, it converts all
* letters to upper case; and if it's anything else, it complains and
* does no conversion.  It then pushes this resulting string.  If either
* type is incorrect, it complains and pushes the null string; however,
* if both types are correct but the specification string (i.e., the
* first string) isn't one of the legal ones, it merely pushes the second
* back onto the stack, after complaining.  (Another note: It ignores
* case differences in the specification string; for example, the strings
* t and T are equivalent for the purposes of this |built_in|
* function.)

That's complex and I didn't understand most of it, but in practice, I think that what needs to be remembered is that even after punctuation characters like ".", "!" or "?", the letters are converted to lower case by default... except after ":" (colon). Indeed,

title = {Test! Test? Test: Test. Test, Test}

in a .bib file yields:

\newblock Test! test? test: Test. test, test.

This only exception is rather strange and unexpected.

  • 1
    I found that ebracing the colon Test{:} Test... will work around this lone exception. However, I would prefer an alternate version without a colon exception. – Steven B. Segletes Sep 30 '14 at 17:46
5

This can be done in the following way, if you are willing to create a custom .bst file. In your document, you need the following lines:

\usepackage{titlecaps}
\Addlcwords{the of into}

where the \usepackage makes use of the titlecaps package which has the \titlecap macro. The \Addlcwords macro provides a list of words that should remain lower case and not be capitalized.

In your .bst file, you need to add a new macro:

FUNCTION {titlecap}
{ duplicate$ empty$
    { pop$ "" }
    { "\titlecap{" swap$ * "}" * }
  if$
}

The only thing left to do is to use it for the various document styles that you are formatting. For example, a line in your style might have said something like this:

title ". " * output

which prints the title, concatenates a period and outputs the result. Now, you would edit that to say:

title titlecap ". " * output

which will first apply the titlecap macro to title, before concatenating the period and outputting the result. the invocation of \titlecap in the macro will capitalize the first letter of each word, except those in the exclusion list. See package documentation at http://ctan.org/pkg/titlecaps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.