Sign up ×
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

1 Answer 1

up vote 20 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
4  
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

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.
http://tex.stackexchange.com/questions/22980/sentence-case-for-titles-in-biblatex/22981
tex.stackexchange.com
crawl=CC-MAIN-2015-48
81194
application/http; msgtype=response
sha1:MLJ7NVLHHTXI7V3DVM7NJWJHJW3EVOV6
<urn:uuid:c501c93a-ac7a-425f-9c01-ca9fb8acabe6>
2015-11-26T17:58:43Z
104.16.116.182
sha1:NRX22XYDOM3MZ5XHYWQAQRUE7SYZTZZ7
<urn:uuid:1efdaf8a-68dd-4926-96cb-881e1c19d0c8>
http://tex.stackexchange.com/questions/22980/sentence-case-for-titles-in-biblatex/22981
response
<urn:uuid:83c572c7-8520-447b-a159-9861748cef8e>
robots: classic
hostname: ip-10-71-132-137.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2015-48
operator: CommonCrawl Admin
description: Wide crawl of the web for Nov 2015
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf