# biblatex instead of natbib in elsarticle, how?

I'm using elsarticle and I would like to apply biblatex for my references but apparantly natbib.sty is loaded by default. In this case how can I use biblatex or how can I disable natbib?

%% natbib.sty is loaded by default. However, natbib options can be
%% provided with \biboptions{...} command. Following options are
%% valid:

%%   round  -  round parentheses are used (default)
%%   square -  square brackets are used   [option]
%%   curly  -  curly braces are used      {option}
%%   angle  -  angle brackets are used    <option>
%%   semicolon  -  multiple citations separated by semi-colon
%%   colon  - same as semicolon, an earlier confusion
%%   comma  -  separated by comma
%%   numbers-  selects numerical citations
%%   super  -  numerical citations as superscripts
%%   sort   -  sorts multiple citations according to order in ref. list
%%   sort&compress   -  like sort, but also compresses numerical citations
%%   compress - compresses without sorting
%%
%% \biboptions{comma,round}

% \biboptions{}

\usepackage[
backend=biber,
style=alphabetic,
citestyle=authoryear
]{biblatex}

\begin{document}
bla bla bla
\printbibliography
\end{document}


Messages/Log file: Command \bibhang already defined,

• From your code it's impossible to say: presumably something earlier is loading natbib Aug 2, 2016 at 7:28
• Welcome. Sorry, but that is not your decision. The journal has its workflow and they are using natbib. Maybe it will be different in the future, who knows? Aug 2, 2016 at 7:29
• Well, that's sad, but thank you, I appreciate it. Aug 2, 2016 at 7:34
• There is \RequirePackage[\@biboptions]{natbib} inside of elsarticle.cls. Aug 2, 2016 at 7:36

## If you consider submitting your papers with this hack in place, please stop reading right now!

\RequirePackage{scrlfile}
\documentclass{elsarticle}
\expandafter\let\csname c@author\endcsname=\relax
\usepackage[
backend=biber,
style=authoryear,
]{biblatex}
\begin{document}
\cite{aristotle:physics}

\printbibliography
\end{document}

• This breaks with the ´3p´ or ´5p´ options to ´elsarticle´. Any suggestions? Nov 27, 2017 at 20:19
• @flindeberg Considering the warnings, i would recommend not to use stuff like that. Nov 28, 2017 at 4:13
• I'm not questioning the stupidity of doing it, I'm asking how to do it. Anyhow I solved it, and will link when I'm at a computer again. Nov 28, 2017 at 11:33
• Hi @flindeberg, Could you give us a clue how you solved it? Since the logos do not found: elsevier-logo-0p, SDlogo-0p, I tried to put this name's file in my directory, but my title is not aligned. Jun 21, 2018 at 4:07
• @Oromion Added an answer, hope it solves the issues. If not just comment on my answer! Jun 21, 2018 at 9:42

According to the documentation of the last release of elsarticle, option nonatbib can be used. However,

\makeatletter
\let\c@author\relax
\makeatother


is needed according to this answer to get rid of the following error:

\documentclass[nonatbib]{elsarticle}

\makeatletter
\let\c@author\relax
\makeatother

\usepackage[backend=biber,hyperref=true,doi=false,url=false,isbn=false, uniquename=false, uniquelist=false ]{biblatex}

\usepackage{filecontents,hyperref}

