[Tex/LaTex] Error with chapterbib

bibtexnatbib

I'm trying to make a chapter by chapter bibliography. I used chapterbib package, using rsc bibliography style. The problem is that it won't compile at the end.
Here's part of the preamble i use

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[greek,francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[left=2cm,right=2cm,top=3cm,bottom=3cm]{geometry}
\usepackage{chapterbib}
\usepackage{rsc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[numbers]{natbib}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=blue,citecolor=blue}

\begin{document}

\include{partie_1}
\include{annexe_1}

\end{document}

At the end of each part is included :

\blibliographystyle{angew}
\bibliography{biblio.bib}

I only have this error message :

This is BibTeX, Version 0.99d (TeX Live 2012) The top-level auxiliary file:
maitre.aux A level-1 auxiliary file: partie_1.aux The style file: angew.bst
A level-1 auxiliary file: annexe_1.aux Illegal, another \bibstyle
command---line 5 of file annexe_1.aux : \bibstyle : {angew} I'm skipping
whatever remains of this command Illegal, another \bibdata command---line 6 
of file annexe_1.aux : \bibdata : {rsc-maitre,biblio} I'm skipping whatever
remains of this command Database file #1: rsc-maitre.bib Database file #2:
biblio.bib (There were 2 error messages)

Without using chapterbib, it works perfectly well.

Edit : After a look on other posts, i just want to precise that i lunched bibteX on each file before launching the source one following the pdflatex -> bibtex -> pdflatex (x2) -> view pdf

Best Answer

You can create a Makefile or a script to do this. The script can be called from the TexMaker or other editor.

At Linux, I use a Makefile for the purpose. I just need to run make and everything is compiled! :)

A Makefile or script is useful since you don't need to "stick" with an editor configuration. You can run it also from a terminal, allowing you to use whatever editor you like.

Here is a Makefile example:

# Main project filename (without .tex extention)
FILE=main

all:
    $(MAKE) latex
    $(MAKE) bibperchapter
    $(MAKE) latex
    $(MAKE) latex
    dvipdf \
        -dPDFSETTINGS=/prepress \
        -dGrayImageResolution=600 \
        -dColorImageResolution=600 \
        -dMonoImageResolution=600 \
        -dSubsetFonts=true \
        -dEmbedAllFonts=true \
        -dMaxSubsetPct=100 \
        -dCompatibilityLevel=1.5 \
        -sPAPERSIZE=a4 $(FILE).dvi

bibperchapter:
    for auxfile in text/ch*.aux ; do \
        bibtex $(basename $$auxfile .aux) ; \
    done

latex:
    latex -interaction batchmode $(FILE)

This Makefile runs latex(pdftex), bibtex for each chapter and converts the dvi file to pdf (I use dvips driver). Pay attention to the bibperchapter target. You need to edit it according to the location of your chapters. In this case, the chapters are in text/ folder and all filnames start with ch-.

You can modify it according to your needs. It can easily adapted to the platform you use (windows, linux, macos).