There seems to be a issue with the combination of natbib
and the usage of package bibunits
by apxproof
. It works, when using, for example:
\begin{filecontents*}[force]{test.bib}
@phdthesis{Johnson1973,
author = {D. S. Johnson},
title = {Near-optimal bin packing algorithms},
school = {Massachusetts Institute of Technology},
year = {1973},
type = {PhD thesis},
}
\end{filecontents*}
\documentclass{article}
\usepackage{natbib}
\bibliographystyle{apalike}
\usepackage[bibliography=common]{apxproof}
\begin{document}
Citing \cite{Johnson1973} in the main paper.
\begin{toappendix}
Citing \cite{Johnson1973} in the appendix.
\end{toappendix}
\bibliography{test}
\end{document}
with common instead of a separate references:
It also works for split references without natbib
or package apalike
instead of natbib
:
\begin{filecontents*}[force]{test.bib}
@phdthesis{Johnson1973,
author = {D. S. Johnson},
title = {Near-optimal bin packing algorithms},
school = {Massachusetts Institute of Technology},
year = {1973},
type = {PhD thesis},
}
\end{filecontents*}
\documentclass{article}
\usepackage{apalike}
\bibliographystyle{apalike}
\usepackage{apxproof}
\begin{document}
Citing \cite{Johnson1973} in the main paper.
\begin{toappendix}
Citing \cite{Johnson1973} in the appendix.
\end{toappendix}
\bibliography{test}
\end{document}
But not, when changing the bibliography style of the appendix also to apalike
:
\begin{filecontents*}[force]{test.bib}
@phdthesis{Johnson1973,
author = {D. S. Johnson},
title = {Near-optimal bin packing algorithms},
school = {Massachusetts Institute of Technology},
year = {1973},
type = {PhD thesis},
}
\end{filecontents*}
\documentclass{article}
\usepackage{apalike}
\bibliographystyle{apalike}
\usepackage{apxproof}
\renewcommand\appendixbibliographystyle{apalike}
\begin{document}
Citing \cite{Johnson1973} in the main paper.
\begin{toappendix}
Citing \cite{Johnson1973} in the appendix.
\end{toappendix}
\bibliography{test}
\end{document}
→
./bu1.bbl
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.3 \bibitem[Johnson, 1973]{Johnson1973}
?
I would suggestion another solution: Use of biblatex
and the section of segment feature of biblatex
. This would also need to use option bibliography=common
, but nevertheless you can generate a separate bibliography for the appendix:
\begin{filecontents*}[force]{test.bib}
@phdthesis{Johnson1973,
author = {D. S. Johnson},
title = {Near-optimal bin packing algorithms},
school = {Massachusetts Institute of Technology},
year = {1973},
type = {PhD thesis},
}
\end{filecontents*}
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\addbibresource{test.bib}
\addbibresource{biblatex-examples.bib}
\usepackage[bibliography=common]{apxproof}
\renewcommand*{\appendixprelim}{\newrefsegment}
\begin{document}
Citing \cite{Johnson1973} and \autocite{knuth:ct:a} in the main paper.
\begin{toappendix}
Citing \cite{Johnson1973} and \autocite{knuth:ct:b} in the appendix.
\end{toappendix}
\printbibliography[segment=0]
% Add this at the end, to print the segment bibliography at the end of the appendix.
\nosectionappendix
\begin{toappendix}
\printbibliography[title=References for the
Appendix,segment=1]
\end{toappendix}
\end{document}
or
\begin{filecontents*}[force]{test.bib}
@phdthesis{Johnson1973,
author = {D. S. Johnson},
title = {Near-optimal bin packing algorithms},
school = {Massachusetts Institute of Technology},
year = {1973},
type = {PhD thesis},
}
\end{filecontents*}
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\addbibresource{test.bib}
\addbibresource{biblatex-examples.bib}
\usepackage[bibliography=common]{apxproof}
\renewcommand*{\appendixprelim}{\newrefsegment}
\begin{document}
Citing \cite{Johnson1973} and \autocite{knuth:ct:a} in the main paper.
\begin{toappendix}
Citing \cite{Johnson1973} and \autocite{knuth:ct:b} in the appendix.
\end{toappendix}
\printbibliography[segment=0,heading=subbibliography]
% Add this at the end, to print the segment bibliography at the end of the appendix.
\nosectionappendix
\begin{toappendix}
\printbibliography[title=References for the
Appendix,segment=1]
\end{toappendix}
\end{document}
Both result in:
natbib
. Withoutnatbib
it works. It also works with packageapalike
instead ofnatbib
. To use the same bibliography style for the main and the appendix reference, you can redefine\appendixbibliographystyle
. But then is seem not to work withapalike
. So there seem to be some strange incompatibilities. I would recommend to report an issue → github.com/PierreSenellart/apxproof/issues. But maybe this is just an incompatibility ofbibunits
package, which I never use.