编译此MWE时:
\documentclass[]{article}
\usepackage{imakeidx}
\makeindex[name=persons]
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{book1,
author = "Greenwild, Dirk",
title = "Yellow pages",
year = "1998",
}
\end{filecontents}
\usepackage[backend=biber,bibstyle=authortitle,citestyle=verbose-trad1,indexing=cite]{biblatex}
\bibliography{\jobname}
%https://tex.stackexchange.com/questions/266415/biblatex-firstinit-problem
\renewbibmacro*{cite:full}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{%
\usedriver
{\DeclareNameAlias{sortname}{labelname-revinit}}
{\thefield{entrytype}}}%
\usebibmacro{shorthandintro}}
\DeclareNameFormat{labelname-revinit}{%
\nameparts{#1} %
\ifnum\value{uniquename}<2%
\ifuseprefix
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}
\else
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\fi
\usebibmacro{name:andothers}}
\makeatletter
\DeclareIndexNameFormat{default}{%
\nameparts{#1}
\usebibmacro{index:name}
{\index[persons]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}
}
\makeatother
\begin{document}
Foo\footnote{Footnote}.
Foo\footcite{book1}. text\cite{book1}.
\printindex[persons]
\end{document}
我的脚注中出现了虚假的不需要的空间:
有两个原因导致了这些空格:\renewbibmacro*{cite:full}{%
我曾经有过这功能,以及\DeclareIndexNameFormat{default}
我用来建立作者索引的功能。两者都增加了一些空间。我的问题与这 biblatex
错误。我使用biber 2.10
,biblatex 3.10
。
答案1
%
您的姓名格式中缺少了一些内容(请参阅行末百分号(%)有什么用?)。此外,您不再需要。在 周围\nameparts{#1}
也没有什么好的理由使用\makeatletter
/ 。最后,我以略微不同的方式缩进您的代码以显示正在发生的事情。\makeatother
\DeclareIndexNameFormat{default}
\DeclareNameFormat{labelname-revinit}{%
\ifnum\value{uniquename}<2%
\ifuseprefix
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}%
\else
\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\fi
\usebibmacro{name:andothers}}
\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}
{\index[persons]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}