# How to generate bibliography for each chapter from a single .bib file?

Let say I have a file which is name as "references.bib", and i have three chapters, I want to generate separate bibliography for each chapter with citation numbering starting from 1. Let say in chapter 1 i have use total of 3 citations so in that chapter it should be able to show only those citations in the bibliography and make sure that citation numbering should be start from 1 in each chapter. How do i do this? Can someone please help me. Below is my MWE which i am not able to do.

 \documentclass[a4paper,11pt]{book}
\usepackage[backref=true,refsegment=section,backend=bibtex]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{references.bib}
@book{knuth1986texbook,
keywords = {book},
title={The texbook},
author={Knuth, D.E. and Bibby, D.},
volume={1993},
year={1986},
}
@article{knuth1977fast,
keywords = {article},
title={Fast pattern matching in strings},
author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.},
journal={SIAM journal on computing},
volume={6},
number={2},
pages={323--350},
year={1977},
publisher={SIAM}
}

@article{Ancey1996,
author = {Ancey, Christophe and Coussot, Philippe and Evesque, Pierre},
journal = {Mechanics of Cohesive-frictional Materials},
number = {4},
pages = {385--403},
title = {Examination of the possibility of a fluid-mechanics treatment of dense granular flows},
url = {http://doi.wiley.com/10.1002/(SICI)1099-1484(199610)1:4<385::AID-CFM20>3.0.CO;2-0},
volume = {1},
year = {1996}
}

@BOOK{RR73,
title={Invariant {Subspaces}},
publisher={Springer-Verlag},
year={1973},
}

@BOOK{Aup91,
author={B. Aupetit},
title={A {Primer} on {Spectral} {Theory}},
publisher={Springer-Verlag},
year={1991},
}
\end{filecontents}

\begin{document}
\chapter{Chap 1}
Test 1 \autocite{knuth1986texbook} and test \autocite{Aup91} and last is \autocite{RR73}.

\chapter{Chap 2}
Test 3 \autocite{Ancey1996} and test 4 \autocite{knuth1986texbook} and again test 1  .

\end{document}


Sounds like you are looking for refsection rather than refsegment

\documentclass[a4paper,11pt]{book}
\usepackage[backref=true,refsection=chapter,sorting=none]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{references.bib}
@book{knuth1986texbook,
keywords = {book},
title={The texbook},
author={Knuth, D.E. and Bibby, D.},
volume={1993},
year={1986},
}
@article{knuth1977fast,
keywords = {article},
title={Fast pattern matching in strings},
author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.},
journal={SIAM journal on computing},
volume={6},
number={2},
pages={323--350},
year={1977},
publisher={SIAM}
}

@article{Ancey1996,
author = {Ancey, Christophe and Coussot, Philippe and Evesque, Pierre},
journal = {Mechanics of Cohesive-frictional Materials},
number = {4},
pages = {385--403},
title = {Examination of the possibility of a fluid-mechanics treatment of dense granular flows},
url = {http://doi.wiley.com/10.1002/(SICI)1099-1484(199610)1:4<385::AID-CFM20>3.0.CO;2-0},
volume = {1},
year = {1996}
}

@BOOK{RR73,
title={Invariant {Subspaces}},
publisher={Springer-Verlag},
year={1973},
}

@BOOK{Aup91,
author={B. Aupetit},
title={A {Primer} on {Spectral} {Theory}},
publisher={Springer-Verlag},
year={1991},
}
\end{filecontents}

\begin{document}

\chapter{Chap 1}
Test 1 \autocite{knuth1986texbook} and test \autocite{Aup91} and last is \autocite{RR73}.