[Tex/LaTex] Square brackets in Bibliography with `apalike` style

apa-stylebibliographiesnatbib

I have a document with this setup:

\usepackage[square,authoryear]{natbib}
...
\bibliographystyle{apalike}
\bibliography{bib}

Which is producing Bibliography entries like:

Batty, M. (2007). Cities and Complexity. MIT Press.

However, as the PennState references page shows, I would expect something like:

[Batty, 2007] Batty, M. Cities and Complexity. MIT Press. 2007.

What should I do to get a formulation closer to the later?

Best Answer

A style file close to the one you want is the named style, which is not compatible with natbib, however, and has nothing to do with apa specifications.

If you want to use it, add the following lines in the preamble

\makeatletter
\let\@internalcite\cite
\def\cite{\def\citeauthoryear##1##2{##1, ##2}\@internalcite}
\def\shortcite{\def\citeauthoryear##1##2{##2}\@internalcite}
\def\@biblabel#1{\def\citeauthoryear##1##2{##1, ##2}[#1]\hfill}
\makeatother

and then use

\bibliographystyle{named}

MWE:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Batty:2007,
author    = {Michael Batty},
title     = {Cities and Complexity},
publisher = {MIT Press},
year      = 2007}
\end{filecontents*}

\makeatletter
\let\@internalcite\cite
\def\cite{\def\citeauthoryear##1##2{##1, ##2}\@internalcite}
\def\shortcite{\def\citeauthoryear##1##2{##2}\@internalcite}
\def\@biblabel#1{\def\citeauthoryear##1##2{##1, ##2}[#1]\hfill}
\makeatother

\begin{document}

This a citation \cite{Batty:2007}

\bibliographystyle{named}
\bibliography{\jobname}

\end{document} 

Output:

enter image description here