Biblatex authoryear 划线表示没有年份的条目

Biblatex authoryear 划线表示没有年份的条目

我使用 biblatex authoryear,并且有多个同一作者的条目,但没有年份。当我引用它们时,会显示字母来区分它们: 姆韦

但在参考书目中这些字母不会显示,你只能通过标题来区分它们。是否可以在参考书目中也显示这些字母?

\documentclass[a4paper,12pt]{article}%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@BOOK{bar1,
  title = {Text One},
  year = {},
  author = {Firstname Lastname},
}
@BOOK{bar2,
  title = {Text Two},
  year = {},
  author = {Firstname Lastname},
}
\end{filecontents}

\usepackage[backend=biber, style=authoryear-icomp, dashed=true]{biblatex}
\addbibresource{bib.bib}

\begin{document}

\cite{bar1} and \cite{bar2}

\printbibliography
\end{document}

答案1

如果没有设置,则默认情况下biblatex不会打印参考书目中的任何内容date

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {}
    {\printtext[parens]{%
       \iffieldsequal{year}{\thefield{datelabelsource}year}
         {\printdateextralabel}%
         {\printfield{labelyear}%
          \printfield{extrayear}}}}}%

您可以强制biblatex始终打印年份

\renewbibmacro*{date+extrayear}{%
  \printtext[parens]{%
    \iffieldsequal{year}{\thefield{datelabelsource}year}
      {\printdateextralabel}%
      {\printfield{labelyear}%
       \printfield{extrayear}}}}%

或者仅在没有年份时打印信件

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {\printfield{extrayear}}
    {\printtext[parens]{%
       \iffieldsequal{year}{\thefield{datelabelsource}year}
         {\printdateextralabel}%
         {\printfield{labelyear}%
          \printfield{extrayear}}}}}%

这适用于标准mergedate=true/mergdetae=compact设置,如果您有任何其他mergdate选择,则可能必须修改上述重新定义。

\documentclass[a4paper,12pt]{article}%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{bar1,
  title = {Text One},
  year = {},
  author = {Firstname Lastname},
}
@BOOK{bar2,
  title = {Text Two},
  year = {},
  author = {Firstname Lastname},
}
\end{filecontents}

\usepackage[backend=biber, style=authoryear, dashed=true]{biblatex}
\addbibresource{\jobname.bib}

\renewbibmacro*{date+extrayear}{%
  \printtext[parens]{%
    \iffieldsequal{year}{\thefield{datelabelsource}year}
      {\printdateextralabel}%
      {\printfield{labelyear}%
       \printfield{extrayear}}}}%

\begin{document}

\cite{bar1} and \cite{bar2}

\printbibliography
\end{document}

在此处输入图片描述

相关内容