3

I'm using chapterbib package to generate a bibliography for each chapter. But the compilation fails.

Here is the content of my principal.tex file:

\documentclass[phd]{theseUL}

\usepackage{lmodern}
\usepackage[utf8]{inputenc}
%\usepackage[french]{babel}
\usepackage{fancyhdr}
\usepackage{amsfonts}
\usepackage{url}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{color}
\usepackage{verbatim}
\usepackage{enumerate}
\usepackage{makeidx}
\usepackage{topcapt}
\usepackage{setspace}
\usepackage{rotfloat}

\usepackage[square,sort,comma, authoryear]{natbib}
\usepackage{chapterbib}

\begin{document}

\part{Contexte général et état de l'art}
\include{../chap1_introduction/chap1_introduction}
\input{../chap2_definitions/chap2_definitions}

\end{document}

Here is the content of chap1_introduction.tex

\chapter{Introduction}  %%This is chapter 1

\phantomsection\addcontentsline{toc}{chapter}{Introduction}

Text

\bibliographystyle{authordate1}
\bibliography{principal}

And so for the content of chap2_definitions.tex

\chapter{Definition} %%This is chapter 2

\phantomsection\addcontentsline{toc}{chapter}{Definition}

Text

\bibliographystyle{authordate1}
\bibliography{principal}

This is how I compile my documents:

  1. pdflatex principal.tex (success)
  2. pdflatex principal.tex (success)
  3. bibtex principal (2 errors, I guess it is normal: see output #1)
  4. bibtex ../chap1_introduction/chap1_introduction (see output #2)
  5. bibtex ../chap2_definitions/chap2_definitions (see output #3)
  6. pdflatex principal.tex
  7. pdflatex principal.tex

Output #1

XXXX@IFTEaigny2:~/Phd/principal$ bibtex principal
This is BibTeX, Version 0.99c (TeX Live 2009/Debian)
The top-level auxiliary file: principal.aux
The style file: authordate1.bst
Illegal, another \bibstyle command---line 51 of file principal.aux
 : \bibstyle
 :          {authordate1}
I'm skipping whatever remains of this command
Illegal, another \bibdata command---line 52 of file principal.aux
 : \bibdata
 :         {principal}
I'm skipping whatever remains of this command
Database file #1: principal.bib
Warning--to sort, need author or key in GrownUpDigital2009
Warning--empty author in GrownUpDigital2009
Warning--empty journal in GrownUpDigital2009
Warning--empty journal in Torres2008
(There were 2 error messages)

Output #2

XXXX@IFTEaigny2:~/Phd/principal$ bibtex principal
This is BibTeX, Version 0.99c (TeX Live 2009/Debian)
The top-level auxiliary file: ../chap1_introduction/chap1_introduction.aux
The style file: authordate1.bst
I couldn't open database file chap1_introduction.bib
---line 43 of file ../chap1_introduction/chap1_introduction.aux
 : \bibdata{chap1_introduction
 :                            }
I'm skipping whatever remains of this command
I found no database files---while reading file ../chap1_introduction/chap1_introduction.aux
Warning--I didn't find a database entry for "Downes2005"
Warning--I didn't find a database entry for "Hadjerrouit2005"
Warning--I didn't find a database entry for "Hadjerrouit2007"
Warning--I didn't find a database entry for "Wilson2007"
Warning--I didn't find a database entry for "Seffah2002"
Warning--I didn't find a database entry for "Torres2008"
Warning--I didn't find a database entry for "Downes2004"
Warning--I didn't find a database entry for "GrownUpDigital2009"
(There were 2 error messages)

output #3 is same than output #2

principal.bib is the entire citation databse for the whole document and is in /principal; so I have principal/principal.bib.

Should I compile the chapters bibtex from the chapter subdirectory, or from the principal subdirectory as I did? I tried both withe the same result.

Thank you.

1
4

I already answered here on LaTeX-Community, but also here my answer. I can see that you use \input for including the chapters in this line:

\input{../chap2_definitions/chap2_definitions}

However, you should use \include instead, this way you would get .aux files for each chapter which can be processed. Otherwise, with \input, you would need \cbinput or the cbunit environment. However, \include is strongly recommended. You use chapters, for sure starting a new page, so \include would be fine.

Here's also a solution: chapterbib | References following each Chapter. Also there, the solution was using \include but additionally having the files in the same directory.

3
  • Hallo Stefan, I did already tried both \include and \input but could not make the compilation works. I did already also saw the page you are referring to me. I took the time to look after Chapterbib reference on latex-community.org and else where. Today is my third day of search on the topic. I believe the compilation errors comes from the structure in subdirectories of my project.
    – cProg
    Aug 3 '14 at 21:52
  • As I said earlier, this is how I compiled my documents: Questions: 1. pdflatex principal.tex (success) 2. pdflatex principal.tex (success) 3. bibtex principal (2 errors, I guess it is normal: see output #1) 4. bibtex ../chap1_introduction/chap1_introduction (see output #2) 5. bibtex ../chap2_definitions/chap2_definitions (see output #3) 6. pdflatex principal.tex 7. pdflatex principal.tex 1-When I run this command line bibtex ../chap1_introduction/chap1_introduction I run it from the principal directory. Is that correct?
    – cProg
    Aug 3 '14 at 21:55
  • 2-Also as the content of my chapter files showed it, those files has no header and start directly with the chapter content; also there is no [code]\end{document}[/code] at the end of those files too, and I understand why. But it is not possible to compile such a file, for example the chap1_introduction itself to produce the chap1_introduction.aux file which is needed by the principal.tex compilation process.
    – cProg
    Aug 3 '14 at 21:56
0

Problem is fixed. I think errors came from the used document class package. Instead of \documentclass[phd]{theseUL} I used this class package \documentclass[a4paper, 12pt]{report} and compilation run successfuly. Thank you Stefan for your support.

0

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.