author
这是将放入索引而不是 的解决方案shortauthor
:使用 shortauthor 和 biblatex 让作者显示在索引中
但我想对此进行扩展,并为索引中应出现的值设置一个特殊字段。包authorindex
建议为此字段authauthor
(真实作者)设置。目标是为“Elisabet Engdahl”设置一个索引条目,而不是两个:
因此第二个条目不应该存在。
这是我想出的办法,但它似乎忽略了我的authauthor
领域:
\documentclass[english]{scrartcl}
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{FreyTappe1991,
Author = {Frey, Werner and Tappe, Hans Thilo},
Howpublished = {Manuskript 30. Januar 1991},
Shortauthor = {F/T},
authautor = {Frey, Werner and Tappe, Hans Thilo},
Title = {{Zur Interpretation der X-bar-Theorie und zur Syntax des Mittelfeldes}},
Year = {1991}}
@phdthesis{Engdahl1980,
Author = {Engdahl, Elisabet Britt},
authauthor = {Engdahl, Elisabet},
Title = {The Syntax and Semantics of Questions in {Swedish}},
Type = {{PhD} dissertation},
School = {University of Massachusetts},
Note = {[Reproduced by GLSA, University of Massachusetts. Amherst, Ma. 1980]},
Year = {1980}}
@book{Engdahl1986,
Address = {Dordrecht},
Author = {Engdahl, Elisabet},
Publisher = {Reidel},
Title = {Constituent questions. {The} syntax and semantics of questions with special reference to {Swedish}},
Year = {1986}}
\end{filecontents}
\begin{filecontents}{authauthor.dbx}
\DeclareDatamodelFields[type=list, datatype=name]{
authauthor}
\DeclareDatamodelEntryfields{authauthor}
\end{filecontents}
\usepackage[
style=authoryear,
indexing=cite,
datamodel=authauthor
]{biblatex}
\bibliography{\jobname}
\usepackage{makeidx}
\makeindex
%% \renewbibmacro*{citeindex}{%
%% \ifciteindex
%% {\iffieldequalstr{labelnamesource}{shortauthor}
%% {\indexnames{author}}
%% {\iffieldequalstr{labelnamesource}{shorteditor}
%% {\indexnames{editor}}
%% {\indexnames{labelname}}}}
%% {}}
\renewbibmacro*{citeindex}{%
\ifciteindex
{\iffieldequalstr{labelnamesource}{shortauthor}
{\iffieldundef{authauthor}
{\indexnames{author}}
{\indexnames{authauthor}}}
{\iffieldequalstr{labelnamesource}{author}
{\iffieldundef{authauthor}% if defined use authauthor
{\indexnames{author}}
{\indexnames{authauthor}}} % if defined use this field
{\iffieldequalstr{labelnamesource}{shorteditor}
{\iffieldundef{autheditor}
{\indexnames{editor}}
{\indexnames{autheditor}}}
{\indexnames{labelname}}}}}
{}}
\begin{document}
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991} and \cite{Engdahl1980,Engdahl1986}
\clearpage
\printbibliography
\printindex
\end{document}
答案1
authauthor
是一个名单,所以你不能使用\iffieldundef
你需要使用\ifnameundef
\renewbibmacro*{citeindex}{%
\ifciteindex
{\iffieldequalstr{labelnamesource}{shortauthor}
{\ifnameundef{authauthor}
{\indexnames{author}}
{\indexnames{authauthor}}}
{\iffieldequalstr{labelnamesource}{author}
{\ifnameundef{authauthor}% if defined use authauthor
{\indexnames{author}}
{\indexnames{authauthor}}} % if defined use this field
{\iffieldequalstr{labelnamesource}{shorteditor}
{\ifnameundef{autheditor}
{\indexnames{editor}}
{\indexnames{autheditor}}}
{\indexnames{labelname}}}}}
{}}
autheditor
如果你想使用它,你还需要声明
\begin{filecontents}{authauthor.dbx}
\DeclareDatamodelFields[type=list, datatype=name]{
authauthor,
autheditor}
\DeclareDatamodelEntryfields{authauthor,autheditor}
\end{filecontents}