使用 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

相关内容