I have a rather limited understanding of bst's postfix syntax, and am hoping that someone with more knowledge of the system could kindly point out the source of a problem I am experiencing from a .bst file provided by a journal. Use of this particular bibliographic style file results in failure to print page ranges for most @article entries in my .bib file. I am using pdflatex and bibtex.
The relevant snippet from the .bst file for articles and the formatting of their volume/page numbers is as follows:
FUNCTION {field.or.null}
{ duplicate$ empty$
{ pop$ "" }
'skip$
if$
}
FUNCTION {bolden}
{ duplicate$ empty$
{ pop$ "" }
{ "{\bf " swap$ * "}" * }
if$
}
FUNCTION {bbl.pages}
{ "pp." }
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages multi.page.check
{ bbl.pages pages n.dashify tie.or.space.connect }
{ bbl.page pages tie.or.space.connect }
if$
}
if$
}
FUNCTION {first.page}
{ 't :=
""
{ t empty$ not t #1 #1 substring$ "-" = not and }
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
}
while$
}
FUNCTION {format.journal.pages}
{ pages empty$
'skip$
{ duplicate$ empty$
{ pop$ format.pages }
{
", " *
pages first.page *
}
if$
}
if$
}
FUNCTION {format.vol.num.pages}
{ volume field.or.null
bolden
format.journal.pages
}
FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
crossref missing$
{ journal
emphasize
"journal" output.check
add.blank
format.vol.num.pages output
format.date "year" output.check
}
{ format.article.crossref output.nonnull
format.pages output
}
if$
new.sentence
format.note output
fin.entry
}
As can be seen, the article function calls format.vol.num.pages, which is tasked with inserting the volume and number of pages. After adding and emboldening the volume, format.journal.pages is called. In this function, the pages field from the @article bibliographic entry gets added to the stack. Provided that it is non-empty, then it is duplicated and another check for emptiness is made. I do not understand the purpose of duplicating and checking emptiness after having already established non-emptiness. If it is empty after duplication, then the page range is printed (this is the path I want); otherwise, only the first page is printed, which is the route that almost always seems to be taken. If I use { pop$ format.pages } for both true/false routes of the if statement, then the full page range is printed, but in this case the volume is dropped (perhaps because it was popped prematurely off the stack).
I have also removed the "pp" added by bbl.pages by rewriting is as follows:
FUNCTION {bbl.pages}
{ "" }
However, I am wondering if there is a cleaner way to remove the "pp". Deleting bbl.pages from format.pages again upsets the stack.
Here is an MWE together with its output:
\documentclass{article}
\usepackage{scicite}
\begin{document}
According to the theory of special relativity~\cite{einstein1905}, \ldots
\bibliography{a}
\bibliographystyle{Science}
\end{document}
Bib file (a.bib):
@article{einstein1905,
title={Zur elektrodynamik bewegter k{\"o}rper},
author={Einstein, Albert},
journal={Annalen der physik},
volume={322},
number={10},
pages={891--921},
year={1905},
publisher={Wiley Online Library}
}
The full bst file can be accessed here.
The scicite style file can be accessed here.

.bstfile (and add a short example document with a relevant citation). I always need to actually see the.bstworking to understand what is going on. – moewe Apr 04 '19 at 11:49pages multi.page.check { bbl.pages pages n.dashify tie.or.space.connect } { bbl.page pages tie.or.space.connect } if$block with justpages n.dashify. – moewe Apr 04 '19 at 11:53bstfile to the question and will prepare a short example forthwith. – user001 Apr 04 '19 at 11:57