Biblatex のタイトルエントリのフォーマット

Biblatex のタイトルエントリのフォーマット

を使用して出版物のリストをタイプセットしようとしておりbiblatex、エントリのタイトルを文頭大文字 (または大文字/小文字/タイトルケース) に変更したいと考えています。 を使用しようとしました\DeclareFieldFormat{title}{\MakeSentenceCase{#1}}が、うまくいかないようです。

MWE:

%\RequirePackage{filecontents}
\begin{filecontents}{pub.bib}
@article{article1,
    author={Author One and Author Two},
    title={Title of Article One},
    date= {2018},
    }
@article{article2,
    author={Author One and Author Two},
    title={Title of article two},
    date= {2017},
    }
\end{filecontents}
\documentclass{article}
\usepackage[
    backend=biber,
    sorting=ynt,
    giveninits=true,
    maxbibnames=99,
]{biblatex}
\DeclareFieldFormat*{title}{\MakeCapital{#1}}   % Change titles to sentence case
\addbibresource{pub.bib}
\begin{document}
\nocite{*}
\printbibliography[type=article, title={Publications}]
\end{document}

答え1

そのために使うべきですtitlecase

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

完全な MWE:

%\RequirePackage{filecontents}
\begin{filecontents}{pub.bib}
@article{article1,
    author={Author One and Author Two},
    title={Title of Article One},
    date= {2018},
    }
@article{article2,
    author={Author One and Author Two},
    title={Title of article two},
    date= {2017},
    }
\end{filecontents}
\documentclass{article}
\usepackage[
    backend=biber,
    sorting=ynt,
    giveninits=true,
    maxbibnames=99,
]{biblatex}
\DeclareFieldFormat*{titlecase}{\MakeSentenceCase{#1}}   % Change titles to sentence case
\addbibresource{pub.bib}
\begin{document}
\nocite{*}
\printbibliography[type=article, title={Publications}]
\end{document}

ここに画像の説明を入力してください

アップデートtitlecase:ではなく を使用する理由の説明がtitleここでは役立つかもしれません。 のマクロの定義を見ると、titlebiblatex.defのことがわかります。

\newbibmacro*{title}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {\printtext[title]{%
       \printfield[titlecase]{title}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{subtitle}}%
     \newunit}%
  \printfield{titleaddon}}

書式指定が印刷指示[title]に適用されるtitle + subtitleことに注意してください。これは、いくつかの一般的なエントリタイプのタイトルを引用符で囲むこと、つまり「タイトル」と「サブタイトル」の両方に 1 組の引用符を設定することが参考文献スタイルの一般的な要件であるため必要です。書式指定は、およびに[titlecase]個別に適用されます。この結果、書式指定に を適用しようとすると、一連の および句読点指示が、それぞれに個別の書式指定とともに入力されることになります。お気づきのとおり、これはうまく動作しません。ただし、これがサニタイズされた文字列であったとしても、サブタイトルの最初の文字が望ましくない小文字になります (両方を に一緒に入力することになります)。つまり、簡単に言うと、は、 と を個別に処理できるようにするために存在しており、それが文の大文字小文字指定を適用する適切な範囲になります。titlesubtitle\MakeSentenceCasetitle\printfield[titlecase]\MakeSentenceCasetitlecasetitlesubtitle

関連情報