在 biblatex 2.7 中不打印在线条目的年份

在 biblatex 2.7 中不打印在线条目的年份

随着新版本的出现biblatex(可能在 2.6 版本中实现,参见https://tex.stackexchange.com/a/126261/9077),ONLINE现在会打印完整日期,这些信息取自字段URLDATE。我想隐藏该信息(以便它看起来就像在 2.5 版中一样)。

我可以在序言中添加\clearfield{labelmonth}\clearfield{labelday}来隐藏月份和日期,但是我不能添加\clearfield{labelyear},因为这也会从参考书目中的所有其他条目中删除年份。

我可以在序言中添加什么内容来抑制仅在条目中打印年份ONLINE

\documentclass{article}
\usepackage{csquotes,filecontents}
\usepackage[style=authoryear]{biblatex}
\AtEveryBibitem{\clearfield{labelmonth}}
\AtEveryBibitem{\clearfield{labelday}}
%\AtEveryBibitem{\clearfield{labelyear}}
\begin{filecontents}{\jobname.bib}
@BOOK{lennon1972,
    AUTHOR = "John Lennon",
    TITLE = "Peace on earth",
    YEAR = "1972"}
@ONLINE{googletranslate,
    TITLE = "Google Translate",
    SHORTHAND = "Google Translate",
    URL = "http://translate.google.com/",
    URLDATE = "2013-08-01"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
I managed to read \cite{lennon1972} with the help of \cite{googletranslate}.
\printbibliography
\end{document}

在此处输入图片描述

答案1

您可以有条件地清除所选类型的字段:

\AtEveryBibitem{%
  \ifentrytype{online}{%
    \clearfield{labelyear}%
  }{%
  }%
}

一个完整的例子

\documentclass{article}
\usepackage{csquotes,filecontents}
\usepackage[style=authoryear]{biblatex}
\AtEveryBibitem{\clearfield{labelmonth}}
\AtEveryBibitem{\clearfield{labelday}}

\AtEveryBibitem{%
  \ifentrytype{online}{%
    \clearfield{labelyear}%
  }{%
  }%
}

\begin{filecontents}{\jobname.bib}
@BOOK{lennon1972,
    AUTHOR = "John Lennon",
    TITLE = "Peace on earth",
    YEAR = "1972"}
@ONLINE{googletranslate,
    TITLE = "Google Translate",
    SHORTHAND = "Google Translate",
    URL = "http://translate.google.com/",
    URLDATE = "2013-08-01"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
I managed to read \cite{lennon1972} with the help of \cite{googletranslate}.
\printbibliography

\end{document}

在此处输入图片描述

答案2

您可以在序言中重新定义labeldate为忽略。生成时不再考虑此内容:urldateurldatelabeldate

\DeclareLabeldate{%
  \field{date}
  \field{eventdate}
  \field{origdate}
}

相关内容