引用 @online 资源时隐藏年份

引用 @online 资源时隐藏年份

我正在使用biblatex这些选项backend=biber, style=authoryear, sorting=anyt

当引用@online资源时,我希望它只显示值year而不是列出的年份urldate。含义:

@online{resourceWithYear,
    label           = "Random Label",
    organization    = "Some organization",
    title           = "Lorem Ipsum",
    year            = "2018",
    month           = "April",
    url             = "https://localhost",
    urldate         = "2020-05-11",
}

\parencite{resourceWithYear}意味着(Random Label 2018)

但是使用这个:

@online{resourceWithNoYear,
    label           = "Other Label",
    organization    = "Some other organization",
    title           = "Consectetur adipisici",
    url             = "https://localhost",
    urldate         = "2020-05-11",
}

\parencite{resourceWithNoYear}应翻译为(Other Label)。目前它显示为(Other Label 2020),使用标签的年份值urldate

答案1

标准答案是从设置urldate中删除\DeclareLabeldate

\DeclareLabeldate{%
  \field{date}
  \field{year}
  \field{eventdate}
  \field{origdate}
  \literal{nodate}
}

这将

(随机标签 2018)

(其他标签 nd)

因为biblatex如果找不到日期就会产生“nd”。

如果您不想,也可以从定义中nodate删除。\literal{nodate}

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

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

\begin{filecontents}{\jobname.bib}
@online{resourceWithYear,
  label           = {Random Label},
  organization    = {Some organization},
  title           = {Lorem Ipsum},
  year            = {2018},
  month           = apr,
  url             = {https://localhost},
  urldate         = {2020-05-11},
}
@online{resourceWithNoYear,
  label           = {Other Label},
  organization    = {Some other organization},
  title           = {Consectetur adipisici},
  url             = {https://localhost},
  urldate         = {2020-05-11},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
\autocite{resourceWithYear,resourceWithNoYear}
\printbibliography
\end{document}

(随机标签 2018;其他标签)

正如问题下的评论,我已删除,sortingy=anyvt,因此 MWE 只使用sorting=nyt

我还将不正确的改为了,month = "April",但我更month = apr,希望将其改为。date = {2018-04},year = {2018}, month = apr,

相关内容