I have the following problem with unsrtnat not following the order of appearance in the document (sort of):
The document is split in several sub-documents. In the main part, a usual .bib file is included as well as citations.
In between a number of sub-documents are included using \import; each has their own share of citations that are added to the main bibliography using
\AtEndEnvironment{thebibliography}{
\bibitem{example}
....
}
The result is, if the main document is structured like
A(main)
B(included)
C(main)
That citations are numbered in the order of appearance following ACB instead of ABC.
Any suggestions?
Edit: Minimal working example, main file
\documentclass{article}
\usepackage{etoolbox}
\bibliographystyle{unsrtnat}
\begin{document}
Example\cite{A}.
\input{sub}
Example\cite{C}.
\bibliographystyle{unsrtnat}
\begin{thebibliography}{1}
\bibitem{A}
This should be the first.
\bibitem{C}
This should be the third.
\end{thebibliography}
\end{document}
And sub-file:
Example\cite{B}.
\AtEndEnvironment{thebibliography}{
\bibitem{B}
This should be the second.
}
\documentclass{...}and ending with\end{document}. – Heiko Oberdiek Feb 14 '17 at 10:52\import? I never used that command, and do not know if it may be responsible for the problem. Can you use\inputor\includeinstead, and does the problem persist in that case? Compare here. – Manuel Weinkauf Feb 14 '17 at 10:56\citeas normal? – David Carlisle Feb 14 '17 at 11:11I want to include the citations that way because the main file uses a .bib file and the sub-file is an older part that has just a bunch of bib-entries directly written in the document. Alternative approaches are also welcome :)
– SelfEnergy Feb 14 '17 at 11:21\AtEndEnvironmentmay cause the problem. And I do not see a reason why it should be neccessary. A simple\cite{B}in the sub-file should suffice. – Manuel Weinkauf Feb 14 '17 at 11:24\citewith bibtex or simply stop using bibtex at all now, and take the generated bbl file for your main file , edit in the entries from your include at whatever point you want. Doing half by bibtex and half manually just seems to be making work. – David Carlisle Feb 14 '17 at 11:24thebibliographyenvironment at all, instead of a simple\bibliography{lit.bib}? – Manuel Weinkauf Feb 14 '17 at 11:26