
对于未注明日期的网站,我想(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
此选项意味着,对于除 、 和 之外的所有条目类型inreference
,misc
将reference
自动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}