# Citation List: Putting edition, volume, pages together in parentheses

I'm trying to customize a .bst file, and I'm in desperate need of some assistance.

I have a citation that looks like this:

After the title of the book, I'm trying to put parentheses around the edition, volume, number, and pages. I am able to do each individually [e.g., (Vol. 14), (pp. 207-262)] but not around everything in one set of parentheses [i.e., (Vol. 14, pp. 207-262)].

This reference is an "incollection".

Also, is there anyway to suppress the comma the occurs before?

So that it looks like this: ... Advances in research and theory (Vol. 14, pp. 207-262). New York: Academic Press.

FUNCTION {incollection}
{ output.bibitem
format.authors "author" output.check
format.date "year" output.check
date.block
format.title "title" output.check
new.sentence
crossref missing${ format.in.ed.booktitle "booktitle" output.check format.edition output format.bvolume output format.number.series output format.chapter.pages output new.sentence format.publisher.address output } { format.incoll.inproc.crossref output.nonnull format.chapter.pages output } if$
format.note output
fin.entry
}


And here's my .bst file in its entirety: https://pastebin.com/ZQNx0P9U (Was too long to post here.)

And here's the .bib entry:

@incollection{RaaiShif80,
Author = {Raaijmakers, J. G. W. and Shiffrin, R. M.},
Booktitle = {The psychology of learning and motivation: Advances in research and theory},
Date-Modified = {2014-09-10 12:47:54 +0000},
Editor = {G. H. Bower},
Pages = {207-262},
Title = {{SAM: A} theory of probabilistic search of associative memory},
Volume = {14},
Year = {1980}}


And a sample .tex file: \documentclass{article} \usepackage[english]{babel}

\begin{document}

\section*{Sample Citation}

This is a sample citation: \cite{RaaiShif80}.

\bibliographystyle{mybst.bst}
\bibliography{sample}

\end{document}


• Welcome to TeX SX! You've tagged this post as biblatex, but you don't seem to use it. Could you post a full, yet minimal, compilable code? – Bernard Jul 25 '18 at 18:09
• It would be easier to do with biblatex – at least for me. – Bernard Jul 25 '18 at 18:32
• You need to modify the functions format.bvolume and format.chapter.pages, to place parentheses around their respective contents. Since you haven't revealed how these functions are defined, it's not possible to give specific advice for now on how you might go about achieving your formatting objective. – Mico Jul 25 '18 at 21:07
• Hi Mico, thanks for looking into this. I did post my .bst file in its entirety at: pastebin.com/ZQNx0P9U It was too long for the character limit of the post. Wouldn't altering these functions put parentheses around the items individually and not collectively? – Mitchell U. Jul 26 '18 at 12:43

I have the same problem so first I create this function to create parentheses

FUNCTION {parens}
{ duplicate$empty$
{ pop$"" } { "(" swap$ * ")" * }
if$}  but this will work just for volume or just for pages. I think you should create a new format with volume and pages. Something like this: FUNCTION {format.vol.pages} { volume field.or.null pages empty$
'skip${ duplicate$ empty${ pop$ format.pages }
{ ", " * pages n.dashify * }
if$} if$
}


Then, you need to remove the comma. You need to create another function

FUNCTION {add.blank}
{  " " * before.all 'output.state :=
}


and include command parens and add.blank before your function for volume and pages, in your code

FUNCTION {incollection}
{ output.bibitem
format.authors "author" output.check
format.date "year" output.check
date.block
format.title "title" output.check
new.sentence
crossref missing${ format.in.ed.booktitle "booktitle" output.check format.edition output add.blank format.vol.pages parens "volume and pages" output.check format.number.series output new.sentence format.publisher.address output } { format.incoll.inproc.crossref output.nonnull format.chapter.pages output } if$
format.note output
fin.entry
}


Hope it helps! :)