BibTeX, biblatex and biberChapterbib with subdirectories does not compile

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Chapterbib with subdirectories does not compile

Post by tonguim »

Hi all,

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:

Code: Select all

\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}
\input{../chap1_introduction/chap1_introduction}
\input{../chap2_definitions/chap2_definitions}

\end{document}
Here is the content of chap1_introduction.tex

Code: Select all

\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

Code: Select all

\chapter{Definition} %%This is chapter 2

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

Text

\bibliographystyle{authordate1}
\bibliography{principal}
This is how I compile my documents:

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

Output #1

Code: Select all

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

Code: Select all

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.
Last edited by tonguim on Sun Aug 03, 2014 4:44 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Chapterbib with subdirectories does not compile

Post by Johannes_B »

You tried to be verbose, which is good, but you did not provide a compilable minimal example. We need that to test and propose a solution.

For now: Why don't you use biblatex with biber?

Note: You should update to TeX Live 2014.


EDIT: Crosspost to teX.SX. Gimme Pizza
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Chapterbib with subdirectories does not compile

Post by tonguim »

Good day Johannes_B,
Johannes_B wrote:You tried to be verbose, which is good, but you did not provide a compilable minimal example. We need that to test and propose a solution.
What do you call «compilable minimal example»? I have posted the latex code I have written so that every one could test it and reproduce the errors I am having. I tried to follow the link you have provided about the «compilable minimal example» but that page is no longer available.
Johannes_B wrote: For now: Why don't you use biblatex with biber?
I've many documents written in latex and am familiar with bibtex. I just use my template to write new documents.
Johannes_B wrote: Note: You should update to TeX Live 2014.
How to do that please? As operating system, I'm using Ubuntu 12.04, 64 bits, with texlive-full package. I have tried to update texlive-full package two days ago but have learnt that it is impossible to do the update process automatically under ubuntu because the latex tlmgr updater engine doesn't work under Ubuntu.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapterbib with subdirectories does not compile

Post by Stefan Kottwitz »

Hi tonguim,

I can see that you use \input for including the chapters.

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 chapter, for sure starting a new page, so \include would be fine.

And use \bibliographystyle and \bibliography command only in the included files, not in the main document, so you also don't need to process the main document with bibtex, just the chapter files.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Chapterbib with subdirectories does not compile

Post by Stefan Kottwitz »

See also: chapterbib | References following each Chapter. There's sample code.

Or enter chapterbib into the search field on the top right corner of this page, I remember we had similar threads already, hopefully one might help.

Stefan
LaTeX.org admin
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Chapterbib with subdirectories does not compile

Post by tonguim »

Hallo Stefan_K,

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 http://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.

As I said earlier, this is how I compiled my documents:

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

Questions:

1-When I run this command line

Code: Select all

bibtex ../chap1_introduction/chap1_introduction
I run it from the principal directory. Is that correct?

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: Select all

\end{document}
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.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Chapterbib with subdirectories does not compile

Post by Stefan Kottwitz »

1. should be correct and requires that chap1_introduction.aux is in that subfolder, verify it.

2. \include automatically creates such aux files for chapter. No separate latex compilation of chapters, that's correct.

Use \include, check if .aux files are newly produced then when compiling, run bibtex on the aux files, check if you got .bbl (and .blg) files, should be in the subfolder as well.

You could setup a test case which shows that problem, such as a minimal example with a minimal chapter in a sub folder, a reduced copy, and post it as attachment. We gladly test and help to fix. Could be quicker than more searching and describing, perhaps. If we would setup a test case, based on your description, possibly it won't match the actual case.

Stefan
LaTeX.org admin
tonguim
Posts: 24
Joined: Fri Nov 06, 2009 4:32 pm

Chapterbib with subdirectories does not compile

Post by tonguim »

Problem is fixed. I think errors came from the used document class package. Instead of

Code: Select all

\documentclass[phd]{theseUL}
I used this class package

Code: Select all

\documentclass[a4paper, 12pt]{report}
. Compilation run successfuly now.
Thank you Stefan_K for your support.
Post Reply