# Make the bibliography as a \section in each included chapter

My question is similar to that of: Bibliographies as a numbered sections in each chapter But the proposed solution doesn't work for me.

I'm trying to write my thesis manuscript, I use Overleaf, \documentclass{book}, \usepackage{biblatex} and \include{Chapter}. The bibliography file is mainb.bib but If necessary I can create a .bib file for each chapter.

Could someone please help me to put the bibliography of each chapter as a section at the end of each chapter, change the name "Bibliography" to "Références," and put the hyperlinks and page numbers in different colors as in the following example picture:

The second part shows section 3 "Référence" in Chapter 2.

This is my attempt:

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage[dvipsnames]{xcolor}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{decorule}
\usepackage[french]{minitoc}
\mtcselectlanguage{french}

\usepackage[language=french,style=authoryear,sorting=none,refsection=section]{biblatex}

\begin{document}

\setcounter{mtc}{5}
\part{titre de la partie 1}
\include{Chapters/Chapter1}
\setcounter{mtc}{6}
\part{Titre de la partie 2}
\include{Chapters/Chapter2}


The file chapter1.tex contains :

\section{Introduction}
Text \cite{cite1}.

\cleardoublepage
\section{Références}
\printbibliography


I tried also in chapter1.tex:

\begin{refsection}
\end{refsection}


it doesn't give me the expected result.

I would post this as a comment but I don't have enough reputation (yet!).

Have you seen this question? Automatically split sources list into bibliography and references It appears to do what you're after.

\documentclass[12pt,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage[dvipsnames]{xcolor}
\usepackage{booktabs}
\usepackage{decorule}
\usepackage[french]{minitoc}
\usepackage{hyperref}
\usepackage{filecontents}   % only for MWE
\usepackage[language=french, style=authoryear, sorting=none, backend=biber, bibencoding=utf8, natbib=true, citecolor=gray]{biblatex}
\mtcselectlanguage{french}

% https://tex.stackexchange.com/questions/495194/automatically-split-sources-list-into-bibliography-and-references

\hypersetup{
citecolor=gray,
}

% just used for the MWE.
\begin{filecontents}{biblatextest1.bib}
@book{cite1,
author = {Baker, M.},
year = {2010},
title = {The book},
}
\end{filecontents}
%
\begin{filecontents}{biblatextest2.bib}
@book{cite2,
author = {Smith, E.},
year = {2008},
title = {The other book},
}
\end{filecontents}

% Append keywords to identify different bibliography entries.
% Add a map for every chapter, so that the bibliographies are kept separate.
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{biblatextest1.bib}
\step[fieldset=KEYWORDS, fieldvalue=ch1, append]
}
\map{
\perdatasource{biblatextest2.bib}
\step[fieldset=KEYWORDS, fieldvalue=ch2, append]
}
}
}

% change bibliography from chapter to section

\begin{document}

\tableofcontents

%\setcounter{mtc}{5}
\part{titre de la partie 1}
% This goes in your Chapters/Chapter1.tex file
\chapter{Chapter 1}
\section{Introduction}
Text \cite{cite1}.

\cleardoublepage
\printbibliography[title=Références Ch1, keyword=ch1]

%\setcounter{mtc}{6}
\part{Titre de la partie 2}
% This goes in your Chapters/Chapter2.tex file
\chapter{Chapter 2}
\section{...}
Some more text \cite{cite2}

\cleardoublepage
\printbibliography[title=Références Ch2, keyword=ch2]

\end{document}


To briefly explain what's going on, you have a separate .bib file for each chapter of your thesis, and reference each text within each file as normal, ensuring that all of your citations in each chapter refer to one file only.

You then display each file at the end of each chapter, using the keyword mappings set up in the preamble.

• In the \printbibliography command, you can specify a title.
• I've used the hyperref package to give you hyperlinks, and made them blue.
• Since \printbibliography comes with its own title, I'm adding a reference to it in the table of contents with \addcontentsline so that you don't have a blank page in between both.

I'm not sure how to adapt this to use one .bib file only, sorry. Good luck with the rest of your thesis. :)

• Ah, I didn't notice that initially. Add this to your preamble to change the references to sections, not chapters: \defbibheading{bibliography}[\bibname]{\section{#1}} I've updated the MWE above. – pikopiko Oct 28 '20 at 2:14
• Hmm, the reason the 'Author' text is not coloured is because it's not linked as part of the citation - see here: tex.stackexchange.com/questions/15951/… The solution to the above TeX.SE question is somewhat messy - you could create a command that acts as a coloured citation, possibly - something like \newcommand{\graycite}[1]{\textcolor{gray}{\cite{#1}}} could work - you'd then cite with \graycite{} instead of \cite{}. Not the best solution, unfortunately! – pikopiko Oct 28 '20 at 2:17