0

I am using a custom .bst file for thesis write up and getting the following error: You can't pop an empty literal stack for entry.

\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}

These is the entry:

@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}
}

The problem is that each entry is rendered in the output PDF like this:

[CHEN (1976), ]

As you can see, after the date there is always a comma followed by a white space.

I believe this is related to the following warning I receive when compiling:

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

The .bst file is this one.

Am I missing something?

EDIT: I noticed that only a subset of entries receive the warning. Here a couple:

@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},
}
6
  • The link to the .bst is 404, and that is undoubtedly where the problem lies. – Paul Stanley Apr 28 '20 at 12:49
  • Link updated, thanks. – user840718 Apr 28 '20 at 12:57
  • I am afraid I get no error using your MWE and the attached .bst. – Paul Stanley Apr 28 '20 at 13:08
  • Do you have any idea where the error can be? – user840718 Apr 28 '20 at 13:33
  • Did you actually try your MWE? Does this example really give the error? – Ulrike Fischer Apr 28 '20 at 14:26
2

noon.bst uses lines like

"[" write$  short.list write$ " " write$ format.date "year" output.check write$ "] " write$

to print the citation label at the beginning of the bibliography again.

The problematic bit is

format.date "year" output.check write$

If there is something to print output.check will already perform a write$ itself, so we may end up with essentially

format.date write$ write$

in many situations. That causes the error you report.

Apparently, someone noticed this issue and removed the problematic bit from some of the FUNCTIONs already, so in some instances we find

"[" write$  short.list write$ " " year * write$ "] " write$

But they missed or ignored a few occurrences.


I suggest a slightly different approach where we externalise the label generation to a FUNCTION that mimics the way the actual citation label is produced.

You can get fixed version of noon.bst at https://gist.github.com/moewew/a4d48dd54655a610ae9b68522a5f48aa. The diff to the original noon.bst from https://textuploader.com/1qfzj is

--- 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 :=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.