防止在线引用的 biblatex 日期输出

防止在线引用的 biblatex 日期输出

我不想打印年份(也不想打印可能的作者),而只想要Online打印引用类型。

下面是我想要删除的内容的示意图(红色):

在此处输入图片描述

这是我的 MWE:

% arara: xelatex
% arara: biber
% arara: xelatex

\documentclass{scrartcl}
\usepackage[backend=biber,style=authoryear,sorting=nty]{biblatex}
\addbibresource{mwe.bib}

\begin{document}
Example\cite{tab:test}

\printbibliography
\end{document}

mwe.bib

@Online{tab:test,
  Url                      = {http://www.example.com/images/image.jpg},
  Urldate                  = {2014-02-25},
  Timestamp                = {2014.06.13},
  Note                     = {Table \ref{tab:test}}
}

这个问题很难解决用于引用图像和表格的自定义 biblatex 样式,代表了更狭窄的要求

答案1

这将删除日期。但请注意,此代码将仅打印书目中“在线”类型的书目项目的“注释”、“URL”和“URLdate”字段,即使还有其他领域

\documentclass{scrartcl}
\usepackage[colorlinks, urlcolor=black]{hyperref} %if you want the link to be clickable

\usepackage{filecontents} 
\begin{filecontents} {mwe.bib}
@online{tab:test,
  author                   = {Doe, John},
  Url                      = {http://www.example.com/images/image.jpg},
  Urldate                  = {2014-02-25},
  Timestamp                = {2014.06.13},
  Note                     = {Table \ref{tab:test}}, %not sure I understand why you are cross-referencing here
  year                     = {2014}, %this is necessary for the in-text citation to work
}
\end{filecontents}

\usepackage[backend=biber, backref=true, style=authoryear, sorting=nty]{biblatex}
\addbibresource{mwe.bib}

\DeclareBibliographyDriver{online}{%this defines what will be printed in the bibliography for entries of type 'online'
  \usebibmacro{note+pages}
  \setunit{\addperiod\addspace}%Period+space after 'Note' field
  \usebibmacro{url+urldate}
  \usebibmacro{finentry}}

\begin{document}
Example \citeyear{tab:test} %This lets you cite only the year even if there is an author listed in your bib file, as opposed to \cite

\printbibliography
\end{document}

结果

相关内容