I am struggling to get bibunits
and natbib
to work together, even though bibunits claims to be compatible with natbib.
(To give some context, in the end, I wish to produce chapter bibliographies, where each chapter has a separate .bib
-file.)
The problem is that either I place \usepackage{natbib}
before \usepackage{bibunits}
in which case compilation works, but any options (e.g. authoryear) from natbib are completely ignored.
Is there something I need to do/add to make bibunits use author-year style as I wish?
While the above order seems natural and at least produces a complete document, I also tried the reverse:
If I reverse the order (bibunits before natbib), compilation fails (both in overleaf and texstudio). More precisely, it seems on the first run (after processing bu1.aux) it produces a pdf with ? in the text in place of the citations, and subsequent runs either go on without ever terminating and without an error message, or they just produce the error Package natbib Error: Bibliography not compatible with author-year citations. ...mmand\NAT@force@numbers{}\NAT@force@numbers
The latter error appears even when not using the authoryear option of natbib.
Example is below, or use this overleaf link: https://www.overleaf.com/read/spdfhstxqrtr
\documentclass{article}
\usepackage[round,authoryear]{natbib}
\bibliographystyle{ecta}
\usepackage{bibunits}
\usepackage{filecontents}
\begin{filecontents}{mybib.bib}
@ARTICLE{Meyer2000,
AUTHOR="Bernd Meyer",
TITLE="A constraint-based framework for diagrammatic reasoning",
JOURNAL="Applied Artificial Intelligence",
VOLUME= "14",
ISSUE = "4",
PAGES= "327--344",
YEAR=2000
}
@ARTICLE{Codishetal2000,
AUTHOR="M. Codish and K. Marriott and C.K. Taboch",
TITLE="Improving program analyses by structure untupling",
JOURNAL="Journal of Logic Programming",
VOLUME= "43",
ISSUE = "3",
PAGES= "251--263",
YEAR=2000
}
\end{filecontents}
\begin{document}
\begin{bibunit}
References to the \TeX book \cite{Meyer2000}
and to Lamport’s \LaTeX\ book, which appears
only in the references \citep{Codishetal2000}.
\putbib[mybib]
\end{bibunit}
\end{document}
I do realize this question: bibunits and natbib is related, but it does not seem to be the same (I can't get it to work regardless of styles etc.), also the question is incomplete, without working example etc., so I hope it is ok to ask what I am asking.