0

I'm trying to print the bibliography from different bib files in different sections.

I know that that the command \nocite{*} allows to print all the references, but in my case I want them to be separated according to the file they stand. I don't know if it's quite clear, here is an ECM where I enter by hand all the references for each section, using refsection. The output is what I want, but I would prefer not to enter by hand the nocite for every reference (and I'm sure it is possible to do so 😉)

% main.tex
\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblio1.bib}
\addbibresource{biblio2.bib}

\begin{document}
\section*{Biblio 1}
\begin{refsection}
    \nocite{refA}
    \nocite{refB}
    \printbibliography[heading=subbibliography]
\end{refsection}

\section*{Biblio 2}
\begin{refsection}
    \nocite{refC}
    \nocite{refD}
    \printbibliography[heading=subbibliography]
\end{refsection}

\end{document}

with the bib files :

% biblio1.bib
@misc{refA,
    author = {Alfred},
    title = {Amazing book},
    year = {2000},
}

@misc{refB,
    author = {Bruce},
    title = {Best book},
    year = {2021},
}
% biblio2.bib
@misc{refC,
    author = {Craig},
    title = {Catastrophic book},
    year = {2000},
}

@misc{refD,
    author = {Denis},
    title = {Disastrous book},
    year = {2000},
}

Here is the output :

output

1
  • If you can use biblatex, it has a bibbycategory function.
    – Bernard
    Dec 2, 2021 at 10:50

1 Answer 1

2

You can indeed restrict the bibresource of a refsection by using the label argument of \addbibresource and then indicating the label when starting the refsection:

\documentclass{article}
\usepackage{biblatex}
\addbibresource[label=biblio1]{biblio1.bib}
\addbibresource[label=biblio2]{biblio2.bib}

\begin{document}
\section*{Biblio 1}
\begin{refsection}[biblio1]
  \nocite{*}
  \printbibliography[heading=subbibliography]
\end{refsection}

\section*{Biblio 2}
\begin{refsection}[biblio2]
  \nocite{*}
  \printbibliography[heading=subbibliography]
\end{refsection}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .