[Tex/LaTex] Alignment numbered apalike bibliography style

apa-stylebibliographiesnatbib

I prefer the apalike bibliography style with the number in brackets in front (see also this post and this post). However what I am curious about is how to align the first and subsequent text lines neatly next to the number in brackets.

Example

Does anyone know how to do this?

Best Answer

You can update some of the settings loaded by the thebibliography environment to a set of fixed lengths:

enter image description here

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{adk-1997,
  author  = {B Alziary and JP D{\'e}camps and PF Koehl},
  title   = {A {PDE} approach to {A}sian options: {A}nalytical and numerical evidence},
  journal = {Journal of Banking \& Finance},
  year    = {1997},
  volume  = {21},
  number  = {5},
  pages   = {613-640}
}
\end{filecontents*}

\usepackage[numbers]{natbib}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\thebibliography}{\c@NAT@ctr\z@}{\c@NAT@ctr\z@
  \renewcommand{\makelabel}[1]{\makebox[1.2em][r]{##1\hfill}}%
  \setlength{\labelwidth}{1.2em}%
  \setlength{\labelsep}{.5em}%
  \setlength{\leftmargin}{\dimexpr\labelwidth+\labelsep}%
}{}{}
\makeatother

\begin{document}

\nocite{*}

\bibliographystyle{apalike}

\bibliography{\jobname}

\end{document}

You can increase the two length measures 1.2em that forms part of \makelabel and setting \labelwidth if you have more than 9 references.

Related Question