
O librarian
pacote analisa bibfiles sem executar bibtex ou biber. Porém, caso alguém configure \AbbreviateFirstname
e um nome no bibfile consista em apenas uma palavra, a compilação trava.
Exemplo mínimo (não) funcional:
\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}
Se eu comentar \AbbreviateFirstname
ou o segundo \Cite
, o MWE funciona.Coma segunda citaçãoe \AbbreviateFirstname
, a compilação 1 não termina (na segunda execução). Somente após um aborto manual, recebo a mensagem:
! Interruption.
\lb@temp ->\lb@eoe
\spacefactor 1000.
l.28 ...{foo}{\ReadName{\Firstname \Lastname}}{??}
O que posso fazer para obter uma compilação correta (por exemplo, com um vazio \Firstname
) ou pelo menos uma mensagem de erro, sem alterar o bibfile?
1 Executado com TeX Live 2022, látex, pdflatex ou lualatex
Responder1
Algo assim talvez
\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}