`\AbbreviateFirstname` im Bibliothekar führt zum Hängenbleiben der Kompilierung

`\AbbreviateFirstname` im Bibliothekar führt zum Hängenbleiben der Kompilierung

Das librarianPaket analysiert Bibfiles, ohne Bibtex oder Biber auszuführen. Wenn jedoch \AbbreviateFirstnameein Name in der Bibfile nur aus einem Wort besteht, bleibt die Kompilierung hängen.

Minimales (nicht) funktionierendes Beispiel:

\documentclass{article}

\usepackage{librarian}
\AbbreviateFirstname

\begin{filecontents}{bar.bib}
@article{foo1,
 author ={Anton Nonym},
 title  ={A title},
 journal={Top Journal},
 number ={42},
 year   ={2000}
}
@article{foo2,
 author ={Batman},
 title  ={Yet Another Title},
 journal={Flop Journal},
 number ={23},
 year   ={1999}
}
\end{filecontents}


\begin{document}

A paper by
\Cite{foo1}{foo}{\ReadName{\Firstname\ \Lastname}}{??} % works always
and
\Cite{foo2}{foo}{\ReadName{\Firstname\ \Lastname}}{??}.% hangs for \AbbreviateFirstname

\BibFile{bar.bib}
\end{document}

\AbbreviateFirstnameWenn ich das zweite auskommentiere \Cite, funktioniert das MWE.Mitdas zweite ZitatUnd \AbbreviateFirstname, die Kompilierung 1 wird (im zweiten Durchgang) nicht beendet. Erst nach einem Abbruch per Hand erhalte ich die Meldung:

! Interruption.
\lb@temp ->\lb@eoe 
                   \spacefactor 1000.
l.28 ...{foo}{\ReadName{\Firstname \Lastname}}{??}

Was kann ich tun, um eine korrekte Kompilierung (zB mit einem leeren \Firstname) oder zumindest eine Fehlermeldung zu erhalten, ohne die Bibdatei zu ändern?

1 Ausgeführt mit TeX Live 2022, latex, pdflatex oder lualatex

Antwort1

Sowas in der Art vielleicht

\documentclass{article}

\usepackage{librarian,etoolbox}
\AbbreviateFirstname
\makeatletter
\def\lb@@loopovernames#1#2#3#4{%
  \iflb@abbreviate
    \def\Firstname{}%
    \ifblank{#1}{}{\lb@abbreviate#1 lb@end }% add test for emptyness
  \else
    \def\Firstname{#1}%
  \fi
  \def\Von{#2}\def\Lastname{#3}\def\Junior{#4}%
  \lb@makerefname
  }
\makeatother
\begin{filecontents}{bar.bib}
@article{foo1,
 author ={Anton Nonym},
 title  ={A title},
 journal={Top Journal},
 number ={42},
 year   ={2000}
}
@article{foo2,
 author ={Batman},
 title  ={Yet Another Title},
 journal={Flop Journal},
 number ={23},
 year   ={1999}
}
\end{filecontents}


\begin{document}

A paper by
\Cite{foo1}{foo}{\ReadName{\Firstname\ \Lastname}}{??} % works always
and
\Cite{foo2}{foo}{\ReadName{\ifdefempty\Firstname{}{\Firstname\ }\Lastname}}{??}.% hangs for \AbbreviateFirstname

\BibFile{bar.bib}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen