我想使用缩写 F/T 来表示一对作者,但希望在索引中看到真实姓名。该包authorindex
可以使用特殊字段 authauthors 来实现这一点,但我们使用的是biblatex
。有没有办法用 达到同样的效果biblatex
?
\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}}
\end{filecontents}
\usepackage[
style=authoryear,
indexing=true
]{biblatex}
\bibliography{\jobname}
\makeindex
\begin{document}
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
\printbibliography
%\printindex
\end{document}
答案1
我们可以检查是否labelname
是其中一个short...
名称,并索引完整版本。无需额外的authautor
字段。
\renewbibmacro*{citeindex}{%
\ifciteindex
{\iffieldequalstr{labelnamesource}{shortauthor}
{\indexnames{author}}
{\iffieldequalstr{labelnamesource}{shorteditor}
{\indexnames{editor}}
{\indexnames{labelname}}}%
\indexfield{indextitle}}
{}}
如果您还启用了参考书目索引(在示例中已启用),那么您将需要执行相同的操作bibindex
:
\renewbibmacro*{bibindex}{%
\ifbibindex
{\iffieldequalstr{labelnamesource}{shortauthor}
{\indexnames{author}}
{\iffieldequalstr{labelnamesource}{shorteditor}
{\indexnames{editor}}
{\indexnames{labelname}}}%
\indexfield{indextitle}}
{}}
如果您坚持使用新字段,则需要定义新的数据模型。在 MWE 中,这是通过创建的filecontents
,但如果您打算有效地使用它,只需将文件保存indexname.dbx
到 TeX 可以找到的位置。然后您可以在中明确给出索引名称indexname
。
\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},
indexname = {Frey, Werner and Tappe, Hans Thilo},
Title = {{Zur Interpretation der X-bar-Theorie und zur Syntax des Mittelfeldes}},
Year = {1991}}
\end{filecontents}
\begin{filecontents}{indexname.dbx}
\DeclareDatamodelFields[type=list, datatype=name]{
indexname}
\DeclareDatamodelEntryfields{indexname}
\end{filecontents}
\usepackage[
style=authoryear,
indexing=true,
datamodel=indexname,
]{biblatex}
\bibliography{\jobname}
\usepackage{makeidx}
\makeindex
\renewbibmacro*{citeindex}{%
\ifciteindex
{\ifnameundef{indexname}
{\indexnames{labelname}}
{\indexnames{indexname}}%
\indexfield{indextitle}}
{}}
\renewbibmacro*{bibindex}{%
\ifbibindex
{\ifnameundef{indexname}
{\indexnames{labelname}}
{\indexnames{indexname}}%
\indexfield{indextitle}}
{}}
\begin{document}
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}
\clearpage
\printbibliography
\printindex
\end{document}
答案2
一种选择是使用shorthand
字段而不是shortauthor
。这意味着 cite 命令将仅使用简写(而不是年份),但实际上,这似乎更符合您在这种情况下的意图。无论如何,年份也可以通过以下方式获得\citeyear
(或者通过手动将其添加到简写中,如 moewe 在评论中所建议的那样)。
\documentclass[english]{scrartcl}
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{FreyTappe1991,
Author = {Frey, Werner and Tappe, Hans Thilo},
Howpublished = {Manuskript 30. Januar 1991},
shorthand = {F/T},
authautor = {Frey, Werner and Tappe, Hans Thilo},
Title = {{Zur Interpretation der X-bar-Theorie und zur Syntax des Mittelfeldes}},
Year = {1991}}
\end{filecontents}
\usepackage{makeidx}
\usepackage[
style=authoryear,
indexing=true
]{biblatex}
\addbibresource{\jobname.bib}
\makeindex
\begin{document}
Some text \cite{FreyTappe1991}
Some text \cite{FreyTappe1991}
Some text \cite{FreyTappe1991}
Some text \cite{FreyTappe1991} \citeyear{FreyTappe1991}
\printbibliography
\printindex
\end{document}
导致: