`tufte-book` 类和 `IEEEtran` 书目样式出现错误,“段落在 \BR@c@bibitem 完成之前结束。”

`tufte-book` 类和 `IEEEtran` 书目样式出现错误,“段落在 \BR@c@bibitem 完成之前结束。”

我收到以下错误:

(build/proposal-tufte-mwe.bbl
Runaway argument?
\BIBentryALTinterwordspacing S.~Koenig and M.~Likhachev, ``Fast repla\ETC.
! Paragraph ended before \BR@c@bibitem was complete.
<to be read again>
                   \par
l.30

?

搜索结果表明这可能是由%URL 中的字符引起的,但对我来说情况并非如此。

这是一个简单的例子:

\documentclass{tufte-book}

\usepackage{natbib}
\setcitestyle{square, numbers}  % `\documentclass{tufte-book}' uses `natbib` too. Avoid option clash

\begin{filecontents}{minimal-references.bib}
@article{koenigFastReplanningNavigation2005,
  title = {Fast Replanning for Navigation in Unknown Terrain},
  author = {Koenig, S. and Likhachev, M.},
  date = {2005-06},
  journaltitle = {IEEE Transactions on Robotics},
  doi = {10.1109/TRO.2004.838026},
  url = {http://ieeexplore.ieee.org/document/1435479/},
}
\end{filecontents}

\begin{document}
\mainmatter

\section{Related Work}
Such is the case in the heuristic incremental search for a navigation algorithm~\cite{koenigFastReplanningNavigation2005}.

% \backmatter

% debug bib
% \show\bibitem
% \show\BR@c@bibitem

\bibliographystyle{IEEEtran}
\bibliography{minimal-references}

\end{document}

当我按回车键“忽略”Runaway argument?错误时,我看到以下内容:

! Package natbib Error: Bibliography not compatible with author-year citations.

这让我很惊讶,因为有这句话\setcitestyle{square, numbers}

我不确定这是否有帮助,但我确实尝试调试:

$ latexdef --class tufte-book  --find \BR@b@bibitem
\BR@b@bibitem first defined in "/usr/local/texlive/2020/texmf-dist/tex/latex/natbib/bibentry.sty".

\BR@b@bibitem:
macro:->\@protected@testopt \BR@b@bibitem \\BR@b@bibitem {}

\\BR@b@bibitem first defined in "/usr/local/texlive/2020/texmf-dist/tex/latex/natbib/bibentry.sty".

\\BR@b@bibitem:
\long macro:[#1]#2->\ifthenelse {\isempty {#1}}{\BR@bibitem {#2}}{\BR@bibitem [#1]{#2}}\BR@c@bibitem {#2}

我并不一定要使用natbib,也许我应该使用nobib禁用它的选项tufte-book

我希望得到有关该错误的解释以及有关有效配置的建议。

答案1

tufte-book如果您使用biber(和选项nobib),您将节省大量时间。

biblatex-examples.bib我添加了分发版中包含的示例。

A

% !TeX TS-program = pdflatex % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   
\documentclass[nobib]{tufte-book}

\usepackage{csquotes}
\usepackage[backend=biber,
language=auto,
style=ieee,
natbib=true]{biblatex}

\addbibresource{minimal-references.bib}
\addbibresource{biblatex-examples.bib}

\begin{filecontents}[overwrite]{minimal-references.bib}
    @article{koenigFastReplanningNavigation2005,
        title = {Fast Replanning for Navigation in Unknown Terrain},
        author = {Koenig, S. and Likhachev, M.},
        date = {2005-06},
        journaltitle = {IEEE Transactions on Robotics}, 
        url = {http://ieeexplore.ieee.org/document/1435479/},
         doi = {10.1109/TRO.2004.838026},
    }
\end{filecontents}

\begin{document}
    \mainmatter
    
    \section{Related Work}
    Such is the case in the heuristic incremental search for a navigation algorithm~\cite{koenigFastReplanningNavigation2005}.
    
    \begin{itemize}
        \item \cite{kastenholz}
        \item \cite{sigfridsson}
        \item \cite{ctan}
        \item \cite{markey} 
    \end{itemize}   
    
%   \bibliographystyle{IEEEtran}
%   \bibliography{minimal-references}
    
    \printbibliography
    
\end{document}

如果按如下方式运行xelatexlualatex 启动,以避免字母间距错误。

\documentclass[nobib,nofonts]{tufte-book}   
    
%%https://tex.stackexchange.com/questions/200722/xetex-seems-to-break-headers-in-tufte-handout  
\usepackage{fontspec}
\setmainfont{Minion Pro}
\newcommand{\textls}[2][5]{%
    \begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
}
\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
%%************************************************************************************
    

相关内容