elsarticle 错误:您无法弹出一个空的文字堆栈进行输入

elsarticle 错误:您无法弹出一个空的文字堆栈进行输入

考虑输入

\documentclass{elsarticle}%%% V3.1 from CTAN
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{MITRE-CWE-ConcurrencyIssues,
  author = {{The {MITRE} corporation}},
  title = {{CWE} category: concurrency issues},
  year = 2017,
  month = may,
  note={\url{http://cwe.mitre.org/data/definitions/557.html}}
}
\end{filecontents}
\bibliographystyle{elsarticle-num}%%% Version 2.1 from http://mirrors.ctan.org/macros/latex/contrib/elsarticle/elsarticle-num.bst
\begin{document}
\cite{MITRE-CWE-ConcurrencyIssues}
\bibliography{\jobname}
\end{document}

在其上运行常规的 pdflatex-bibtex 循环会产生错误消息:

You can't pop an empty literal stack for entry MITRE-CWE-ConcurrencyIssues
while executing---line 1499 of file elsarticle-num.bst
ptr=1, stack=
 (May 2017)
---the literal stack isn't empty for entry MITRE-CWE-ConcurrencyIssues
while executing---line 1499 of file elsarticle-num.bst

Bibtex 完成了工作,但返回了错误代码 2,这阻止了进一步的自动处理。输入、bibtex 或 .bst 文件中是否存在错误?在后一种情况下,如何修复 elsarticle-num.bst?

答案1

看起来其中有一行重复,elsarticle-num.bst它试图使用堆栈中不再存在的项。我认为该函数misc(第 1360 行elsarticle-num.bst)如下所示:

FUNCTION {misc}
{ output.bibitem
  format.authors output
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title output
  howpublished output
  format.note output
    format.date "year" output.check
  fin.entry
    format.date "year" output.check
  write.url
  empty.misc.check
}

应该format.date "year" output.check删除第二个:

FUNCTION {misc}
{ output.bibitem
  format.authors output
  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
  format.title output
  howpublished output
  format.note output
    format.date "year" output.check
  fin.entry
%    format.date "year" output.check <-- Remove/comment this
  write.url
  empty.misc.check
}

相关内容