Using Chapterbib Eliminates Options for achemso package

I am trying to use the achemso package to format my bibliography, while also using chapterbib to have a separate bibliography for each chapter. I load the two packages as such

\usepackage[sectionbib]{chapterbib} \usepackage[articletitle=true,etalmode=truncate,maxauthors=5,biblabel=fullstop,doi=true]{achemso}

I am using include for each of the individual chapters

\include{Chapters/Chapter1}

And in each chapter I make the bibliography using

\bibliographystyle{achemso}

\bibliography{All_References}

Where All-References contains the bibtex bibliography entries. When I do this the document compiles and looks fine, however the options that are included when loading the achemso package are ignored. However if I comment out the chapterbib command the options are followed, however I don't get a bibliography for each chapter.

MWE:

Main.tex:

\usepackage[utf8]{inputenc}
%\usepackage[sectionbib]{chapterbib}
\usepackage[articletitle=true,etalmode=truncate,maxauthors=5,biblabel=fullstop,doi=true]{achemso}
\begin{document}
\include{Section}
\end{document}


Section.tex:

Something\cite{VanOrden2015}

\section{References}
\bibliographystyle{achemso}
\bibliography{References}


References.bib:

@article{VanOrden2015,
author = {Melnykov, Artem V. and Nayak, Rajesh K. and Hall, Kathleen B. and Van Orden, Alan},
title = {Effect of Loop Composition on the Stability and Folding Kinetics of RNA Hairpins with Large Loops},
journal = {Biochemistry},
volume = {54},
number = {10},
pages = {1886-1896},
year = {2015},
doi = {10.1021/bi5014276},
PMID= {25697574},
URL = {
https://doi.org/10.1021/bi5014276
},
eprint = {
https://doi.org/10.1021/bi5014276
}
}


Note that commenting out and uncommenting the second line in the main.tex file changes the way that the bibliography appears (the DOI goes away when the second line is present)

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Alessandro Cuttin Mar 23 '20 at 21:22

achemso uses a very clever way to pass options to the bibliography style: It puts all the options into an internal .bib entry called achemso-control that is automatically cited by the achemso package. This allows you to control the behaviour of the bibliography style via package options in the .tex file.

If you use chapterbib you have to cite this entry manually. The easy way would be to do that by putting putting \nocite{achemso-control} at the beginning of each \chapter.

But to avoid spurious warnings, we need a slightly more sophisticated approach. Define

\makeatletter
\newcommand*{\achemsocontrolbib}{%
\immediate\write\@auxout{%
\string\citation\string{achemso-control\string}%
}}
\makeatother


and call that at the beginning of each chapter.

Here is a self-contained example file that includes files for two chapters and a .bib example.

\documentclass{report}
\usepackage[sectionbib]{chapterbib}
\usepackage[biblabel=fullstop,
etalmode=truncate,maxauthors=5,
articletitle=true,doi=true]{achemso}

\makeatletter
\newcommand*{\achemsocontrolbib}{%
\immediate\write\@auxout{%
\string\citation\string{achemso-control\string}%
}}
\makeatother

% chapter 1
\begin{filecontents}{\jobname-1.tex}
\achemsocontrolbib
\chapter{One}
Something\cite{VanOrden2015}

\bibliographystyle{achemso}
\bibliography{\jobname}
\end{filecontents}

% chapter 2
\begin{filecontents}{\jobname-2.tex}
\achemsocontrolbib
\chapter{Two}
Something else\cite{VanOrden2015,sigfridsson}

\bibliographystyle{achemso}
\bibliography{\jobname}
\end{filecontents}

% bib file
\begin{filecontents}{\jobname.bib}
@article{VanOrden2015,
author  = {Melnykov, Artem V. and Nayak, Rajesh K.
and Hall, Kathleen B. and Van Orden, Alan},
title   = {Effect of Loop Composition on the Stability
and Folding Kinetics of {RNA} Hairpins with Large Loops},
journal = {Biochemistry},
volume  = {54},
number  = {10},
pages   = {1886-1896},
year    = {2015},
doi     = {10.1021/bi5014276},
PMID    = {25697574},
}
@article{sigfridsson,
author       = {Sigfridsson, Emma and Ryde, Ulf},
title        = {Comparison of Methods for Deriving Atomic Charges from the
Electrostatic Potential and Moments},
journal      = {Journal of Computational Chemistry},
year         = 1998,
volume       = 19,
number       = 4,
pages        = {377-395},
doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}

\begin{document}
\include{\jobname-1}
\include{\jobname-2}
\end{document}


• Perfect! Thank You – Ryan Mar 28 '20 at 21:41
• Next time I update chapterbib (soon) I'll add this \nocite to happen automatically. – Donald Arseneau May 8 '20 at 9:16
• I wonder if it is possible to suppress the warning Package natbib Warning: Citation achemso-control' undefined on input line 5. – Donald Arseneau May 8 '20 at 9:44
• @DonaldArseneau The spurious warning Package natbib Warning: Citation achemso-control' undefined on input line 5. can be avoided by writing \citation{achemso-control} directly to the .aux bypassing \nocite (changed in the answer). I just noticed warnings about Package achemso Warning: \bibliographystyle ignored on input line 9. But the \bibliographystyle{achemso} is required in this setup. – moewe May 8 '20 at 12:12
• @moewe I suspected that. Sounds fine. – Donald Arseneau May 8 '20 at 18:39