# Adding “references.bib” on my .tex produces an Error: Command \bibhang already defined. Removing it, compiles the file perfectly!

This is My 1st try to produce an Article-Like document.

Here's the format I have followed, and the sample text worked perfectly!!

The bibliography tho, was added not in the way I liked it; I used to add bibliography like this;

@ARTICLE{2016MNRAS.457.1722R,
author = {{Rieder}, M. and {Teyssier}, R.},
title = "{A small-scale dynamo in feedback-dominated galaxies as the origin of cosmic magnetic fields - I. The kinematic phase}",
journal = {\mnras},
archivePrefix = "arXiv",
eprint = {1506.00849},
keywords = {MHD, turbulence, methods: numerical, galaxies: magnetic fields},
year = 2016,
month = apr,
volume = 457,
pages = {1722-1738},
doi = {10.1093/mnras/stv2985},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}


To follow that, I went to my "Thesis" tex and copied what was there;

\usepackage[style=authoryear,sorting=none]{biblatex}


and on the end of the .tex:

\printbibliography


and of course I copied references.bib on my folder.

Those two, results on the following Error:

! LaTeX Error: Command \bibhang already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help. ...
l.462 \newlength{\bibhang}


I tried to follow some other similar questions, but couldn't fine any commands like these;

\PassOptionsToPackage{square,numbers}{natbib}
\RequirePackage{natbib}


on any of my files.

EDIT: Here is part of my code:

\documentclass{aa}
\usepackage{graphicx}
\usepackage{txfonts}
\usepackage[style=authoryear,sorting=none]{biblatex}
\begin{document}
\printbibliography
\end{document}

• aa.cls loads natbib which defines \bibhang. biblatex also defines \bibhang. You can't use natbib and biblatex. They are totally different ways of handling references. – David Purton Nov 15 '17 at 10:13
• also you can format code blocks by indenting 4 spaces. You can do this automatically by highlighting your code block and pressing ctrl+k – David Purton Nov 15 '17 at 10:17
• @DavidPurton any Idea on how to fix this? I want to use biblatex. Also, thanks for the info! Fixed it! – user174411 Nov 15 '17 at 10:19
• If you want to submit, it is quite unlikely that they will accept biblatex. Especially since their class mandates natbib. See Biblatex: submitting to a journal. And if you don't want to submit to their journal, why do you use their class in the first place? – moewe Nov 15 '17 at 10:54
• You got a point! Ty for your info! – user174411 Nov 15 '17 at 11:34

If you are submitting to the journal they will probably not accept biblatex, but if you just want to use biblatex with aa.cls and not submit to the journal then you can load the class with the bibyear option which does not load natbib. (I don't know what other side effects this may have, but you can probably work around them.)

MWE:

\documentclass[bibyear]{aa}
\usepackage{txfonts}
\usepackage[style=authoryear,sorting=none]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{2016MNRAS.457.1722R,
author = {Rieder, M. and Teyssier, R.},
title = {A small-scale dynamo in feedback-dominated galaxies as the origin of cosmic magnetic fields - I. The kinematic phase},
journal = {\mnras},
archivePrefix = {arXiv},
eprint = {1506.00849},
keywords = {MHD, turbulence, methods: numerical, galaxies: magnetic fields},
year = {2016},
month = {4},
volume = {457},
pages = {1722-1738},
doi = {10.1093/mnras/stv2985},

• Wow, REALLY thank you! I didn't know biblatex was not acceptable. I guess I have to find out how natbib works. Much useful information! Up-voted and Accepted – user174411 Nov 15 '17 at 11:33