1

I'm sure variations of this question have been asked dozens of times, but I couldnt find anything specific to my case.

I want a bibliogrpahy format which will accomplish these 4 goals:

  1. get the citations in (Author,year) format
  2. get a numbered bibliography
  3. get the bibliography in alphabetical order.
  4. use the natbib package, if possible

I have not seen any solution which can do these 3 things together.

  • 1
    Welcome to TeX.SE! Are you currently working with a specific bibliography style, and just wish to modify it so that numbers are printed next to the (alphabetically sorted) entries? Do you use a citation management package, e.g., natbib? – Mico Jun 16 '15 at 22:41
  • Yes, I currently use natbib & would love to keep it that way to avoid converting.... – DankMasterDan Jun 17 '15 at 00:53
  • 1
    What is the purpose of the numbers exactly? Usually, these are labels for the entries but that is not the case here because you are using author-year labels. As described, the numbers seem a strategy to sow confusion in the mind of your reader... ;). – cfr Jun 17 '15 at 01:02
  • 1
    @cfr - Even if the numbers don't create confusion, they'll certainly contribute clutter. Either way, I'm also not convinced that it's a good idea to number the bib entries if an author-year type citation call-out system is in use. – Mico Jun 17 '15 at 01:29

1 Answers1

3

The following solution uses biblatex:

\documentclass{article}
\usepackage[
    natbib=true,
    style=authoryear,
    labelnumber,
    ]{biblatex}
\addbibresource{references.bib}
\DeclareFieldFormat{labelnumberwidth}{[#1]}
\defbibenvironment{bibliography}  % from numeric.bbx
  {\list
    {\printtext[labelnumberwidth]{%
      \printfield{prefixnumber}%
      \printfield{labelnumber}}}
    {\setlength{\labelwidth}{\labelnumberwidth}%
        \setlength{\leftmargin}{\labelwidth}%
        \setlength{\labelsep}{\biblabelsep}%
        \addtolength{\leftmargin}{\labelsep}%
        \setlength{\itemsep}{\bibitemsep}%
        \setlength{\parsep}{\bibparsep}}%
        \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\begin{filecontents}{references.bib}
@article{Smith:01,
  author = {Smith, John},
  year = {2001},
  title = {Article title},
  journal = {Journal title}, 
  volume = {13},
  pages = {1--2}
}

@book{Mueller:02,
  author = {M{\"u}ller, Hans},
  year = {2002},
  title = {Book title},
  publisher = {Publisher},
  address = {Address}
}
\end{filecontents}

\begin{document}
\cite{Smith:01}, \cite{Mueller:02} 

\printbibliography 

\end{document}

enter image description here

Edit: Of course, if you're happy with the standard numeric style, there is an even simpler solution with biblatex, because one can make the difference between citestyle and bibstyle.

\documentclass{article}
\usepackage[
    natbib=true,
    citestyle=authoryear,
    bibstyle=numeric,
    ]{biblatex}
\addbibresource{references.bib}

\begin{filecontents}{references.bib}
@article{Smith:01,
  author = {Smith, John},
  year = {2001},
  title = {Article title},
  journal = {Journal title}, 
  volume = {13},
  pages = {1--2}
}

@book{Mueller:02,
  author = {M{\"u}ller, Hans},
  year = {2002},
  title = {Book title},
  publisher = {Publisher},
  address = {Address}
}
\end{filecontents}

\begin{document}
\cite{Smith:01}, \cite{Mueller:02} 
\printbibliography 
\end{document}
Timm
  • 899
  • Thanks so much for this. I tried to implement it with my external NET.bib file, but i got an error that 'NET.bbl not created by bibtex' – DankMasterDan Jun 17 '15 at 00:55
  • @DankMasterDan You need to run biber rather than bibtex to create the .bbl. You should have a .bcf file produced after the first latex run. – cfr Jun 17 '15 at 01:01
  • Ok, so I converted to biblatex and it seemed that my .bib file was not being detected. Then I just made a new file & copied what was done above. And still I got an error output that non of the citations were defined (the output was "Smith:01 Mueller:02") – DankMasterDan Jun 17 '15 at 01:21
  • @DankMasterDan What id biber say? – cfr Jun 17 '15 at 02:28
  • @DankMasterDan: biber is not essential here. You may comment out backend=biber and use bibtex instead. If your bib-file was not found, have a look at \addbibresource{references.bib}. – Timm Jun 17 '15 at 06:16
  • 2
    @Timm: No, it should be backend=bibtex8, as biber is the default in recent versions of biblatex. It is perfectly possible to still use bibtex, but in that case highly preferrable to use the 8-bit version including the "Wolfgang" switch (bibtex8 -W) as the internal buffers of classical 7-bit bibtex are often too small. – Daniel Jun 17 '15 at 06:36
  • yes! got it to work. Thanx!!!! – DankMasterDan Jun 17 '15 at 18:04