
패키지 librarian
는 bibtex 또는 biber를 실행하지 않고 bibfile을 구문 분석합니다. 그러나 하나의 세트가 \AbbreviateFirstname
있고 bibfile의 이름이 한 단어로만 구성된 경우 컴파일이 중단됩니다.
최소(비) 작동 예:
\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}
\AbbreviateFirstname
또는 두 번째 주석을 처리하면 \Cite
MWE가 작동합니다.와 함께두 번째 인용그리고 \AbbreviateFirstname
, 컴파일 1 이 종료되지 않습니다(두 번째 실행에서). 수동으로 중단한 후에야 다음 메시지가 나타납니다.
! Interruption.
\lb@temp ->\lb@eoe
\spacefactor 1000.
l.28 ...{foo}{\ReadName{\Firstname \Lastname}}{??}
bibfile을 변경하지 않고 올바른 컴파일(예: 빈 \Firstname
) 또는 최소한 오류 메시지를 얻으려면 어떻게 해야 합니까?
1 TeX Live 2022, latex, pdflatex 또는 lualatex로 실행됨
답변1
아마도 그런 것
\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}