0

Using the elegantbook template, a minimum version of my document looks like this:

\RequirePackage{fix-cm}

\documentclass[bibend=bibtex, lang=en, onecolumn, a4, 12pt]{elegantbook}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{setspace}
\doublespacing
\usepackage{tocloft}
\usepackage{biblatex}
%\usepackage{parskip}
\addbibresource{reference.bib}

\addtolength{\cftchapnumwidth}{40pt}

\begin{document}



\frontmatter

\tableofcontents

\mainmatter



\chapter{Introduction}

Blah blah blah \cite{en1}

\printbibliography[heading=bibintoc, title=\ebibname]

\end{document}

But if I change the bibliography sort technique via:

\usepackage[sorting=none]{biblatex}

I get the following error:

Option clash for package biblatex. \addbibresource

Doesn't seem to matter where I put the sorting option (in addbibresource for example), it won't work. But the documentation says this should work - where am I wrong here?

ps. This is the canonical way of doing bibliographies using the elegantbook template. I can't seem to do it using \bibliography etcetera.

1 Answer 1

2

The class elegantbook already loads biblatex for you, but it only allows you to use three of its many options. You can pass the backend, bibstyle and citestyle options to your class and have them forwarded to biblatex, but nothing more. (Personally, I don't think it makes a lot of sense to have a generic document class enforce a particular bibliography package, especially if it adds no further customisations based on that package.)

You cannot load biblatex a second time with options that do not match the options that the document class set. So just adding \usepackage[backend=bibtex, sorting=none]{biblatex} or some such will fail.

You can use \ExecuteBibliographyOptions in your preamble to set the sorting. While not all biblatex options are available via this command, most are and sorting=none, will work.

\documentclass[bibend=bibtex, bibstyle=numeric,]{elegantbook}

\ExecuteBibliographyOptions{sorting=none} 

\addbibresource{biblatex-examples.bib}

\begin{document}
\frontmatter

\tableofcontents

\mainmatter

\chapter{Introduction}

Lorem \cite{sigfridsson}
ipsum \autocite{worman}
dolor \autocite{geer}

\printbibliography[heading=bibintoc, title=\ebibname]
\end{document}

Lorem [1] ipsum [2] dolor [3]

Bibliography section


If you don't want to use \ExecuteBibliographyOptions or want to set an option that is not available via that command, you can abuse the bibstyle document class option and try to also pass the sorting option to biblatex by adding a few curly braces. At the moment this works due to the way the class is coded. (But I don't think this is the intended interface. You may want to get in touch with the class author and discuss your use case with them if that becomes relevant.)

\documentclass[bibend=bibtex, bibstyle={numeric, sorting=none,},]{elegantbook}

\addbibresource{biblatex-examples.bib}

\begin{document}
\frontmatter

\tableofcontents

\mainmatter

\chapter{Introduction}

Lorem \cite{sigfridsson}
ipsum \autocite{worman}
dolor \autocite{geer}

\printbibliography[heading=bibintoc, title=\ebibname]

\end{document}
1
  • Very thorough explanation - thanks, and happy new year! Dec 31, 2022 at 21:33

You must log in to answer this question.

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