尝试循环遍历已修改set
驱动程序中的子条目,我得到了我无法理解biblatex
的行为。\entrydata*
打电话时
\renewcommand{\do}[1]{%
\message{^^Jxset Warning: inside loop for ##1^^J}%
\entrydata*{##1}{\message{^^Jxset Warning: entrydata check loop run for entrykey=\thefield{entrykey} with savedentrykey=\thefield{savedentrykey}^^J}}}%
\edef\xset@tempa{\thefield{entryset}}\expandafter\docsvlist\expandafter{\xset@tempa}%
在驱动程序中我得到
xset Warning: inside loop for A:V1
xset Warning: entrydata check loop run for entrykey=A:V1 with savedentrykey=
xset Warning: inside loop for A:V2
xset Warning: entrydata check loop run for entrykey=A:V2 with savedentrykey=
savedentrykey
据我了解,它应该在哪里A
并且不为空。
甚至
\entryset{\message{^^Jxset Warning: entryset pre code executed^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}}}
{\message{^^Jxset Warning: entryset post code executed^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}}}%
不起作用(可能应该起作用?)......
知道我错过了什么吗?
梅威瑟:
\documentclass{article}
\usepackage[ansinew]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[doi=false,defernumbers=true,backend=biber,subentry,sorting=nyt,sortsets=true,style=numeric-comp]{biblatex}
\usepackage{xpatch}
\newlinechar=`\^^J
\makeatletter
\begin{filecontents}{\jobname.bib}
@Set{A,
entryset = {A:V1,A:V2,A:V3},
}
@Book{A:V1,
author = {Rene Goscinny and Albert Uderzo}, title = {Asterix der Gallier},
maintitle = {Asterix und Obelix}, sorttitle = {Asterix und Obelix 01},
year = {1959}, isbn = {1234567890123},
publisher = {Dargaud}, location = {Paris},
volume = {1},
}
@Book{A:V2,
author = {Rene Goscinny and Albert Uderzo}, title = {Asterix und Kleopatra},
maintitle = {Asterix und Obelix}, sorttitle = {Asterix und Obelix 02},
year = {1968}, isbn = {2345678901234},
publisher = {Dargaud}, location = {Paris},
volume = {2},
}
@Book{A:V3,
author = {Rene Goscinny and Albert Uderzo}, title = {Asterix als Gladiator},
maintitle = {Asterix und Obelix}, sorttitle = {Asterix und Obelix 03},
year = {1969}, isbn = {3456789012345},
publisher = {Dargaud}, location = {Paris},
volume = {3},
}
\end{filecontents}
\DeclareBibliographyDriver{set}{%
\message{^^Jxset Warning: entering set driver^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}^^J}%
\renewcommand{\do}[1]{%
\message{^^Jxset Warning: inside loop for ##1^^J}%
\entrydata*{##1}{\message{^^Jxset Warning: entrydata check loop run for entrykey=\thefield{entrykey} with savedentrykey=\thefield{savedentrykey}^^J}}}%
\edef\xset@tempa{\thefield{entryset}}\expandafter\docsvlist\expandafter{\xset@tempa}%
\entryset{\message{^^Jxset Warning: entryset pre code executed^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}}}
{\message{^^Jxset Warning: entryset post code executed^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}}}%
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}
\makeatother
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案1
biblatex
3.11 之前的版本中有一个错误,会导致\entrydata*
无法保存entrykey
,因此savedentrykey
会是空的。这个问题是在以下时间发现并修复的:Biblatex - 如何使用“\entrydata*”访问“saveddate”?已解决(见https://github.com/plk/biblatex/pull/684尤其是此评论)。
使用当前的biblatex
3.12,我得到
xset Warning: entrydata check loop run for entrykey=A:V1 with savedentrykey=A
从\entrydata*
代码和
xset Warning: entryset pre code executed
entrykey=A:V1 savedentrykey=
xset Warning: entryset post code executed
entrykey=A:V1 savedentrykey=
从\setentry
循环中。
这是预期的输出:\setentry
不保存其“父”数据。默认情况下,@set
它只是其子条目的容器。它没有自己的有用数据。它拥有的唯一数据是为了排序目的,其他所有内容都包含在子项本身中。
如果您只想访问“父”集名称,则可以使用该字段,entryset
如下所示
\entryset{\message{^^Jxset Warning: entryset pre code executed^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}, entryset=\thefield{entryset}}}
{\message{^^Jxset Warning: entryset post code executed^^Jentrykey=\thefield{entrykey} savedentrykey=\thefield{savedentrykey}, entryset=\thefield{entryset}}}%
然后会给出
xset Warning: entryset pre code executed
entrykey=A:V1 savedentrykey=, entryset=A
xset Warning: entryset post code executed
entrykey=A:V1 savedentrykey=, entryset=A
并且适用于所有@set
子级,无需额外命令。