\begin{filecontents*}{\jobname.bib}
@Article{Fornberg2008,
author =    {Fornberg, Bengt and Piret, Cécile},
title =     {On choosing a radial basis function and a shape parameter when solving a convective PDE on a sphere},
journal =   {Journal of Computational Physics},
year =      {2008},
volume =    {227},
number =    {5},
pages =     {2758-2780},
month =     {feb},
doi =       {10.1016/j.jcp.2007.11.016},
issn =      {0021-9991},
publisher = {Elsevier {BV}},
type =      {Journal Article},
url =       {http://dx.doi.org/10.1016/j.jcp.2007.11.016}
}
\end{filecontents*}

\begin{document}

Lorem ipsum~\cite{Fornberg2008}.

\printbibliography

\end{document}


• This works fine! Thank you! But is there also a way to accomplish this with the harvard template and citation style?
– xyz
Jul 22, 2021 at 15:03
• @xyz I think your question has an answer in the documentation of biblatex.
– Diaa
Jul 22, 2021 at 15:42
• @Diaa what do you mean by that? There is no harvard citation style in biblatex. I wondered, because biblatex can't use the cst file attached to the elsarticle template.
– xyz
Jul 28, 2021 at 17:26
• @xyz I have no idea. I just presumed.
– Diaa
Jul 28, 2021 at 21:39

## If you consider submitting your papers with this hack in place, please stop reading right now!

Sometimes the macros defined by the journal documentclasses come in handy for typesetting personal notes. For such private documents however one also wants to exploit the convenience of modern package such as biblatex.

The elsarticle documentclass loads natbib internally which is a show stopper for biblatex. The natbib package is loaded with the line

\RequirePackage[\@biboptions]{natbib}


To this end, hacking into \RequirePackage and make it just skip over natbib would solve the problem at hand. I use the xparse package and the underlying expl3 programming layer to realise such a macro. The (re)definition of such a macro obviously has to be placed before \documentclass.

Furthermore, elsarticle defines a counter called author, which is never used by the class but required by biblatex. We simply undefine the counter by letting its underlying count variable to \relax.

\RequirePackage{xparse}

\ExplSyntaxOn

\clist_new:N \pkg_ignored_clist
\clist_put_right:Nn \pkg_ignored_clist { natbib }

\msg_new:nnn { pkg } { pkg-ignored } { Package~#1~ignored! }

\cs_set_eq:NN \latex_require_package:wnw \RequirePackage

\cs_new_protected:Npn \pkg_require_package:nnn #1#2#3
{
\IfValueTF { #1 }
{
\IfValueTF { #3 }
{ \latex_require_package:wnw [ #1 ] { #2 } [ #3 ] }
{ \latex_require_package:wnw [ #1 ] { #2 }        }
}
{
\IfValueTF { #3 }
{ \latex_require_package:wnw { #2 } [ #3 ] }
{ \latex_require_package:wnw { #2 }        }
}
}

\RenewDocumentCommand \RequirePackage { o m o }
{
\clist_if_in:NnTF \pkg_ignored_clist { #2 }
{
\msg_warning:nnn { pkg } { pkg-ignored } { #2 }
}
{
\pkg_require_package:nnn { #1 } { #2 } { #3 }
}
}

\ExplSyntaxOff

\documentclass{elsarticle}
\expandafter\let\csname c@author\endcsname=\relax
\usepackage[style=authoryear,natbib]{biblatex}
\begin{document}
\Citet{weinberg}

\printbibliography
\end{document}


@Oromion asked how I solved it for 3p and 5p so putting an MWE here. Do note that this is not for publications, and I did it after a couple of students requested help since they had been asked to write an "Elsevier style paper" for a course.

\documentclass[5p]{elsarticle}

%% Fix so biblatex works instead of natbib
\makeatletter
\let\c@author\relax
\makeatother
\let\bibhang\relax
\let\citename\relax
\let\bibfont\relax
\let\Citeauthor\relax
\expandafter\let\csname ver@natbib.sty\endcsname\relax

\makeatletter
\def\ps@pprintTitle{%
\def\@oddfoot{}%
\let\@evenfoot\@oddfoot}
\makeatother

%% Load some packages and stuff

%% Library and stuff
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
%% biblatex with apa-style.
\DeclareLanguageMapping{american}{american-apa}
\bibliography{library}

%% Rest as usual....

• Please Is there any other options to achieve that for publications? May 2, 2019 at 19:05