2

When compiling this 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}

I get spurious unwanted spaces in my footcites:

result There is two things which causes thoses spaces: \renewbibmacro*{cite:full}{% which I use to have this functionality, and \DeclareIndexNameFormat{default} which I use to have authors index. Both of them adds some space. My problem is somewhat related with this biblatex bug. I use biber 2.10, biblatex 3.10.

andc
  • 941
  • 6
  • 15

1 Answers1

5

You were missing a few % in the name formats (see What is the use of percent signs (%) at the end of lines?). Additionally, you don't need the \nameparts{#1} any more. There were also no good reasons for \makeatletter/\makeatother around \DeclareIndexNameFormat{default}. Lastly, I indented your code slightly differently to show what is going on.

\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}}
moewe
  • 175,683