0

I am currently doing my PhD manuscript and struggle with the bibliography.

My main.tex looks like that :

\documentclass[12pt,a4paper,twoside]{book}
\usepackage[utf8]{inputenc}
\input{packages_manuscript.tex}
\title{manuscrit}
\author{Moi}
\date{Février 2023}

\addbibresource{biblio/biblio.bib}
\begin{document}
\selectlanguage{french}
\dominitoc
\tableofcontents
\glsaddall

\input{chaps/Chap1}
\printbibliography


\end{document}

and my biblio.bib looks like that

@article{Rellstab2021a,
title = {Genomics helps to predict maladaptation to climate change.},
    author={Rellstab, C.},
    journal={Nature Climate Change},
    volume={11(2)},
    pages={85-86},
    year={2021},
}

Chap1.tex

\pagestyle{fancy}

\chapter{Introduction}
\label{chap:intro}
\begin{refsection}
\abstract{blabla \parencite{Rellstab2021a}.}

\end{refsection}

The references are displayed correctly in chapitre 1 "blabla (Rellstab, 2021)". However, I don't have the corresponding bibliography at the end of my document with error "Empty bibliography at line ..". However, when I use \printbibliography in Chap1.tex, the bibliography is displayed correctly at the end of the chapter. The problem is that I want one general bibliography for all my .tex files. It seems like as there are no citations in the "main.tex", it gives an empty document when \printbibliography is in the main. I am using bibtex my packages_manuscript.tex looks like that:

\usepackage[backend=biber, style = authortitle, citestyle=authoryear, maxcitenames=2,  maxbibnames=9, natbib=true]{biblatex}

I am using overleaf to compile the document.

6
  • 1
    Please make sure your example is self contained. Here it depends on files and figures we do now have access to and thus we cannot test your code.
    – daleif
    Commented Feb 7, 2023 at 11:10
  • 2
    how do you expect us to be able to help if you hide all relevant information behind \input commands? Create a small but complete example that can be actually tested. Commented Feb 7, 2023 at 11:12
  • Sorry I've tried to make some modifications
    – Cijee
    Commented Feb 7, 2023 at 11:24
  • We don't have packages_manuscript.tex either. And it should be possible to use a single file (plus bib data). The contents of Chap1.tex can just as well be inserted instead of \input{chaps/Chap1}
    – daleif
    Commented Feb 7, 2023 at 11:37
  • I'd say it is related you your use of refsection and the fact that you have no citations outside refsection.
    – daleif
    Commented Feb 7, 2023 at 12:19

1 Answer 1

1

When I move the refsection environment from your chapter one file to the main file and include \printbibliography within the refsection environment, I get a bibliography printed on page 5 using the information you provided.

So this MWE should work for you as well:

\documentclass[12pt,a4paper,twoside]{book}
\usepackage[utf8]{inputenc}
\input{packages_manuscript.tex}
\title{manuscrit}
\author{Moi}
\date{Février 2023}

\addbibresource{biblio/biblio.bib}
\begin{document}
    \selectlanguage{french}
    \dominitoc
    \tableofcontents
    \glsaddall
    
%   \chapter{Introduction} \label{chap:intro} <= labelling should be directly after the chapter title
    \begin{refsection}
        \input{chaps/Chap1}

        \printbibliography
    \end{refsection}
    
    
\end{document}

Needless to say that you have to remove the \begin{refsection} / \end{refsection}from your chapter one tex file to prevent illegal nesting.

1
  • Question is why there is a refsection in the first place. If one wants one bibliography for the whole document, it is superfluous. If one wants (truly) separate bibliographies for each chapter, the global bibliography at the end makes little sense unless one is very careful.
    – moewe
    Commented Feb 8, 2023 at 16:32

You must log in to answer this question.

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