3

I have a main .tex file where I input some chapters which are other .tex files. Then I have a bibliography that I input in the main. If I have some \section in my input file, some citation become "[0]".

This is the main.tex

\documentclass[12pt, twoside, openright]{book}
\linespread{1.3} 
\usepackage[textheight=\textheight,textwidth=\textwidth,bindingoffset=3cm,vcentering]{geometry}
\usepackage{enumitem}
\usepackage[greek,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{sectsty,lmodern}
\usepackage{float} 

\usepackage[backend=biber,style=numeric, defernumbers=true, refsection=section]{biblatex}

\addbibresource{bib/references.bib}

\graphicspath{ {img/} }
\chapternumberfont{\fontsize{20pt}{18pt}\selectfont}
\chaptertitlefont{\fontsize{20pt}{18pt}\selectfont}
\addtolength{\skip\footins}{2pc plus 2pt}
\usepackage{fancyhdr}
\usepackage{csquotes}
\usepackage[begintext=“, endtext=”]{quoting}
\SetBlockEnvironment{quoting}
\SetBlockThreshold{1} 
\pagestyle{fancyplain}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[LE,RO]{\thepage}
\usepackage[citecolor=black]{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=blue,
    bookmarks=true
}
\urlstyle{same}
\begin{document}

\chapter{chapter one}
\input{chapters/chapter01}

\newpage
\printbibliography[keyword={biblio}, heading=bibintoc, title={Bibliography}]
\newpage
\printbibliography[keyword={site}, heading=bibintoc, title={Sitography}]
\end{document}

This is references.bib:

@online{addm,
url = {https://www.cdc.gov/ncbddd/autism/addm-community-report/key-findings.html},
keywords     = {site}
}

@article{kenny2016terms,
  title={Which terms should be used to describe autism? Perspectives from the UK autism community},
  author={Kenny, Lorcan and Hattersley, Caroline and Molins, Bonnie and Buckley, Carole and Povey, Carol and Pellicano, Elizabeth},
  journal={Autism},
  volume={20},
  number={4},
  pages={442--462},
  year={2016},
  publisher={SAGE Publications Sage UK: London, England},
  keywords = {biblio}  
}

and this is chapter01.tex

\section{Terminology and Data}
STUFF STUFF STUFF\cite{addm} 

\section{Therapies}
stuff\cite{kenny2016terms} stuff\cite{addm}

The strange thing is that the citations after the second \section are working, while the one after the first \section not.

1 Answer 1

2

This has nothing to do with \input and can be reproduced in a much smaller setting, where it is easier to diagnose the problem.

\documentclass[12pt, twoside, openright]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[backend=biber, style=numeric, defernumbers=true, refsection=section]{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}
\chapter{chapter one}
\section{Section One}
Lorem\cite{sigfridsson,worman}

\section{Section Two}
ipsum\cite{sigfridsson} dolor\cite{ctan}

\newpage
\printbibliography[nottype=online, heading=bibintoc, title={Bibliography}]
\newpage
\printbibliography[type=online, heading=bibintoc, title={Sitography}]
\end{document}

Note how all citations in the first section are displayed as "[0]" and how only the references in the second section get numbers. The bibliographies only show the entries of the second section. worman (which was only cited in the first section) is nowhere to be seen.

The culprit is refsection=section and the problem is exacerbated (which was an extreme stroke of luck here, since otherwise it might have gone unnoticed) by defernumbers=true.

With refsection=section you tell biblatex to start a new refsection at each \section command in your document. In particular Section One and Section Two are in two different refsections. Refsections are a way to organise completely independent bibliographies and citations. They are kept separate from each other and each refsection has its own sorting and numbering. The \printbibliographys you issue belong to the second refsection opened for Section Two and will thus only pick up the citations from there. That explains why we never get to see worman in any of the bibliographies – it was only cited in the first section.

Things go a bit further, as far as biblatex is concerned, the entry sigfridsson in the first section is completely independent of sigfridsson in the second section, they just share the same entry data. In particular they need not have the same label number (cite label) or sort the same. Since you use defernumbers entries will be assigned their label number not based on the overall sorting. Instead they get their label number when they first appear in a bibliography. That's why sigfridsson in the second section is "[1]" and ctan is "[2]" even though alphabetically ctan would be sorted before sigfridsson. (Change to defernumbers=false to see this.) The entries from the first section never appear in any bibliography and thus are never assigned any number. Hence, they always show "[0]".

There are several ways to resolve this.

  • Add a \printbibliography for each \section to obtain independent per-\section bibliographies.
  • Switch to refsection=chapter to produce independent bibliographies and citations per \chapter and not per \section.
  • Drop the refsection option altogether to produce a global bibliography and global citations across all chapters.
1
  • refsection=chapter solved the problem!
    – Jojo
    May 25, 2019 at 13:30

You must log in to answer this question.

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