我正在使用自定义 .bst 文件撰写论文并出现以下错误: 你不能弹出一个空的文字堆栈来输入。
\documentclass[a4paper,12pt]{book}
\usepackage[sort,round]{natbib}
\usepackage{bibunits}
\begin{document}
This is a citation \cite{Chen1976}.
\bibliographyunit
\bibliographystyle{bibstyle/noon}
\bibliography{bib/mybib}
\end{document}
这些是条目:
@Article{Chen1976,
author = {Peter P. Chen},
title = {The Entity-Relationship Model - Toward a Unified View of Data},
journal = {{ACM} Trans. Database Syst.},
year = {1976},
volume = {1},
number = {1},
pages = {9--36},
bibsource = {dblp computer science bibliography, https://dblp.org},
biburl = {https://dblp.org/rec/journals/tods/Chen76.bib},
doi = {10.1145/320434.320440}
}
问题是每个条目在输出 PDF 中呈现如下:
[CHEN (1976), ]
如您所见,日期后面总是有一个逗号,后面跟着一个空格。
我认为这与我在编译时收到的以下警告有关:
Process started: bibtex.exe "thesis"
This is BibTeX, Version 0.99d (MiKTeX 2.9.7250 64-bit)
The top-level auxiliary file: thesis.aux
The style file: bibstyle/noon.bst
A level-1 auxiliary file: bu.aux
Database file #1: bib/mybib.bib
You can't pop an empty literal stack for entry Chen1976
while executing---line 1558 of file bibstyle/noon.bst
You can't pop an empty literal stack for entry everyentry
while executing---line 1558 of file bibstyle/noon.bst
.bst 文件是这一。
我是否遗漏了什么?
编辑:我注意到只有一部分条目会收到警告。下面是一些条目:
@inproceedings{TomanW09,
Author = {David Toman and Grant E. Weddell},
Booktitle = {{IJCAI} 2009, Proceedings of the 21st International Joint Conference on Artificial Intelligence},
Date-Added = {2017-02-05 16:40:40 +0000},
Date-Modified = {2017-02-05 16:41:30 +0000},
Optbdsk-Url-1 = {http://ijcai.org/Proceedings/09/Papers/161.pdf},
Optbibsource = {dblp computer science bibliography, http://dblp.org},
Optbiburl = {http://dblp.uni-trier.de/rec/bib/conf/ijcai/TomanW09},
Opturl = {http://ijcai.org/Proceedings/09/Papers/161.pdf},
Pages = {948--954},
Timestamp = {Wed, 20 Jul 2016 14:20:40 +0200},
Title = {Applications and Extensions of {PTIME} Description Logics with Functional Constraints},
Year = {2009}}
@InProceedings{racer-a,
author = {Volker Haarslev and Ralf M{\"{o}}ller},
title = {Description of the {RACER} System and its Applications},
booktitle = {Working Notes of the 2001 International Description Logics Workshop (DL-2001), Stanford, CA, USA, August 1-3, 2001},
year = {2001},
editor = {Carole A. Goble and Deborah L. McGuinness and Ralf M{\"{o}}ller and Peter F. Patel{-}Schneider},
volume = {49},
series = {{CEUR} Workshop Proceedings},
publisher = {CEUR-WS.org},
bibsource = {dblp computer science bibliography, https://dblp.org},
biburl = {https://dblp.org/rec/bib/conf/dlog/HaarslevM01},
url = {http://ceur-ws.org/Vol-49/HaarslevMoeller-132start.ps},
}
答案1
noon.bst
使用类似的线条
"[" write$ short.list write$ " " write$ format.date "year" output.check write$ "] " write$
再次在参考书目开头打印引用标签。
有问题的是
format.date "year" output.check write$
如果有要打印的内容output.check
将自行执行write$
,因此我们最终可能会得到
format.date write$ write$
在许多情况下。这会导致您报告的错误。
显然,有人已经注意到了这个问题,并已经从一些FUNCTION
s 中删除了有问题的部分,因此在某些情况下,我们发现
"[" write$ short.list write$ " " year * write$ "] " write$
但他们错过或忽略了一些事件。
我建议采用一种略有不同的方法,我们将标签生成外部化为FUNCTION
模仿实际引用标签生成的方式。
noon.bst
您可以获取修复版本https://gist.github.com/moewew/a4d48dd54655a610ae9b68522a5f48aa. 与原版的差异noon.bst
来自https://textuploader.com/1qfzj是
--- orig-noon.bst 2020-04-29 08:44:11.162162900 +0200
+++ noon.bst 2020-04-28 22:18:25.871804100 +0200
@@ -982,9 +982,26 @@
{ organization "organization" bibinfo.check format.org.or.pub
}
+FUNCTION {bib.label}
+{
+ "["
+ short.list
+ *
+ " "
+ *
+ year duplicate$ empty$
+ short.list key field.or.null = or
+ { pop$ "" }
+ 'skip$
+ if$
+ *
+ "] \newblock"
+ *
+}
+
FUNCTION {article}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors "author" output.check
author format.key output
new.block
@@ -1008,7 +1025,7 @@
}
FUNCTION {book}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
author empty$
{ format.editors "author and editor" output.check
editor format.key output
@@ -1042,7 +1059,7 @@
}
FUNCTION {booklet}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors output
author format.key output
new.block
@@ -1058,7 +1075,7 @@
FUNCTION {inbook}
{ output.bibitem
- "[" write$ short.list write$ " " write$ format.date "year" output.check write$ "] " write$
+ bib.label write$ newline$
author empty$
{ format.editors "author and editor" output.check
editor format.key output
@@ -1098,7 +1115,7 @@
FUNCTION {incollection}
{ output.bibitem
- "[" write$ short.list write$ " " write$ format.date "year" output.check write$ "] " write$
+ bib.label write$ newline$
format.authors "author" output.check
author format.key output
new.block
@@ -1125,41 +1142,41 @@
}
FUNCTION {inproceedings}
{ output.bibitem
- "[" write$ short.list write$ " " write$ format.date "year" output.check write$ "] " write$
- format.authors "author" output.check
- author format.key output
- new.block
- format.title "title" output.check
- new.block
- crossref missing$
- { format.in.ed.booktitlenoit "booktitle" output.check
- format.bvolumenoit output
- format.number.series output
- format.pages output
- new.sentence
- publisher empty$
- { format.organization.address output }
- { organization "organization" bibinfo.check output
- format.publisher.address output
- }
- if$
- %format.date "year" output.check
- year write$ ", " write$
- }
- { format.incoll.inproc.crossref output.nonnull
- format.pages output
- %format.date "year" output.check
- year write$ ", " write$
- }
+ new.block
+ bib.label write$ newline$
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitlenoit "booktitle" output.check
+ format.bvolumenoit output
+ format.number.series output
+ format.pages output
+ new.sentence
+ publisher empty$
+ { format.organization.address output }
+ { organization "organization" bibinfo.check output
+ format.publisher.address output
+ }
+ if$
+ %format.date "year" output.check
+ year write$ ", " write$
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.pages output
+ %format.date "year" output.check
+ year write$ ", " write$
+ }
if$
- new.block
format.note output
fin.entry
}
FUNCTION {conference} { inproceedings }
FUNCTION {manual}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors output
author format.key output
new.block
@@ -1176,7 +1193,7 @@
FUNCTION {mastersthesis}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors "author" output.check
author format.key output
new.block
@@ -1194,8 +1211,7 @@
FUNCTION {misc}
{ output.bibitem
-% "[" write$ short.list write$ " " year * write$ "] " write$
- "[" write$ short.list write$ "] " write$
+ bib.label write$ newline$
% format.authors output
% author format.key output
new.block
@@ -1209,7 +1225,7 @@
}
FUNCTION {phdthesis}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors "author" output.check
author format.key output
new.block
@@ -1227,7 +1243,7 @@
FUNCTION {proceedings}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.editors output
editor format.key output
new.block
@@ -1249,7 +1265,7 @@
FUNCTION {techreport}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors "author" output.check
author format.key output
new.block
@@ -1267,7 +1283,7 @@
FUNCTION {unpublished}
{ output.bibitem
- "[" write$ short.list write$ " " year * write$ "] " write$
+ bib.label write$ newline$
format.authors "author" output.check
author format.key output
new.block
@@ -1384,6 +1400,7 @@
'label :=
}
+
FUNCTION {sort.format.names}
{ 's :=
#1 'nameptr :=