[Tex/LaTex] Add numbering to references

bibliographiescustom-bibnatbibnumbering

I created my bibliography style (author-year) in "custom-bib" using natbib. References are generated using bibtex and sorted alphabetically. Publisher wants to, they were still numbered from 1 to n.

I have a qestion: How to add numbering of references without changing the style of the citation from 'author-year' to a numbered?

Best Answer

The following code seems to do what you are looking for. Since you're using a your own .bst file, you'd need to change that in the example and replace the demo .bib files with your own. It's much easier to do this with biblatex (see Adding numbers to Author Year citations in list of references for an example.)

\documentclass{article}
\usepackage{etoolbox}
\usepackage{natbib}
\usepackage{hyperref,url}
\newcounter{bibcount}
\makeatletter
\patchcmd{\@lbibitem}{\item[}{\item[\hfil\stepcounter{bibcount}{\thebibcount.}}{}{}
\setlength{\bibhang}{2\parindent}
\renewcommand\NAT@bibsetup%
   [1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\parindent}%
       \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}
\makeatother
\bibliographystyle{agsm}
\begin{document}
\cite{*}
\bibliography{%
/usr/local/texlive/2015/texmf-dist/doc/latex/latex-bib-ex/articles,/usr/local/texlive/2015/texmf-dist/doc/latex/latex-bib-ex/books}
\end{document}

output of code