
El librarian
paquete analiza archivos bib sin ejecutar bibtex o biber. Sin embargo, en caso de que un \AbbreviateFirstname
nombre en el archivo bib consta de una sola palabra, la compilación se bloquea.
Ejemplo mínimo (no) 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}
Si comento \AbbreviateFirstname
o el segundo \Cite
, el MWE funciona.Conla segunda citay \AbbreviateFirstname
, la compilación 1 no finaliza (en la segunda ejecución). Solo después de cancelar manualmente, aparece el mensaje:
! Interruption.
\lb@temp ->\lb@eoe
\spacefactor 1000.
l.28 ...{foo}{\ReadName{\Firstname \Lastname}}{??}
¿Qué puedo hacer para obtener una compilación correcta (por ejemplo, con un archivo vacío \Firstname
) o al menos un mensaje de error, sin cambiar el archivo bib?
1 Ejecutado con TeX Live 2022, latex, pdflatex o lualatex
Respuesta1
Algo así tal vez
\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}