2

Actually I am new in LaTeX. I want to get print the bibliography in every chapter. I have tried but failed. My files structure are given below:

In the folder texfiles there are one sub folder named chapters and two files one main .tex file named main.tex and another .bib file named bibliography.bib file.

The subfolder chapters contains two .tex files they are chapter01.tex and chapter02.tex.

The directory texfiles contains :

1.

main.tex:

 \documentclass[a4paper,12pt]{book}
 \usepackage[utf8]{inputenc}
 \usepackage{graphicx}
%\usepackage[sectionbib]{chapterbib}
 \usepackage{biblatex}
 \usepackage[numbers]{natbib}
 \bibliography{bibliography}
 \bibliographystyle{ieeetr}
  \begin{document}
  \author{Author's Name}
  \title{Simple Book Example}
  \date{January 2017}

  \frontmatter
   \maketitle
  \tableofcontents

  \mainmatter
   \include{./chapters/chapter01}
   \include{./chapters/chapter02}

   \backmatter

   \end{document}

2.

bibliography.bib:

 @book{id1,
    author = {author},
    title = {title},
    date = {date},
    publisher={aaaaaaa},
    year={2017}
}

@book{id2,
    author = {author},
    title = {title},
    date = {date},
    publisher={sdddddddds},
    year={2017}
}

and the subdirectory chapters contains as follows:

1.

chapter01.tex:

\chapter{Title of chapter 1}
some text of chapter 1

\section{Title of section}
some text of section of chapter 1

\cite{id1,id2}
\printbibliography

2.

chapter02.tex:

\chapter{Title of chapter 2}
some text of chapter 2

\section{Title of section}
some text of section of chapter 2

\cite{id1,id2}
\printbibliography

I am using 'Texstudio' compiler in Linuxmint OS. Please help me to do this. Thanks in advance.

  • 2
    Welcome to TeX.SX! The natbib package is incompatible with biblatex (chapterbib is similarly incompatible with biblatex), you will have to use one or the other. – Dai Bowen Jan 20 '17 at 7:39
  • @DB I have removed natbib and recompiled but again shows error : 'Package biblatex Error: '\bibliographystyle' invalid. \bibliographystyle{ieeetr}'. I don't know how to fix this – Primo Jan 20 '17 at 7:43
  • 2
    Just remove the \bibliographystyle line, biblatex does not use the \bibliographystyle command to set the style (take a look at the biblatex manual on CTAN or run texdoc biblatex to get your local copy for information on styles with biblatex) – Dai Bowen Jan 20 '17 at 7:47
  • 1
    Are you running biber (the default backend for biblatex)? Take a look at Question mark or bold citation key instead of citation number and Biblatex with Biber: Configuring my editor to avoid undefined citations for reference. – Dai Bowen Jan 20 '17 at 7:59
  • 2
    Do you really want the bibliography repeated in every chapter? Or do you want a bibliography in each chapter? – cfr Jan 21 '17 at 2:16
1

With the option refsegment=chapter for biblatex you can get what you want.

Then you can write

\printbibliography[segment=\therefsegment,title=first bib]

and option segment=\therefsegment gives you a bibliography for only cited bib entries in the current segment.

Please see the following MWE

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{id1,
    author = {author},
    title = {title},
    date = {date},
    publisher={aaaaaaa},
    year={2017}
}

@book{id2,
    author = {author},
    title = {title},
    date = {date},
    publisher={sdddddddds},
    year={2017}
}
\end{filecontents}


\documentclass[a4paper,12pt]{book}

\usepackage[utf8]{inputenc}

\usepackage[%
  refsegment=chapter, % <===============================================
  natbib
]{biblatex}
\addbibresource{\jobname.bib}


\begin{document}

\author{Author's Name}
\title{Simple Book Example}
\date{January 2017}

\frontmatter
\maketitle
\tableofcontents

\mainmatter


\chapter{Title of chapter 1}
some text of chapter 1

\section{Title of section}
some text of section of chapter 1

\cite{id1,id2}
\printbibliography[segment=\therefsegment,title=first bib] % <==========


\chapter{Title of chapter 2}
some text of chapter 2

\cite{id1}
\printbibliography[segment=\therefsegment,title=second bib] % <=========

\backmatter

\end{document}

and the two resulting bibliographies:

first bobliography

and

second bibliography

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.