Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to have the titles of articles in Biblatex in sentence case (first word capitialized, the rest lowercase, override with {}) as is the default in Bibtex.

I tried:

\DeclareFieldFormat{titlecase}{\MakeSentenceCase{#1}}

However it also makes converts other fields into sentence case, such as the booktile:

[Pai99] P Paillier. “ Public-key cryptosystems based on composite degree residuosity classes”. Eurocrypt. 1999 

I'd like:

[Pai99] P Paillier. “ Public-key cryptosystems based on composite degree residuosity classes”. EUROCRYPT. 1999

(This assumes that booktitle is EUROCRYPT in the .bib file)

Is there anyway to do this, short of adding {} to each booktitle entry?

share|improve this question
add comment

1 Answer

up vote 16 down vote accepted

The format definition

\DeclareFieldFormat{titlecase}{\MakeSentenceCase{#1}}

makes all titles in sentence case, which isn't what you want. Titles need to be printed according to both the entry and field types. For example, with the title field we need to handle @article and @book entries differently. With @inproceedings entries we need to handle the title and booktitle fields differently.

To do this we can redefine the title bibmacro to print the title field of @article and any @in* entry type in sentence case. Taking the original definition found in biblatex.def:

\DeclareFieldFormat{sentencecase}{\MakeSentenceCase{#1}}

\renewbibmacro*{title}{%
  \ifthenelse{\iffieldundef{title}\AND\iffieldundef{subtitle}}
    {}
    {\ifthenelse{\ifentrytype{article}\OR\ifentrytype{inbook}%
      \OR\ifentrytype{incollection}\OR\ifentrytype{inproceedings}%
      \OR\ifentrytype{inreference}}
      {\printtext[title]{%
        \printfield[sentencecase]{title}%
        \setunit{\subtitlepunct}%
        \printfield[sentencecase]{subtitle}}}%
      {\printtext[title]{%
        \printfield[titlecase]{title}%
        \setunit{\subtitlepunct}%
        \printfield[titlecase]{subtitle}}}%
     \newunit}%
  \printfield{titleaddon}}

Alternatively we can identify book-like entries directly and apply sentence casing to everything else. This is trickier because many more types qualify as book-like references and titles for these sources are printed by more than just one macro. In biblatex.def these include: title, booktitle, maintitle, journal, periodical and issue. To avoid redefining all of these, you can redefine the titlecase format instead.

\DeclareFieldFormat{titlecase}{\MakeTitleCase{#1}}

\newrobustcmd{\MakeTitleCase}[1]{%
  \ifthenelse{\ifcurrentfield{booktitle}\OR\ifcurrentfield{booksubtitle}%
    \OR\ifcurrentfield{maintitle}\OR\ifcurrentfield{mainsubtitle}%
    \OR\ifcurrentfield{journaltitle}\OR\ifcurrentfield{journalsubtitle}%
    \OR\ifcurrentfield{issuetitle}\OR\ifcurrentfield{issuesubtitle}%
    \OR\ifentrytype{book}\OR\ifentrytype{mvbook}\OR\ifentrytype{bookinbook}%
    \OR\ifentrytype{booklet}\OR\ifentrytype{suppbook}%
    \OR\ifentrytype{collection}\OR\ifentrytype{mvcollection}%
    \OR\ifentrytype{suppcollection}\OR\ifentrytype{manual}%
    \OR\ifentrytype{periodical}\OR\ifentrytype{suppperiodical}%
    \OR\ifentrytype{proceedings}\OR\ifentrytype{mvproceedings}%
    \OR\ifentrytype{reference}\OR\ifentrytype{mvreference}%
    \OR\ifentrytype{report}\OR\ifentrytype{thesis}}
    {#1}
    {\MakeSentenceCase{#1}}}
share|improve this answer
    
That does not seem to do what I want. That limits the application of sentence case to articles (as opposed to inproceedings, techreport, etc.). What I want is within an article bibtex entry (and other types), to have it applied to title but not to booktitle. –  PulpSpy Jul 13 '11 at 15:31
    
@PulpSpy I expanded my answer to multiple types. Sentence casing for everything but book titles is possible by redefining the title macro as I've done here: tex.stackexchange.com/q/16467/4483. I could elaborate using another edit to my answer. –  Audrey Jul 13 '11 at 15:39
    
Right I could see how to expand it to other types. What I am interested in is the second thing: within a given type (say article), have the title in SentenceCase and have the booktitle with no formatting (although I have no need to limit it to articles). –  PulpSpy Jul 13 '11 at 15:44
    
@PulpSpy Ah, I think I see now. The booktitle field doesn't apply to the article entry type. So your question had me thinking in terms of casing different types, not different titles within the same entry. I should have examined your example more closely. –  Audrey Jul 13 '11 at 17:13
3  
For future reference, if anyone attempts the solution above (which is great!), and gets a mysterious error when compiling, be aware of math formulas in the bib-file: \MakeSentenceCase does not handle maths like "$\alpha$", unless you write it within curly brackets (i.e., "{$\alpha$}"). –  Markus Jalsenius Jul 15 '11 at 21:31
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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