1

I'm editing the bibliography style "unsortnat" to satisfy a conference requirements.

The ask me to put at the end of the citation the volume and pages, after the year like :

S. Adhikari, M. I. Friswell, D. J. Inman. Piezoelectric energy harvesting from broadband random vibrations. Volume 18, pp. 115005.

Editing the bst file in the function

FUNCTION {format.vol.num.pages}
    { volume field.or.null
  number empty$
    'skip$
    { "{\ No.\ " number * "}" * *
      volume empty$
    { "there's a number but no volume in " cite$ * warning$ }
    'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
    { pop$ format.pages }
    { ",~pp.~" * pages n.dashify * }
      if$
    }
  if$
}

I get this:

S. Adhikari, M. I. Friswell, D. J. Inman. Piezoelectric energy harvesting from broadband random vibrations. 18, pp. 115005.

the desired output but without the word "volume" which I don't know how to add it in the bst modification.

Any help will be appreciated it.

2

I presume you mean you are modifying unsrtnat.bst. In any case you need to rewrite the function a little to add this string because the first line

 volume field.or.null

immediately puts the volume number on to the stack when it is non null. Here is one suggestion of how to rewrite:

FUNCTION {format.vol.num.pages}
{ volume empty$
  { number empty$
      { "" }
      { "\penalty0 (" number * ")" * *
        "there's a number but no volume in " cite$ * warning$
      }
    if$
  }
  { "Volume " volume *
    number empty$
      'skip$
      { "\penalty0 (" number * ")" * * }
    if$
  }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { ":\penalty0 " * pages n.dashify * }
      if$
    }
  if$
}

The logic is that we

  • test whether volume is empty
    • if so test whether number is empty
      • if it is add a null string to the stack
      • otherwise provide the number information in brackets and warn that there is no volume number
    • if volume is not empty, print "Volume " and the volume number and then do a similar check on whether the number is non-empty or not, this time no warning is necessary.
    • thereafter proceed as before with the page information.

Calling the resulting file myunsrtnat.bst and using the standard xampl.bst contained in tex distributions, this gives

Sample output

\documentclass{article}

\usepackage{natbib}

\begin{document}

\citet{article-minimal,article-full,whole-collection}

\bibliographystyle{myunsrtnat}
\bibliography{xampl}

\end{document}

The first entry is an article without volume or number information, the second is a full detailed article, the third is another entry of a different type without these fields.

The \pentalys are from a recent version of unsrtnat.bst.

  • That worked! Amazing reply. Thanks very much! – Germán Martínez Aug 10 '16 at 12:36

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.