biblatex-chicago を使用して括弧内に年を入力します

biblatex-chicago を使用して括弧内に年を入力します

biblatex-chicago スタイルを使用し、年を括弧で囲みたいと思います。

そこで私はこの投稿の解決策に従いました: 年を囲む括弧

ただし、これはシカゴ スタイルを使用しない biblatex でのみ機能するようです。シカゴ スタイルを使用すると、内容のない括弧が参照の最後に追加されます。

MWE は次のとおりです。

\begin{filecontents*}{test.bib}
@INPROCEEDINGS{author2017,
  author = {Firstname Lastname},
  title = {My Title},
  year = {2017},
  pages = {123--124}
}
\end{filecontents*}

\documentclass{scrbook}
\usepackage[
    authordate,
    backend=biber,
]{biblatex-chicago}

% Try to add parentheses around year in bibliography
% however, they are added at the end
\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\renewbibmacro*{date}{\printtext[parens]{\printdate}}

\bibliography{test.bib}

\begin{document}
    \textcite{author2017}
    \printbibliography
\end{document}

moewe からの記事とソリューションによる拡張 MWE:

\begin{filecontents*}{\jobname.bib}
@INPROCEEDINGS{author2017inp,
  author = {Firstname Lastname},
  title = {My In Proceedings},
  year = {2017},
  pages = {123--124}
}
@ARTICLE{author2017art,
  author = {Firstname Lastname},
  title = {My Article},
  year = {2017},
  pages = {123--124}
}
@BOOK{author2017book,
  author = {Firstname Lastname},
  title = {My Book},
  year = {2017},
  pages = {123--124}
}

\end{filecontents*}

\documentclass{article}
\usepackage[
    authordate,
    backend=biber,
]{biblatex-chicago}

\addbibresource{\jobname.bib}

\makeatletter
\renewbibmacro*{cmsbibyear}{%
  \printtext[parens]{%
    \iftoggle{cms@origlabel}%
      {\usebibmacro{origyear+labelyear}}%
      {\iftoggle{cms@bothlabelnew}%
         {\usebibmacro{bothyear+oldstyle}}%
         {\iftoggle{cms@bothlabelold}%
            {\usebibmacro{bothyear+oldstyle}}%
            {\usebibmacro{labelyear+extrayear}}}}}%
  \ifcsdef{@cms@tempdate}%
    {\toggletrue{\@cms@tempdate}}%
    {}}%
\makeatother

\begin{document}
    \nocite{*}
    \printbibliography
\end{document}

答え1

biblatex-chicagoの日付処理は、CMS 標準に準拠していることを確認するために非常に複雑になっているため、変更するのは決して簡単ではありません。以下は、最も安全で最短の再定義のようです。ただし、ごくまれに望ましくない結果につながる可能性がありますが、私はまだそのようなケースに遭遇していません。

\begin{filecontents*}{\jobname.bib}
@INPROCEEDINGS{author2017,
  author = {Firstname Lastname},
  title = {My Title},
  year = {2017},
  pages = {123--124}
}
\end{filecontents*}

\documentclass{article}
\usepackage[
    authordate,
    backend=biber,
]{biblatex-chicago}

\addbibresource{\jobname.bib}

\makeatletter
\renewbibmacro*{cmsbibyear}{%
  \printtext[parens]{%
    \iftoggle{cms@origlabel}%
      {\usebibmacro{origyear+labelyear}}%
      {\iftoggle{cms@bothlabelnew}%
         {\usebibmacro{bothyear+oldstyle}}%
         {\iftoggle{cms@bothlabelold}%
            {\usebibmacro{bothyear+oldstyle}}%
            {\usebibmacro{labelyear+extrayear}}}}}%
  \ifcsdef{@cms@tempdate}%
    {\toggletrue{\@cms@tempdate}}%
    {}}%
\makeatother

\begin{document}
    \textcite{author2017}
    \printbibliography
\end{document}

エレガントに切り取られたMWE

関連情報