[Tex/LaTex] Changing the colon to a comma after the vol.(num.) in bst file

natbibpunctuation

I need to change the format in the .bst file that I am using. The format currently as:

Beth, T. and Gollmann, D. (1989). Algorithm Engineering for Public Key
Algorithm. IEEE Journal on selected areas in communications 7 (4):
458–465.

I want them to be as:

Beth, T. and Gollmann, D. (1989). Algorithm Engineering for Public Key
Algorithm. IEEE Journal on selected areas in communications, 7 (4),
458–465.

I need to add comma after the Journal's name and also changing the colon after the series number into comma.

What commands should I add and on which function should I make changes?

Is the following function the right one to add changes on?

FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { series empty$
       { "" }
       { series emphasize }
     if$
     swap$ bbl.volume volume tie.or.space.connect output
    }
  if$
}

I have also other functions in bst file where I think they might be related, such as:

FUNCTION {format.number.series}
FUNCTION {format.vol.num.pages}

I appreciate the help in advance.

Best Answer

You don't mention which bibliography style file you're using, so I'll assume that it's either that's provided by the natbib package (such as plainnat, unsrtnat, etc) or was generated by the makebst utility (which was written by the author of the natbib package.

In your .bst file, you need to locate the function format.vol.num.pages; it looks like this in the file plainnat.bst file:

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

Note the colon (:), which happens to be in the fifth line from the bottom in this version of the format.vol.num.pages function. (Depending on the .bst file you use, it may be in a different location within the format.vol.num.pages function.) Change the colon to a comma and save the file under a new name, e.g., plainnat-mara.bst. You could save the new file either to your current working directory or some other directory where your TeX distribution tends to look for BibTeX style files. Be sure to refer to the new style file from now on.