[Tex/LaTex] Bibliography: Round brackets only in citations

bibliographiesciting

In this example I want that only in the citations the brackets shall be round, in the references there shall be squares at the beginning. How do I get this?

Using round with natbib does not work because I get round brackets everywhere, and at the beginning of the references there is not the author name and year written, which I really want

I want in references:

[author, year] author, year, title…

and in text:

…(author, year)

\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{apalike}
\bibliography{\jobname}

\end{document} 

Best Answer

For changing something in BibTeX, it's often a good idea to look into Tame the BeaST. At point 4.5 they write how to change brackets into parentheses. This is done separately for the citations and the references, so we can just omit the first step. So we have to redefine \@cite:

\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
\def\@cite#1#2{({#1\if@tempswa , #2\fi})}
\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{apalike}
\bibliography{\jobname}

\end{document}