# A bib file for each refsegment

Is it possible to use a bib file for each refsegment? I would use a bib file for each refsegment and reset the count of references to each new refsegment.

My code

\documentclass{book}

\usepackage[brazil]{babel}

\usepackage[latin1]{inputenc}

\usepackage[backend=bibtex]{biblatex}

\addbibresource{refs.bib}

\addbibresource{ref.bib}

\begin{document}

\section{Section Title A}

\begin{refsegment}

\cite{articleA}\cite{articleC}\cite{articleB}

\printbibliography[segment=1,heading=subbibliography]

\end{refsegment}

\section{Section Title B}

\begin{refsegment}

\cite{articleE}\cite{articleF}\cite{articleD}

\printbibliography[segment=2,heading=subbibliography]

\end{refsegment}

\end{document}


refs.bib

@article{articleA,
author = {Bruce Wayne},
title  = {On why batman is stronger than superman},
journal = {Wayne Enterprises journal},
year   = {2016},
keywords = {blablabla},
}
@article{articleB,
author = {Clark Kent},
title  = {On why superman is stronger than batman},
journal = {The daily planet},
year   = {2016},
}
@article{articleC,
author = {Clark Kent},
title  = {On why superman is stronger than batman},
journal = {The daily planet},
year   = {2016},
}


ref.bib

@article{articleD,
author = {Bruce Wayne},
title  = {On why batman is stronger than superman},
journal = {Wayne Enterprises journal},
year   = {2016},
keywords = {blablabla},
}
@article{articleE,
author = {Clark Kent},
title  = {On why superman is stronger than batman},
journal = {The daily planet},
year   = {2016},
}
@article{articleF,
author = {Clark Kent},
title  = {On why superman is stronger than batman},
journal = {The daily planet},
year   = {2016},
}


O resultado é o seguinte

I would like to see reference [1 ], [2], [3] in the first section and also [ 1 ], [2], [3] in the second section.

• Welcome to TeX - LaTeX! It sounds like you should be working with refsections instead of refsegments. – Andrew Swann Feb 26 '17 at 20:23
• Just replacing the refsegment command with refsection does not work, this way the references in the output do not appear. Need something more? – Marcelo Rodrigues Feb 26 '17 at 20:30

## 1 Answer

I think you are looking for refsections instead of refsegments. This requires compilation with biber, rather than bibtex:

\documentclass{book}

\usepackage[brazil]{babel}

\usepackage[latin1]{inputenc}

\usepackage[backend=biber]{biblatex}

\addbibresource{refs.bib}

\addbibresource{ref.bib}

\begin{document}

\section{Section Title A}

\begin{refsection}

\cite{articleA}\cite{articleC}\cite{articleB}

\printbibliography[section=1,heading=subbibliography]

\end{refsection}

\section{Section Title B}

\begin{refsection}

\cite{articleE}\cite{articleF}\cite{articleD}

\printbibliography[section=2,heading=subbibliography]

\end{refsection}

\end{document}


As @moewe points out the syntax

\begin{refsection}

\printbibliography[heading=subbibliography}

\end{refsection}


will also work, since within a refsection, the default is to print the bibliography for the current refsection.

• I managed to do. The problem was in the TeXstudio editor settings, I decided to change the Default Bibliography Tool to biber. Thanks a lot for the help. – Marcelo Rodrigues Feb 27 '17 at 16:20
• Since \printbibliography automatically defaults to printing the bibliography for the current section. you can drop the section=1 and section=2 when you use \printbibliography inside refsection. – moewe Feb 27 '17 at 16:38
• Is there a style of bibliography that separates the names of 2 or more authors by a comma ","? The style that most resembles what I need is style = nature, but it separates the name of the authors with &, I need to be by comma, according to Brazilian standards. – Marcelo Rodrigues Feb 27 '17 at 18:02
• I found the solution using style = abnt, thank you very much for the help. – Marcelo Rodrigues Feb 27 '17 at 20:07
• I understood the suggestion of @moewe , thank you too – Marcelo Rodrigues Feb 28 '17 at 13:14