Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a project that requires that separate bibliographies be maintained for each chapter and that the references appear at the end of each chapter. I am using natbib and I know that I should be using

\usepackage{natbib}
\usepackage{chapterbib}

But I am having problems with the directory structure (I think). Here is my structure

Main directory
    book.tex
    abbr.bib (this incluses @string abbreviation definitions for journal names)
    ch1-directory
       ch1.tex
       ch1.bib
    ch2-directory
       ...

A minimal example of my book.tex file contents is as follows:

\documentclass{book}
\usepackage[square,sort]{natbib}
\usepackage{chapterbib}
\begin{document}
    \include{ch1-directory/ch1}
\end{document}

My ch1.tex file has the following at the very end:

\bibliographystyle{plainnat}
\bibliography{../abbr,ch01}

Bibtex'ing the book.tex file gives two errors:

I couldn't open database file ../publications.bib
---line 15 of file ch-1/ch01.aux
 : \bibdata{../abbr
 :                 ,ch01}
I'm skipping whatever remains of this command
I found no database files---while reading file book.aux
Warning--I didn't find a database entry for "Luhn:1958fk"
Warning--I didn't find a database entry for "Bertossi:2011uq"
Warning--I didn't find a database entry for "Deutch:2012kx"
Warning--I didn't find a database entry for "Carenini:2011vn"
Warning--I didn't find a database entry for "Armbrust:2010ys"

I wonder what I am doing wrong. I did find other discussions here about putting references at the end of chapters, but they do not have the nested directory structure that I have, and it seems that is the main problem.

share|improve this question

migrated from stackoverflow.com Dec 23 '12 at 2:40

This question came from our site for professional and enthusiast programmers.

    
Where does the file publications.bib comes from? Do you call it somewhere? Does it exist? Can you show the content of your file abbr.bib and ch1.bib (only a small part of it is okay)? BTW: I would use only one central bib file. That makes life much more easier ... –  Kurt Dec 23 '12 at 2:52
    
The publications.bib is what I called abbr.bib in the posting. When I was posting, I wanted to keep the file names short so I used abbr and edited the error message with that name, but missed the first line. So, what it is complaining about in not being able to open is in fact abbr.bib file. The content of this file is a sequence of @string commands that define abbreviations for journal and conference names; ch1.bib is a regular .bib file. –  ozsu Dec 23 '12 at 4:21

2 Answers 2

Have you considered biblatex instead of natbib and chapterbib? Biblatex takes care of formatting, sorting and dividing up the bibliography by chapters. I used it for a book of mine, in which I also used per-chapter bibliographies. The corresponding clause from my preamble is

\usepackage[firstinits=true,
            bibencoding=inputenc,
            hyperref=auto,
            pagination=none,
            %style=standard,
            refsection=chapter]
{biblatex}

If I remember correctly, there is a

style=natbib

option that emulates the formatting style of the natbib package.

share|improve this answer
    
Not an option for this case, I am afraid. The publisher wants to use regular bibtex. –  ozsu Dec 23 '12 at 4:23

From the chapterbib manual

Each included file should have its own \bibliographystyle and \bibliography commands, and you should run bibtex on each included file separately rather than on the main or root file.

share|improve this answer
    
They do, actually and I am doing exactly what the chapterbib manual says. The problem is the folder structure -- it doesn't like the ch1.tex file to be in a subdirectory. If I move it to the main directory and run it, then it works. I would really like to keep the directory structure, though. –  ozsu Dec 23 '12 at 4:23
    
do you run bibtex on each individual included file? Reading your post, it seems you don't ("bibtexing book.tex) –  Guido Dec 23 '12 at 4:33
    
If you call bibtex from the main directory, then you have to use \bibliography{abbr,ch1-directory/ch01}, if you call from the chapter directory, then what you have should work. –  Guido Dec 23 '12 at 4:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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