I have modified my question based on the commands of the first version (thank you). This is the question of version 2. I think I have located the problematic codes.
The problematic 'bst' file can be found in HERE, and a minimal 'bib' file can be found in THERE.
Usually, when receiving the error message 'You can't pop an empty literal stack for entry 5427079
while executing—line 1116 of file roblike.bst', it means the associated item in the file 'bib' is missing.
In this condition, it generates the following references and errors.
You can't pop an empty literal stack for entry 5427079
while executing—line 1119 of file roblike.bst
However, the error message is pointing to a useless code. The code in Line 1116 is ITERATE {call.type$}
.
How can I know what is missing?
First attempt: find a way to track the BibTeX.
How to track the working of the BibTeX?
My first attempt is to find a way to run 'bst' file step by step.
From the comments of the first version, I think the answer is no. So, I turn to the code that is used to process the article type, it contains:
FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
author format.key output % special for
new.block
format.title "title" output.check
new.block
crossref missing$
{ format.journals
format.year.vol.num.pages output
}
{ format.article.crossref output.nonnull
format.pages output
}
if$
new.block
note output
fin.entry
}
And, two associated functions:
FUNCTION {format.article.crossref}
{ "In" % this is for gmjlike
" \cite{" * crossref * "}" *
}
FUNCTION {format.year.vol.num.pages}
{
volume empty$
{ "empty volume in " cite$ * warning$ }
{ write$
", {\bf " volume * "}" * extra.label *
mid.sentence 'output.state :=
}
if$
number empty$
'skip$
{ "(" number * ")" * *
volume empty$
{ "there's a number but no volume in " cite$ * warning$ }
'skip$
if$
}
if$
pages empty$
'skip$
{ duplicate$ empty$
{ pop$ format.pages }
{ ", " * pages n.dashify * }
if$
}
if$
year empty$
{ "empty year in " cite$ * warning$ }
{ write$
" (" year * ")" * extra.label *
mid.sentence 'output.state :=
}
if$
}
with the entry 5427079 in the file bib:
@article{5427079,
author = {Bioucas-Dias, Jos{\'e} M. and Figueiredo, M{\'a}rio A. T.},
journal = {IEEE Transactions on Image Processing},
number = {7},
pages = {1720-1730},
title = {Multiplicative Noise Removal Using Variable Splitting and Constrained Optimization},
volume = {19},
year = {2010}}
I do not think I lost anything in that item.
Second attempt: I think I know where is wrong.
Since BibTeX cannot run step by step, I can guide the workflow by giving the proper test case.
I add a crossref item for 5427079 and reference with \cite{5427079} \cite{Rokach2010}
, which leads to no error.
@article{5427079,
author = {Bioucas-Dias, Jos{\'e} M. and Figueiredo, M{\'a}rio A. T.},
journal = {IEEE Transactions on Image Processing},
number = {7},
pages = {1720-1730},
title = {Multiplicative Noise Removal Using Variable Splitting and Constrained Optimization},
volume = {19},
crossref = {Rokach2010},
year = {2010}}
Warning--can't use both author and editor fields in Rokach2010
(There was 1 warning)
Process exited normally
That means the codes below are OK.
{
format.article.crossref output.nonnull
format.pages output
}
so the problem is limited to the following codes.
{
format.journals
format.year.vol.num.pages output
}
Then, I remove the crossref item and reference the second line. The BibTeX reports no error, again.
{
format.journals
% format.year.vol.num.pages output
}
So, the problem lies in the following line.
format.year.vol.num.pages output
Then, I restore the second line and reference the first line. The error occurs, again.
{
% format.journals
format.year.vol.num.pages output
}
Then, I think the function format.year.vol.num.pages
must be the problem. So, I reference everything inside. The function is empty!
FUNCTION {format.year.vol.num.pages}
{
% volume empty$
% { "empty volume in " cite$ * warning$ }
% { write$
% ", {\bf " volume * "}" * extra.label *
% mid.sentence 'output.state :=
% }
% if$
% number empty$
% 'skip$
% { "(" number * ")" * *
% volume empty$
% { "there's a number but no volume in " cite$ * warning$ }
% 'skip$
% if$
% }
% if$
% pages empty$
% 'skip$
% { duplicate$ empty$
% { pop$ format.pages }
% { ", " * pages n.dashify * }
% if$
% }
% if$
% year empty$
% { "empty year in " cite$ * warning$ }
% { write$
% " (" year * ")" * extra.label *
% mid.sentence 'output.state :=
% }
% if$
}
The problem remains! Strange!
You can't pop an empty literal stack for entry 5427079
while executing---line 1119 of file roblike.bst
Best Answer
The
.bst
file has several issues.I think I could isolate the problem that caused the specific error you asked about in the question, but the code I saw did not inspire confidence that this was the only problem with this
.bst
file.The fact that the
.bst
language is stack-based and uses reverse Polish notation can make things tricky to follow.You have already identified the problematic bits of code: The functions
format.journals
andformat.year.vol.num.pages
.format.journals
is defined asAssuming you have a
journal
in your@article
entry, this leaves the stack empty, becauseoutput.check
writes out the first item on the stack and then removes it.Unfortunately, if the journal is empty, the function pushes an empty string to the stack. So the behaviour is vastly different in that case.
Indeed, if you remove the
journal
from your example entry, BibTeX compiles without an error message, but the output is completely garbage.If you look at the output that BibTeX produces despite the error if there is a
journal
you see that it contains two commas, one of those is added by this function, so we can remove the comma here. This allows us to simplify the function to the followingwhich, incidentally is exactly what
apalike.bst
does (it just doesn't define a function for it).format.year.vol.num.pages
is defined asAgain, the function can leave the stack in different states depending on which conditional path was taken.
If there is no
volume
, the function just issues a warning and otherwise leaves the stack alone.If there is a
volume
, the function first pops one item from the stack and writes it and then adds more stuff to the stack. Sinceformat.journals
leaves the stack empty, this will give an error.Something similar is done for
year
.The way the function is set up means that all conditionals should just push their contents onto the stack and concatenate it so that at the end there is one long string on the stack that can be written out.
Additionally, the functions seem to mention
extra.label
in random places and setoutput.state
for seemingly no reason. Fixing this and another comma gives usFixing the two functions as shown here lets the example compile fine again. But there might be more errors.
It should be noted that the
.bst
file is based quite heavily onapalike.bst
(all mentions ofapalike
are replaced bygmjlike
), which is an author-year style. The style in its current form does not provide author-year data and can thus only be used as a numeric style. But numeric styles should calculate the longest label for correct indentation in the bibliography, whichapalike
does not have to do. This means that this style produces misaligned bibliographies.I strongly recommend you stop using this style or you get in touch with the developer or distributor of the style immediately to tell them about these issues.