从 biblatex-chicago 中没有日期的在线条目中删除“nd”

从 biblatex-chicago 中没有日期的在线条目中删除“nd”

对于未注明日期的网站,我想(n.d.)从引文和参考文献中删除。我尝试调整解决方案这里到 biblatex-chicago 但我猜是一些其他需要重新定义的宏:

\documentclass{article}
\usepackage[authordate,backend=biber,indexing=true]{biblatex-chicago}
%\usepackage[style=authoryear-comp]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Who did what in the Beatles"}
@online{google,
    TITLE = "Google",
    URL = "https://www.google.com"}
\end{filecontents}
\addbibresource{\jobname.bib}

\renewbibmacro*{date+extradate}{%
  \ifboolexpr{test {\iffieldundef{labelyear}}
    or (test {\iffieldequalstr{labelyear}{nodate}}
        and test {\ifentrytype{online}})}
    {}
    {\printtext[parens]{%
       \iflabeldateisdate
         {\printdateextra}
         {\printlabeldateextra}}}}

\renewbibmacro*{cite:labeldate+extradate}{%
  \ifboolexpr{test {\iffieldundef{labelyear}}
    or (test {\iffieldequalstr{labelyear}{nodate}}
        and test {\ifentrytype{online}})}
    {}
    {\printtext[bibhyperref]{\printlabeldateextra}}}

\begin{document}
\textcites{lennon}{google}
\printbibliography
\end{document}

在此处输入图片描述

答案1

对于“nodate”检测,biblatex-chicago将缺失labelyear和显式文字nodate插入视为\DeclareLabeldate相同,因此我们不能使用改进的答案来从 biblatex 中没有日期的在线条目中删除“nd”(无日期)

biblatex-chicago有选择权nodates(从biblatex-chicago手动的,第 121 页)

nodates=true 此选项意味着,对于除 、 和 之外的所有条目类型inreferencemiscreference自动biblatex-chicago\bibstring{nodates}任何未提供引用日期和参考列表中条目标题的条目提供日期。如果您nodates=false在序言中设置,则包不会在任何条目类型中执行此替换。(bibstring 在英语中扩展为“nd”。)

不幸的是,该选项适用于所有类型(除了上面列出的三个例外),但我们只需几行代码就可以使该选项特定于特定类型。然后我们nodate=false只设置@online条目,而所有其他条目保留默认的nodate=true

\documentclass{article}
\usepackage[authordate,backend=biber,indexing=true]{biblatex-chicago}
%\usepackage[style=authoryear-comp]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon,
    AUTHOR = "John Lennon",
    TITLE = "Who did what in the Beatles"}
@online{google,
    author = {Victor},
    TITLE = "Google",
    URL = "https://www.google.com"}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\DeclareTypeOption[boolean]{nodates}[true]{%
  \settoggle{cms@nodates}{#1}}%

\ExecuteBibliographyOptions[online]{nodates=false}

\begin{document}
\textcites{lennon}{google}{baez/online}
\printbibliography
\end{document}

引文内容为“Lennon (nd),‘Google’,以及 Baez 和 Lauda (2004)”。参考书目条目现在以“Baez, John C., and Aaron D. Lauda. 2004. Higher....”、”“Google.””和“Lennon, John. nd”开头

相关内容