# agsm bibliography style, remove the comma after (year) in formatted bib entries

Any help on the following will be appreciated. natbib, agsm currently gives me:

Braun, V. and Clarke, V. (2006), ‘Using thematic analysis in psychology’, Qualitative Research in Psychology, 3(2), pp. 77–101.

What i really wanna get is:

Braun, V. and Clarke, V. (2006) ‘Using thematic analysis in psychology’, Qualitative Research in Psychology, 3(2), pp. 77–101.

I.e. How do we remove the comma after (year)?

Thanks,

Ash

• Welcome to TeX.SX! There are other questions related to modifying the output of agsm.bst. Did you look for them? – egreg Jan 21 '17 at 16:04
• Hello TeX.SX. Yes, i did. Most of them were related to other aspects. But I'll have another go and browse again. – ashley Jan 22 '17 at 16:41

This seems to do:

\begin{filecontents*}{\jobname.bib}
@article{braun-clarke2006,
author={Braun, V. and Clarke, V.},
year={2006},
title={Using thematic analysis in psychology},
journal={Qualitative Research in Psychology},
volume={3},
number={2},
pages={77–101},
}
\end{filecontents*}

\documentclass{article}
\usepackage{natbib}

\renewcommand{\harvardyearright}{)\gobblecomma}
\makeatletter
\newcommand{\gobblecomma}{\@ifnextchar,{\@gobble}{}}
\makeatother

\begin{document}

\cite{braun-clarke2006}

\bibliographystyle{agsm}
\bibliography{\jobname}

\end{document}


Explanation. The entry in the .bbl file turns out to be

\harvarditem{Braun \harvardand\ Clarke}{2006}{braun-clarke2006}
Braun, V. \harvardand\ Clarke, V.  \harvardyearleft 2006\harvardyearright ,
Using thematic analysis in psychology', {\em Qualitative Research in
Psychology} {\bf 3}(2),~77–101.


so it's a matter of redefining \harvardyearright` to produce the parenthesis and also a command that will gobble the next character, if it is a comma. I also changed the dreadful “&” into “and”.

• That's egreg. Works wonders. And thank you for changing the \& to "and". I had to add my own command to do that. But i'll use your's instead. Couple of other things i had to manually change are: Adding "pp" before the pages. I did it in the bibtex file., and having a comma (,) just before 3(2). This was also added to my bibtex file. – ashley Jan 22 '17 at 19:08