[Tex/LaTex] How to modify apalike.bst to remove period(.) after “author (year)”

bibtex

which part of apalike.bst do I have to change to remove the period . after "author (year)" ?

Instead of "author (year)." I need "author (year)"

Best Answer

Here's a solution that avoids the problem identified in my comments on @Qwerty's own answer.

Begin by making a copy of the file apalike.bst; call the copy, say, myapalike.bst. In myapalike.bst, find the the function output.year.check. Replace the entire function with the following code:

FUNCTION {output.year.check}
{ year empty$
  { "empty year in " cite$ * warning$ }
  { write$
      " (" year * extra.label * ")\removeperiod" *    
  mid.sentence 'output.state :=
    }  
if$
}

Note that there's now no space between ") and \removeperiod".

Save the file myapalike.bst either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the second option, you will likely also need to update the filename database of your TeX distribution. And, change the argument of the \bibliographystyle instruction from apalike to myapalike.

Separately, provide the following code in the preamble of your document:

\makeatletter
\newcommand{\removeperiod}{\@ifnextchar.{\@gobble}\relax}
\makeatother