0

I have been assigned to make a book out of student paper and I want to make a chapter for each paper and have the bibliography at the end of each chapter. So I tried the following but do not get the proper output. My folder structure is like this

main.tex
--->chapter1
    c1.tex
    b1.bib
--->chapter2
    c2.tex
    b2.bib

main.tex

\documentclass{report}

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

\begin{document}
hello

\input{chapter1/c1}
\input{chapter2/c2}
\end{document}

c1.tex

\chapter{chapter 1}
hi this is chpater 1 ~\cite{b1}

\bibliographystyle{plainnat}
\bibliography{chapter1/b1}

b1.bib

@inproceedings{b1,
  title={chaptrer 1 book},
  author={Gentry, Craig},
  booktitle={Proceedings of the forty-first annual ACM symposium on Theory of computing},
  pages={169--178},
  year={2009}
}

c2.tex

\chapter{chapter 2}
hi this is chapter 2~\cite{b2}

\bibliographystyle{plainnat}
\bibliography{chapter2/b2}

b2.bib

@inproceedings{b2,
  title={chaptrer 2 book},
  author={Gentry, Craig},
  booktitle={Proceedings of the forty-first annual ACM symposium on Theory of computing},
  pages={169--178},
  year={2009}
}

i am using texwork and engine is pdfLatex+makeIndex+BibTex . and also i should mention there is multiple .bib files.

1 . what how should i reference in bib file \bibliography{chapter2/b2} or just \bibliography{b2} ?

  1. i think after running main by pdfLatex should some aux file for each chapter be generated but there is no aux file in folders chapter1 and chapter2. why ?

Update: I run the main file as following :

padfLatex
BibTex
pdfLatex
padfLatex

chapter one is correct But chapter two file citation is like [?] and also shows bibliography of chapter 1 instead of chapter 2.

and this is content of main.aux

\relax 
\citation{b1}
\bibstyle{plainnat}
\bibdata{chapter1/b1}
\@writefile{toc}{\contentsline {chapter}{\numberline {1}chapter 1}{1}\protected@file@percent }
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\bibcite{b1}{{1}{2009}{{Gentry}}{{}}}

\citation{b2}
\bibstyle{plainnat}
\bibdata{chapter2/b2}
\@writefile{toc}{\contentsline {chapter}{\numberline {2}chapter 2}{3}\protected@file@percent }
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\bibcite{b1}{{1}{2009}{{Gentry}}{{}}}
6
  • 1
    What does the "improper output" look like? – Werner Feb 26 at 21:57
  • Welcome to TeX SX! biblatex defines the refsection environments, which gives you the possibility to have bibliographies per chapter. – Bernard Feb 26 at 22:05
  • @Werner actually there is no output . just say to look log file and some warnings "There were undefined references.". do you need a picture of output ? – alfred Feb 27 at 5:57
  • @Bernard could you please provide a simple example that how it works? – alfred Feb 27 at 5:58
  • @alfred: So you're compiling this on Overleaf? Just wanting to make sure you ran BibTeX... – Werner Feb 27 at 6:59

Your Answer

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

Browse other questions tagged or ask your own question.