6

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?

  • 2
    \usepackage[numbers]{natbib}...? – Werner Feb 20 '16 at 0:04
  • No, I used '\usepackage[round]{natbib}' – Bartłomiej Stępień Feb 20 '16 at 0:17
  • No, I used \usepackage[round]{natbib}. When I used \usepackage[numbers]{natbib} the citations in the text are changed to numbers, wheras references are OK. However I wants 'author-year' citations in the text. – Bartłomiej Stępień Feb 20 '16 at 0:29
  • 2
    Can you supply the community with your (custom) .bst and a minimal working example (MWE) that replicates the current behaiour? It would help greatly trying to solve your problem. – Werner Feb 20 '16 at 0:47
  • 3
    This makes no sense. How are readers to find things in the bibliography if the labels you cite them by are not the labels labelling them in the bibliography? The whole point is for the labels to match. Whichever labelling system you use, they are labels. They are not just for decorative effect. It is the equivalent of continuing to refer to everyone by name, but labelling their numbers in the telephone directory with numbers. How would you find John's phone number if you know him as 'John' but the telephone directory labels his phone number as '58'? – cfr Feb 20 '16 at 3:10
8

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

  • @Alan Munn, Thank you very much for your answer. It works! – Bartłomiej Stępień Feb 20 '16 at 22:33

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.