用于biblatex
我的参考书目。定义\defbibentryset
并使用该\citeauthor
命令时,它仅引用集合中第一个键的作者,而不是全部。此外,它忽略了我的\AtEveryBibitem
指令(IE,它不会抑制诸如 ISSN 或 DOI 之类的字段)。关于如何解决这些问题,您有什么想法吗?
这是我的 MWE:
\begin{filecontents*}{\jobname.bib}
@ARTICLE{Iftimie.etal-largetimebehavior2003,
author = {Iftimie, Drago\c{s} and Lopes Filho, Milton C. and Nussenzveig Lopes,
Helena J.},
title = {On the large-time behavior of two-dimensional vortex dynamics},
journal = {Physica D -- Nonlinear Phenomena},
year = {2003},
volume = {179},
doi = {10.1016/S0167-2789(03)00028-9},
pages = {153--160}
}
@ARTICLE{Iftimie-LargeTimeBehavior2003,
author = {Iftimie, Drago\c{s} and Lopes Filho, Milton C. and Nussenzveig Lopes,
Helena J.},
title = {Large Time Behavior for Vortex Evolution in the Half-Plane},
journal = {Communications in Mathematical Physics},
year = {2003},
volume = {237},
pages = {441--469},
number = {3},
doi = {10.1007/s00220-003-0843-3},
issn = {0010-3616}
}
@ARTICLE{Iftimie.Kelliher-RemarksVanishingObstacle2009,
author = {Iftimie, Drago\c{s} and Kelliher, James~P.},
title = {Remarks on the Vanishing Obstacle Limit for a 3D Viscous Incompressible
Fluid},
journal = {Proceedings of the American Mathematical Society},
year = {2009},
volume = {137},
pages = {685--694},
number = {2}
}
\end{filecontents*}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[style=numeric-comp,%
sorting=nyt,sortcase=false,refsegment=section,%
citereset=none,subentry,%
backend=biber]{biblatex}
% Biblatex
\addbibresource{\jobname.bib}
\defbibentryset{Iftimie}{Iftimie-LargeTimeBehavior2003,Iftimie.etal-largetimebehavior2003,Iftimie.Kelliher-RemarksVanishingObstacle2009}
\AtEveryBibitem{\clearfield{url}}
\AtEveryBibitem{\clearfield{doi}}
\AtEveryBibitem{\clearfield{issn}}
\begin{document}
\section{Intro}
\par \citeauthor{Iftimie} wrote some papers \autocite{Iftimie-LargeTimeBehavior2003,Iftimie.etal-largetimebehavior2003}. Then another \autocite{Iftimie.Kelliher-RemarksVanishingObstacle2009}.
\printbibliography[heading=subbibliography,title={References},segment=1]
\end{document}
答案1
该类型的条目定义@set
了特殊字段entryset
,并从集合中的第一个条目继承数据,但除此之外,它被视为任何其他单个条目。因此\AtEveryBibitem
,\citeauthor
仅对条目起作用@set
,而不对集合成员起作用。该命令\entryset{<precode>}{<postcode>}
大致对当前集合的每个成员执行以下操作:
<precode>
\usedriver{}{<member entrytype>}
<postcode>
要对集合成员采取行动,您需要访问一些内部内容:
\makeatletter
\def\UseBibitemHook{\csuse{blx@hook@bibitem}}
\def\nodriver{\let\blx@driver\@gobble}
\makeatother
该\entryset
命令用于set
定义的书目驱动程序numeric.bbx
。该\AtEveryBibitem
钩子可以添加到<precode>
:
\DeclareBibliographyDriver{set}{%
\entryset
{\UseBibitemHook%
\ifbool{bbx:subentry}
{\printfield[bibentrysetcount]{entrysetcount}%
\setunit*{\addnbspace}}
{}}
{}%
\newunit\newblock
\usebibmacro{setpageref}%
\finentry}
但是,您可能最好只使用选项设置加载 biblatex:
doi=false,isbn=false,url=false
可以重新定义命令\citeauthor
from 来biblatex.def
作用于集合成员,而不是@set
条目本身:
\DeclareCiteCommand{\citeauthor}
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifentrytype{set}
{\nodriver%
\def\namelist{}%
\setcounter{setcount}{0}%
\setcounter{settotal}{0}%
\entryset{\indexnames[count:labelname]{labelname}}{\unspace}%
\def\namelist{}%
\entryset{%
\ifciteindex{\indexnames{labelname}}{}%
\printnames[set:labelname]{labelname}}{\unspace}}
{\ifciteindex{\indexnames{labelname}}{}%
\printnames{labelname}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newcounter{setcount}
\newcounter{settotal}
\DeclareIndexNameFormat{count:labelname}{%
\ifinnamelist{#1#3#5#7}{}{%
\namelistadd{#1#3#5#7}%
\stepcounter{settotal}}}
\DeclareNameFormat{set:labelname}{%
\ifinnamelist{#1#3#5#7}{}{%
\namelistadd{#1#3#5#7}%
\stepcounter{setcount}%
\renewbibmacro*{name:delim}[1]{\usebibmacro{set:name:delim}{#1}}%
\ifcase\value{uniquename}%
\usebibmacro{name:last}{#1}{#3}{#5}{#7}%
\or
\ifuseprefix
{\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
\or
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
\fi}}
\newbibmacro*{set:name:delim}[1]{%
\ifnumgreater{\value{setcount}}{1}
{\ifnumless{\value{setcount}}{\value{settotal}}
{\multinamedelim}
{\finalnamedelim}}
{}}
\newrobustcmd*{\namelistadd}[1]{\listxadd{\namelist}{\detokenize{#1}}}
\newrobustcmd*{\ifinnamelist}[1]{\xifinlist{\detokenize{#1}}{\namelist}}
答案2
doi
为了解决删除、issn
和的问题,url
可以加载xpatch
包(即\usepackage{xpatch}
),然后使用
\xpatchbibdriver{set}
{\printfield}
{\clearfield{doi}\clearfield{issn}\clearfield{url}\printfield}
{}
{}
以下是引用 中的所有作者的解决方案entryset
。 字段labelname
是在解析bib
文件以创建bbl
文件时创建的。bbl
仅包含有关集合中第一个条目的作者的信息。 但是,bbl
文件包含\set{key1,key2,...}
其中每个keyN
都是 中条目的键entryset
。
然后的想法是使用keyN
和使用它们来创建中的所有(作者)姓名的列表entryset
。
我们首先创建这样一个列表,同时创建两个计数器来保存作者总数和当前作者的计数器。
\newcommand{\AuthorList}{}
\newcounter{AuthorSetCount}
\newcounter{CurrentAuthorSet}
这些计数器用于解析作者列表的元素并在作者之间插入适当的分隔符。它们的用法如下:
\newcommand{\mycount}[1]{\addtocounter{AuthorSetCount}{1}}
\newcommand{\myitem}[1]{#1
\addtocounter{CurrentAuthorSet}{1}
\ifnumequal{\value{CurrentAuthorSet}}{\value{AuthorSetCount}}
{\addspace}
{\ifnumequal{\value{CurrentAuthorSet}}{\value{AuthorSetCount}-1}
{\addcomma\finalnamedelim}
{\addcomma\addspace}%
}%
}
为了填充列表,我们解析了一个名称列表。这是通过提供格式化指令来完成的
\DeclareNameFormat{myentryset}{%
\ifinlist{#1}{\AuthorList}
{}
{\listgadd{\AuthorList}{#1}}%
}
命令\set{...}
使用中的信息 ,其中两个参数是和。不幸的是,集合中的每个条目都会处理该条目的驱动程序。因此,我们必须禁用此功能,而是填充 中的作者列表。我们在 使用的命令定义中引入了一个条件,以便在引用中调用或在参考书目中调用时保护操作。在引用中,我们执行格式化指令以填充作者列表,否则将使用当前条目的驱动程序。biblatex
\entryset{}{}
pre-code
postcode
\entryset
entryset
\entryset
\makeatletter
\def\blx@entryset#1{%
\blx@ifdata{#1}
{\begingroup
\blx@imc@clearlist{pageref}%
\blx@getdata{#1}%
\blx@setoptions@type\abx@field@entrytype
\def\abx@field@entrysetcount{1}%
\blx@entryset@precode
\ifcitation{\printnames[myentryset]{author}}% Modified lines
{\blx@driver{\blx@imc@thefield{entrytype}}}% Modified lines
\blx@entryset@postcode%
\endgroup}
{}%
\let\do\blx@entryset@i}
\def\blx@entryset@i#1{%
\blx@imc@entrydata{#1}{%
\blx@entryset@precode
\ifcitation{\printnames[myentryset]{author}}% Modified lines
{\blx@driver{\blx@imc@thefield{entrytype}}}% Modified lines
\blx@entryset@postcode}}
\makeatother
最后一步是创建一个专门的引用命令
\DeclareCiteCommand{\CiteAllAuthorsInSet}{}{%
\ifentrytype{set}
{\entryset{}{}
\setcounter{AuthorSetCount}{0}
\forlistloop{\mycount}{\AuthorList}%
\forlistloop{\myitem}{\AuthorList}%
\setcounter{CurrentAuthorSet}{0}
\renewcommand{\AuthorList}{}}
{\printfield{labelname}}%
}{}{}
使用
\begin{document}
\par \CiteAllAuthorsInSet{Iftimie} wrote some papers \dots
\par \citeauthor{Iftimie} wrote some papers \autocite{Iftimie-LargeTimeBehavior2003,Iftimie.etal-largetimebehavior2003}. Then another \autocite{Iftimie.Kelliher-RemarksVanishingObstacle2009}.
\printbibliography[heading=subbibliography,title={References},segment=1]
\end{document}
看看\citeauthor
和之间的区别\CiteAllAuthorsInSet
。
以下是完整代码
\xpatchbibdriver{set}{\printfield}{\clearfield{doi}\clearfield{issn}\clearfield{url}\printfield}{}{}
\makeatletter
\def\blx@entryset#1{%
\blx@ifdata{#1}
{\begingroup
\blx@imc@clearlist{pageref}%
\blx@getdata{#1}%
\blx@setoptions@type\abx@field@entrytype
\def\abx@field@entrysetcount{1}%
\blx@entryset@precode
\ifcitation{\printnames[myentryset]{author}}
{\blx@driver{\blx@imc@thefield{entrytype}}}%
\blx@entryset@postcode%
\endgroup}
{}%
\let\do\blx@entryset@i}
\def\blx@entryset@i#1{%
\blx@imc@entrydata{#1}{%
\blx@entryset@precode
\ifcitation{\printnames[myentryset]{author}}
{\blx@driver{\blx@imc@thefield{entrytype}}}%
\blx@entryset@postcode}}
\makeatother
\newcommand{\AuthorList}{}
\DeclareNameFormat{myentryset}{%
\ifinlist{#1}{\AuthorList}
{}
{\listgadd{\AuthorList}{#1}}%
}
\newcounter{AuthorSetCount}
\newcounter{CurrentAuthorSet}
\newcommand{\mycount}[1]{\addtocounter{AuthorSetCount}{1}}
\newcommand{\myitem}[1]{#1
\addtocounter{CurrentAuthorSet}{1}
\ifnumequal{\value{CurrentAuthorSet}}{\value{AuthorSetCount}}
{\addspace}
{\ifnumequal{\value{CurrentAuthorSet}}{\value{AuthorSetCount}-1}
{\addcomma\finalnamedelim}
{\addcomma\addspace}%
}%
}
\DeclareCiteCommand{\CiteAllAuthorsInSet}{}{%
\ifentrytype{set}
{\entryset{}{}
\setcounter{AuthorSetCount}{0}
\forlistloop{\mycount}{\AuthorList}%
\forlistloop{\myitem}{\AuthorList}%
\setcounter{CurrentAuthorSet}{0}%
\renewcommand{\AuthorList}{}%
}
{\printnames{labelname}}%
}{}{}