Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Could you post the options you used to create the style? They are at the top of the bst file. That way it will be easier to recreate your style. –  mafp May 3 '13 at 15:42
    
@mafp I was looking for an easy way to share that, thank you. I added them just below the bibtex output. –  wds May 3 '13 at 15:53

1 Answer 1

up vote 4 down vote accepted

You found a bug in custom-bib, that should be reported to its maintainer.

Specifically, merlin.mbs contains in function format.org.or.pub, line 6907 ff. the following code that needs to be changed as indicated

%<*pub-date&!ay>
      year empty$
        'skip$
        { t empty$ address empty$ and
            'skip$
%<!pub-xc>            { ", " * }           %% removed: swap$ *
%<pub-xc>            { " " * }             %% removed: swap$ *
          if$
          year "year" bibinfo.check
%<dtbf>          bolden
          *
        }
      if$
%</pub-date&!ay>

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

FUNCTION {format.org.or.pub}
{ 't :=
  ""
  year empty$
    { "empty year in " cite$ * warning$ }
    'skip$
  if$
  address empty$ t empty$ and
  year empty$ and
    'skip$
    {
      add.blank "(" *
      t empty$
        { address "address" bibinfo.check *
        }
        { t *
          address empty$
            'skip$
            { ", " * address "address" bibinfo.check * }
          if$
        }
      if$
      year empty$
        'skip$
        { t empty$ address empty$ and
            'skip$
            { 
              ", " *                 %% originally: ", " swap$ * *
            }
          if$
          year "year" bibinfo.check
          *
        }
      if$
      ")" *
    }
  if$
}

Regarding debugging of bst files: there is the stack$ 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 the bst file. It is less intrusive to show only the topmost stack item as a warning with

duplicate$ "On stack:'" swap$ * "'" * warning$

or the two top items with

duplicate$ "On stack:'" swap$ * "'" * warning$
swap$ duplicate$ "         '" swap$ * "'" * warning$ swap$

leaving the stack intact.

share|improve this answer
    
Awesome. I've mailed the author with a reference to this question. –  wds May 5 '13 at 10:54
    
Uber thanks. I was just in the process of submitting an article to a scientific journal and their bibtex pipeline complained about the exact same error. Had to modify my bst file as indicated here. @mds I hope the maintainer got your notification. Did you get any response so far? –  Jan-Philip Gehrcke Jun 25 '13 at 13:54
    
@Jan-PhilipGehrcke custom-bib has not seen any updates for quite some time now, I doubt this will ever get fixed. –  mafp Jun 25 '13 at 14:38
    
@wds Or did you get a response? –  mafp Jun 25 '13 at 14:38
    
@Jan-PhilipGehrcke @mafp I did not, but I think the email did go through. Either way, there are other problems that show up (for instance I can't use citep for some reason). I'm thinking biblatex is a better choice for the future. –  wds Jun 27 '13 at 8:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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