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.

If a title contains formatting commands, how can we hook in \MakeSentenceCase to ensure correct casing and, say, nesting of quotation marks? The example below doesn't work; the quotes are properly nested, but "Quotation Marks" is still title case.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{test.bib}
@article{ref,
  sorttitle = {Handle Quotation Marks within Article Titles},
  author = {Lastname, Firstname},
  title = {Handle \mkbibquote{Quotation Marks} within Article Titles},
  journal = {Journalname},
  volume = {10},
  date = {1},
  pages = {5--10}}
\end{filecontents}

\bibliography{test.bib}

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

\begin{document}
    \textcite{ref}
    \printbibliography
\end{document}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

As a workaround, you may use csquote's \MakeAutoQuote macro to define active characters which may be used instead of \mkbibquote. (In my example, I use « and ».)

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\MakeAutoQuote{«}{»}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{test.bib}
@article{ref,
  sorttitle = {Handle Quotation Marks within Article Titles},
  author = {Lastname, Firstname},
  title = {Handle «Quotation Marks» within Article Titles},
  journal = {Journalname},
  volume = {10},
  date = {1},
  pages = {5--10}}
\end{filecontents}

\bibliography{test.bib}

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

\begin{document}
    \textcite{ref}
    \printbibliography
\end{document}
share|improve this answer
    
This is a good solution. Thanks! –  Audrey Apr 23 '11 at 19:34

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.