3

I aim to use the bibstyle h-physrev.bst together with bibtex on a Linux machine. The bibstyle file is downloaded from https://arxiv.org/hypertex/bibstyles/

MWE

So far so good but now I have a problem with one of the entries - see the following MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@InProceedings{my_entry,
  author    = {My Author},
  title     = {Conribution},
  booktitle = {Book title},
  year      = {2018},
  volume    = {10547},
  pages     = {9},
  month     = feb,
  doi       = {10.1117/12.2300061},
}
\end{filecontents*}

\documentclass{scrartcl}

\begin{document}

\nocite{*}

\bibliography{\jobname}
\bibliographystyle{h-physrev}
\end{document}

The bibtex error message I see is:

This is BibTeX, Version 0.99d (TeX Live 2018/Arch Linux)
The top-level auxiliary file: test_bibtex_h-physrev.aux
The style file: h-physrev.bst
Database file #1: test_bibtex_h-physrev.bib
You can't pop an empty literal stack for entry my_entry
while executing---line 944 of file h-physrev.bst
(There was 1 error message)

While tracing the error back, I found out that the volume entry leads to the error in the call of function either.or.check in line 275 of the style file.

Question

After contacting the bibtex style writer manual, I am still not fully understanding the bst-programming commands: What does the variable 'pop$ do exactly and does it make sense there? Or what other command should it be (e.g. replacing it with 'skip$ solves the error)?

3
  1. Copy h-physrev.bst from https://arxiv.org/hypertex/bibstyles/h-physrev.bst to a place where LaTeX (or rather BibTeX) can find it (see https://texfaq.org/FAQ-inst-wlcf, the document directory would do just fine).

  2. Rename the file to h-physrev-fix.bst, say

  3. Replace

    FUNCTION {format.bvolume}
    { volume empty$
    { "" }
    { series empty$
    'skip$
    { ", " series * }
    if$
    " Vol." volume tie.or.space.connect *
    "volume and number" number either.or.check
    }
    if$
    }
    

    in lines 281-292 with

    FUNCTION {format.bvolume}
    { volume empty$
        { "" }
        { series empty$
            { "" }
            { series ", " * }
          if$
          " Vol." volume tie.or.space.connect *
          "volume and number" number either.or.check
        }
      if$
    }
    

Then use the renamed file h-physrev-fix in your document.

So what happened here? Apart from the added indentation to make things easier on the eye, you'll notice that only the series empty$ conditional changed. In the old version if the volume field was non-empty, but the series was empty, the 'skip$ would leave the stack empty and " Vol." volume tie.or.space.connect * would try to concatenate the string Vol. <volume> with the empty literal leading to the error. The new version would leave an empty string on the stack in that case and would therefore not raise an error, it also fixes the punctuation around the series.

With the fixed file the MWE from above would result in

M. Author, Conribution, in Book title, Vol. 10547, p. 9, 2018.

without errors on the BibTeX run.

  • First, why does this string { "" } solve my issue? And second, when I write an example with series, there is no such "punctuation" problem around the series. – strpeter Dec 10 '18 at 17:50
  • @strpeter The BibTeX language is a stack language (as you probably know). If you have 'skip$ where my answer has "" the stack will be empty instead of containing an empty string. In the next step BibTeX is asked to concatenate the last two items on the stack: With 'skip$ the stack is missing an item, with "" the missing item is simply empty, which works just fine. Re the series. If I take the original file and add a series to your example I get "in Book title, , series Vol. 10547" which seems a bit off... – moewe Dec 10 '18 at 21:05

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.