1

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} 
  • 1
    Welcome to TeX.SX! – Bobyandbob Mar 2 '18 at 14:17
  • Could you consider using biblatex? – Bernard Mar 2 '18 at 16:02
1

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} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.