I created my own bibliography file with custom-bib (makebst), but when I run it with a reference to a book I get:
$ bibtex PhD
[...normal output]
Database file #1: PhD.bib
You can't pop an empty literal stack for entry oecd2001brc
while executing---line 1504 of file wdsphd.bst
The only thing on that line is a high-level ITERATE
call.
The style was created with these options:
%% merlin.mbs (with options: `head,exlang,annote,seq-no,nm-rvvc,dt-beg,yr-par,xmth,tit-qq,qx,bt-qq,vol-bf,volp-sp,num-xser,pub-date,isbn,issn,doi,english,pp,ord,url,url-nl,nfss,,{}')
%% english.mbs (with options: `exlang,annote,seq-no,nm-rvvc,dt-beg,yr-par,xmth,tit-qq,qx,bt-qq,vol-bf,volp-sp,num-xser,pub-date,isbn,issn,doi,english,pp,ord,url,url-nl,nfss,,{}')
%% merlin.mbs (with options: `tail,exlang,annote,seq-no,nm-rvvc,dt-beg,yr-par,xmth,tit-qq,qx,bt-qq,vol-bf,volp-sp,num-xser,pub-date,isbn,issn,doi,english,pp,ord,url,url-nl,nfss,,{}')
The code for book items looks like:
FUNCTION {book}
{ output.bibitem
author empty$
{ format.editors "author and editor" output.check
}
{ format.authors output.nonnull
crossref missing$
{ "author and editor" editor either.or.check }
'skip$
if$
}
if$
format.btitle "title" output.check
crossref missing$
{ format.bvolume output
new.block
format.number.series output
new.sentence
format.publisher.address output
}
{
new.block
format.book.crossref output.nonnull
}
if$
format.edition output
format.isbn output
format.doi output
new.block
format.note output
fin.entry
write.url
}
And this is the entry:
@book{oecd2001brc,
author = {OECD},
doi = {10.1787/9789264193550-en},
isbn = {9789264186903},
publisher = {OECD Publishing},
title = {{Biological Resource Centres: Underpinning the future of life sciences and biotechnology}},
url = {http://www.oecd-ilibrary.org/science-and-technology/biological-resource-centres\_9789264193550-en},
year = {2001}
}
Is there a way to get a better stacktrace from bibtex? What I have now doesn 't really tell me what is going on. If it can be fixed simply, help would also be appreciated.
Best Answer
You found a bug in
custom-bib
, that should be reported to its maintainer.Specifically,
merlin.mbs
contains in functionformat.org.or.pub
, line 6907 ff. the following code that needs to be changed as indicatedIt looks like a copy-and-paste error from the
pub-date&ay
case that follows the code I pasted here.With this change your
bst
file should contain the function in the following form:Regarding debugging of
bst
files: there is thestack$
command that will show you the stack on standard output, but it also flushes the stack, so you almost surely run into errors in the following execution. It is still helpful to see the complete stack at a certain point of thebst
file. It is less intrusive to show only the topmost stack item as a warning withor the two top items with
leaving the stack intact.