我正在使用 biblatex(后端:biber)和书目类别来自动构建我所有出版物的书目。原则上一切正常。我只是想缩短书目中我的名字,因为它出现得相当频繁(为了也显示我的合著者的名字,我仍然需要输出名字)。这是我使用的相关名称过滤器:
\DeclareBibliographyCategory{catname}%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\mknamesignature}[5]{\def#1{#2|||}}%%%%%%%%%%
\mknamesignature{\highlightname}{Surname}{Prename}{}%%%%%%
{}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareIndexNameFormat{catname}%%%%%%%%%%%%%%%%%%%%%%%%%%
{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mknamesignature{\currentsignature}{#1}{#3}{#5}{#7}%%%
\ifdefequal{\highlightname}{\currentsignature}%%%%%%%%
{\addtocategory{catname}{\thefield{entrykey}}}%%%%
{}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AtDataInput{\indexnames[catname][1-99]{author}}%%%%%%%%%%
然后我通过以下方式输出类别:
\printbibliography[category=catname]
有没有办法更改动态添加的条目的名称(当然不是在 bibtex 文件中)?因此,如果我的参考书目显示“姓氏,名字...”,我希望显示“SP...”之类的内容。
先感谢您!
答案1
根据 Guido 的建议,我现在使用以下修改后的代码(当然它也会“初始化”所有其他的名字和姓氏条目,但对于我的目的来说它是有效的):
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Replace my name in the bib by initials on the fly...%%%%%%%%%%%%%%%%%%%%
\usepackage{xstring}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\noexpandarg\exploregroups%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\orig@blx@bbl@entry\blx@bbl@entry%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\blx@bbl@entry#1\endentry{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\StrSubstitute{#1}{Prename}{P\bibinitperiod}[\Result]%%%%%%%%%%%%%%%%%%%%
\expandafter\StrSubstitute\expandafter{\Result}{Surname}{S\bibinitperiod%
}[\Result]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\expandafter\orig@blx@bbl@entry\Result\endentry}%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
再次感谢,祝一切顺利,克里斯蒂安