4

I have been struggling a lot with this problem now. Hopefully somebody can help me. I want to create a document with chapterwise bibliography, so I use \usepackage{chapterbib} together with \usepackage[sectionbib]{natbib}:

\documentclass{report}

\usepackage{chapterbib}
\usepackage[sectionbib]{natbib}

\begin{document}

\include{chapter1}

\end{document}

where the file chapter1.tex (in the same folder) is

\chapter{Chapter 1}
this is chapter 1~\cite{Article1}

\bibliographystyle{plain}
\bibliography{references}

and the file references.bib (also in the same folder) reads

@article{Article1,
    author = {Author1},
    journal = {J. Art.},
    pages = {1906--1911},
    title = {{This is the first article}},
    volume = {12},
    number = {3},
    year = {2012}
}

While the second citation (Article2) is displayed as expected, there is a question mark where the first citation should be: https://www.dropbox.com/s/zhtuz9nw0otuw6i/Include.pdf?dl=0

What am I doing wrong?

  • What I forgot to mention: It does work if you substitude \include by \input. But then, chapterbib does not work anymore. – Dietmar Haba Dec 11 '15 at 16:54
  • 1
    you should use \include with all the chapters and run bibtex separately on each chapter to generate the separate bibliographies – David Carlisle Dec 11 '15 at 17:12
  • This is what I have done several times. Does not seem to work. – Dietmar Haba Dec 14 '15 at 11:45
  • If you have a version that you think should work but does not, edit the question above to be that code (so move \chapter out of the main file) and then say exactly how it "does not work" show exactly how you called bibtex and what error log you got – David Carlisle Dec 14 '15 at 11:54
  • 2
    I found the problem now. I didn't know that TeXstudio uses bibtex always on the main document, even if chapter1.tex is active. I had to run bibtex via the command window to make it work. Strange. Thanks anyway. – Dietmar Haba Dec 14 '15 at 15:55
4

You should use \include with all the chapters and run bibtex separately on each chapter to generate the separate bibliographies, one for each chapter.

  • This is what I have done several times. Does not seem to work. – Dietmar Haba Dec 14 '15 at 9:50
1

The problem was that my LaTeX editor, TeXstudio, does not run bibtex on the active document, but always on the main document. However, bibtex must be run on the sub-document to generate (what was in my case called) chapter1.bbl. Running bibtex via the command window solved the problem.

  • If you happen to use texlive (and not miktex) then compiling on the code with latexmk - pdf master.tex ought to run bibtex automatically on each separate part – daleif Dec 14 '15 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.