我正在尝试自定义 biblatex 的 authoryear.bbx 文件以包含原始出版日期。我的简单策略是:
- 定义 printorigdate 命令
- 将该命令包装成 \iffieldundef 命令并将其插入到我定制的 authoryear.bbx 的作者宏中
然而,即使存在 origdate 字段,我总是从 iffieldundef 得到负面结果。
这是一个简单的例子,为了清楚起见添加了调试字符串:
\documentclass{article}
\begin{filecontents}{\jobname.bib}
@MvBook{Hegel1970a,
author = {Hegel, Georg Wilhelm Friedrich},
title = {Werke [in zwanzig Bänden]},
editor = {Eva Moldenhauer and Karl Markus Michel},
langid = {german},
publisher = {Suhrkamp},
volumes = {20},
abstract = {Auf der Grundlage der Werke von 1832-1845 neu edierte Ausgabe},
address = {Frankfurt am Main},
shortitle = {TWA},
year = {1986},
origdate = {1969/1971}
}
@Book{Hegel1971a,
author = {Hegel, Georg Wilhelm Friedrich},
title = {Frühe Schriften},
shortitle = {TW1},
year = {1986},
langid = {german},
volume = {1},
modificationdate = {2024-02-20T17:30:50},
crossref = {Hegel1970a},
}
}
\end{filecontents}
% \usepackage[bibstyle=authoryear-ibid-movie,citestyle=authoryear-icomp, sorting=nyt]{biblatex}
\usepackage[bibstyle=authoryear-ibid,citestyle=authoryear-icomp, sorting=nyt]{biblatex}
\DeclareFieldFormat{origdate}{\mkbibbrackets{#1}}
\renewbibmacro*{author}{%
\ifboolexpr{
test \ifuseauthor
and
not test {\ifnameundef{author}}
}
{\usebibmacro{bbx:dashcheck}
{\bibnamedash}
{\usebibmacro{bbx:savehash}%
\printnames{author}\space\printfield[parens]{nameaddon} %line added to include the name addon
\iffieldundef{authortype}
{\setunit{\printdelim{nameyeardelim}}}
{\setunit{\printdelim{authortypedelim}}}}%
\iffieldundef{authortype}
{}
{\usebibmacro{authorstrg}%
\setunit{\printdelim{nameyeardelim}}}}%
{\global\undef\bbx@lasthash
\usebibmacro{labeltitle}%
\setunit*{\printdelim{nonameyeardelim}}}%
\usebibmacro{date+extradate}
%%%%%%%%%%%%%
%%%%%%%%%%%%% ADDED LINES
\iffieldundef{origdate}%
{\mkbibbrackets{NO ORIG DATE}}
{\printorigdate}
%%%%%%%%%%%%
%%%%%%%%%%%%
}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
我期望第一个参考日期后看到 [NO ORIG DATE],第二个参考日期后看到 [1969-1971]。然而,我得到的却是:
我做错了什么? \iffieldundef 是否执行了不同的测试?