12

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?

9
  • 3
    \usepackage[numbers]{natbib}...?
    – Werner
    Commented Feb 20, 2016 at 0:04
  • No, I used '\usepackage[round]{natbib}' Commented Feb 20, 2016 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. Commented Feb 20, 2016 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
    Commented Feb 20, 2016 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
    Commented Feb 20, 2016 at 3:10

1 Answer 1

11

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

2
  • @Alan Munn, Thank you very much for your answer. It works! Commented Feb 20, 2016 at 22:33
  • Useful one if you want to number the references in the order they are cited. Useful for IEEE journals. \usepackage[numbers]{natbib} \usepackage[english]{babel} \usepackage[ %backend=biber, natbib=true, style=numeric, sorting=none ]{biblatex} Ref: tex.stackexchange.com/questions/51434/biblatex-citation-order
    – vineeshvs
    Commented Feb 27, 2020 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .