Splitbib 및 natbib 오류: 정의되지 않은 제어 시퀀스

Splitbib 및 natbib 오류: 정의되지 않은 제어 시퀀스

참고문헌 스타일에는 {natbib} 패키지를 사용하고 문서 끝 부분에 내 전기를 카테고리로 분리하기 위해 {splitbib} 패키지를 사용하고 있습니다. 예를 들어 한 그룹의 모든 기사, 다른 그룹의 모든 책입니다.

{splitbib}의 작성자는 {natbib} 패키지를 사용할 때 [export] 인수를 사용하라고 조언했습니다.

모든 것이 작동하고 있습니다. 원하는 대로 최종 문서가 생겼지만 문제는 LaTeX에서 "정의되지 않은 제어 시퀀스 \begin{thebibliography}"라는 오류 메시지가 표시된다는 것입니다.

{natbib} 패키지를 사용하지 않으면 오류가 발생하지 않습니다. [export] 인수 없이 {natbib} 패키지를 사용하면 가치가 있습니다. [export] 인수와 함께 {natbib} 패키지를 사용하면 작동하지만 오류 메시지가 나타납니다.

이 문제를 어떻게 해결할 수 있나요?

감사합니다

예는 다음과 같습니다.

\documentclass[a4paper,12pt]{book}

\usepackage[comma,longnamesfirst]{natbib}
\bibliographystyle{plainnat}
\usepackage[export]{splitbib}

\begin{category}{Articles}
\SBentries{Article1,Article2}
\end{category}
\begin{category}{Books}
\SBentries{Book1,Book2}
\end{category}

\usepackage{filecontents}

\begin{filecontents}{bibliography.bib}

@article{Article1,
author={Jhon Doe},
title={Blabla},
journal={Blabla},
year={2019},
volume={145},
number={4},
pages={1-25}
}
@book{Book2,
author={Fabrice Doe},
title={Blabla4},
journal={Blabla4},
year={2016},
volume={142},
pages={4-22}
}
\end{filecontents}

\begin{document}

I want to cite Article1~\cite{Article1} and then Book2~\cite{Book2}.

\bibliography{bibliography}

\end{document}

답변1

정의되지 않은 명령은 \begin{bibliography}가 아니지만 다음과 같습니다 \SBlongestlabel.

! Undefined control sequence.
\thebibliography ...\expandafter {\SBlongestlabel 
                                                  } \immediate \write \NMSB@...
l.1 \begin{thebibliography}{2}

이는 분명히 패키지의 버그이지만 작성자의 의도가 완전히 명확하지는 않습니다.

다음 패치가 작동할 수 있습니다.

\documentclass[a4paper,12pt]{book}

\usepackage[comma,longnamesfirst]{natbib}
\bibliographystyle{plainnat}
\usepackage[export]{splitbib}

\begin{category}{Articles}
\SBentries{Article1,Article2}
\end{category}
\begin{category}{Books}
\SBentries{Book1,Book2}
\end{category}

\usepackage{filecontents}

\begin{filecontents}{bibliography.bib}

@article{Article1,
author={Jhon Doe},
title={Blabla},
journal={Blabla},
year={2019},
volume={145},
number={4},
pages={1-25}
}
@book{Book2,
author={Fabrice Doe},
title={Blabla4},
journal={Blabla4},
year={2016},
volume={142},
pages={4-22}
}
\end{filecontents}
\makeatletter
\usepackage{xpatch}
\xpatchcmd\thebibliography
 {\expandafter\NMSB@tok\expandafter{\SBlongestlabel}}
 {\@ifundefined{SBlongestlabel}{\NMSB@tok{}}{\expandafter\NMSB@tok\expandafter{\SBlongestlabel}}}
 {}{\fail}
\makeatother
\begin{document}

I want to cite Article1~\cite{Article1} and then Book2~\cite{Book2}.


\bibliography{bibliography}

\end{document}

관련 정보