[Tex/LaTex] natbib package error

errorsnatbib

I have been using the regular \cite command for my citations all the time. But now I used the 'natbib' package and instead used \citep and \citet, but this keeps giving me errors in the natbib.sty file which it creates. I also get the error 'command \bibhang already defined'.

Does anyone have experience with this?

\documentclass[a4paper,12pt]{report}
\usepackage{graphicx}
\usepackage[backend=biber]{biblatex}
\usepackage{algorithm}
\usepackage{caption}
\usepackage[comma,authoryear]{natbib}
\bibliographystyle{ieeetr}
\addbibresource{bib/literature.bib}
\begin{document}[a4paper,12pt]

\chapter*{Declaration}

\chapter*{Abstract}

 \chapter*{List  of abbrevations and symbols}

 \tableofcontents

\chapter{Introduction}

as mentioned in \citet{england2002}

\section{Insurance industry}


\section{IBNR Claims and Claims Reserving}

\section{Link with GLM}


\section{Robustification and Problems}

\section{Applications}

\chapter{Body}

\chapter{Conclusion}

\printbibliography 
\end{document}

using this .bib file:

@article{england2002,
title={Stochastic claims reserving in general insurance},
author={England, Peter D and Verrall, Richard J},
journal={British Actuarial Journal},
volume={8},
number={03},
pages={443--518},
year={2002},
publisher={Cambridge Univ Press}
}

Best Answer

There are several problems with your example code.

  • You should start by immediately removing both arguments from the document environment. The instruction should read

    \begin{document}
    

    rather than \begin{document}[a4paper,12pt]. The document environment does not take arguments. Nothing good is going to come from supplying arguments, optional or otherwise, to the document environment.

  • Don't load both the biblatex package and the natbib package. Select one or the other, but not both.

  • Assuming you want to continue with natbib (@Johannes_B's learned opinion notwithsstanding...), you need to observe that the ieeetr bibliography style is not compatible with authoryear-style citation call-outs. You should therefore load the natbib package with the options numbers and comma, not authoryear and comma. Don't forget to delete the instruction \addbibresource{bib/literature.bib} and to replace \printbibliography with \bibliography{bib/literature} -- note: no filename extension. By the way, with numeric-style citation call-outs in use, \citet will give you a warning message; use \cite instead.

  • If you do need or want authoryear-style citation call-outs along with IEEE-style formatted bib entries, I suggest you switch to the IEEEtranN bibliography style. If you go this route, be sure to omit the numbers option when loading natbib.

    The output from your (somewhat condensed) working example then is as follows.

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{lit.bib}
@article{england2002,
  title    = {Stochastic claims reserving in general insurance},
  author   = {England, Peter D and Verrall, Richard J},
  journal  = {British Actuarial Journal},
  volume   = {8},
  number   = {03},
  pages    = {443--518},
  year     = {2002},
  publisher= {Cambridge University Press}
}
\end{filecontents}

\documentclass[a4paper,12pt]{article} % just for this example
\usepackage[comma]{natbib}
\bibliographystyle{IEEEtranN}
\begin{document}

as mentioned in \citet{england2002}, \dots

\bibliography{lit}
\end{document}