9

I'm using biblatex with a biber backend to create a cumulative bibliography, subdivided by chapter. My (simplified) main file (main.tex) is:

\documentclass{book}

\usepackage[refsection=chapter, backend=biber]{biblatex}
\defbibheading{bibbook}[\bibname]{\chapter{#1}}
\defbibheading{subbib}[\refname\space\chaptername\space%
  \ref*{refsection:\therefsection}]{%
  \setcounter{secnumdepth}{0}%
  \section{#1}}
\addbibresource{biblatex-examples.bib}

\usepackage{hyperref}

\includeonly{bar}

\begin{document}

\mainmatter
  \include{foo}
  \include{bar}

\backmatter
  \printbibheading[heading=bibbook]
  \bibbysection[heading=subbib]

\end{document}

foo.tex is:

\chapter{Foo}
\label{cha:foo}
\nocite{cms}

and bar.tex is:

\chapter{Bar}
\ref{cha:foo}
\nocite{glashow}

According to this answer the benefit of using \include is that

"There will be a filename.aux file which contains all counter values, like page and chapter numbers etc., at the begin of the filename. This way the file can be compiled alone but still has the correct page and chapter etc. numbers. Such part aux files are read by the main aux file".

I expect the refsection counter to behave the same way. However when using \includeonly{some chapter} I get the following warning:

LaTeX Warning: Label `refsection:01' multiply defined.
LaTeX Warning: There were multiply-defined labels.

If I remove the includeonly command then the warning disappears but is there a way to avoid that warning when using the includeonly command? Apparently the only way to eliminate the warning is by deleting the aux files of the chapters (not the main file) after each compilation. However in that way counter values are lost.

I know this is just a warning, not an error, and will not be an issue in the final (full) document. However I would like to understand why the warning appears and if possible to eliminate it.

EDIT: Before the bounty ends I want to make clear that I can tell my text editor (vim) not to show the warning. As I said before, what I really want to know why the warning appears when one of the advantages of using include is that it stores counter values.

  • 2
    Remember, too, that this is a warning, not an error, and indeed one that will certainly not be an issue in the final (full) document. – jon Oct 1 '13 at 4:36
  • @jon Thanks. I've changed the title of the question. – petobens Oct 1 '13 at 4:42
  • Just out of interest, do you notice any adverse effect apart from the warning (wrong links, [in any way] messed up bibliography, wrong numbering)? I think jon is right, when he points out that this behaviour is very likely not relevant for the final (important) stage of your document preparation. – moewe Oct 1 '13 at 19:41
  • @moewe everything works fine. However I thought that since I'm using include then the refsement counters should be stored in the aux files and no warning should appear. – petobens Oct 1 '13 at 23:40
  • 1
    @cfr you seem to be right. The warning indeed disappears however now not only the included chapter is printed but also every chapter title in the document. I now i can comment the unwanted chapter titles but I hope there is a more general solution. The other problem with your solution is that the chapter title is in a page by itself and the contents of the chapter start in another one. I thought that maybe some of the biblatex maintainers could explain in detail why this happens and how to avoid it. – petobens Dec 18 '13 at 19:53
4

From my testing, starting with a clean directory (no .aux files) it works fine with \includeonly. It's only a problem if you have a foo.aux hanging around from a previous run which created it (presumably without the \includeonly) and then you try to run with \includeonly - this seems to pick up and read the foo.aux which contains counters the same as in bar.aux. This makes sense as when you are effectively only including bar.aux by using \includeonly, this would get counter "01" but if you included both, foo.aux would have this. If you don't delete your .aux files between runs with different \includeonly settings, it's natural you will get conflicts because you have old .aux files around.

  • 1
    If I delete the aux files then (i) bar.tex chapter instead of being chapter 2 becomes chapter 1 (counter values are lost) and (ii) if from that bar.tex I have a reference to foo.tex (such as \ref{cha:foo}) then by deleting foo.aux the reference is lost (so basically I'm losing every advantage of using \include). – petobens Jul 10 '14 at 19:30
  • The reason for the warnings seems that the refsection are numerically labeled and not with respect to the content. Therefore the references are anonymously labeled 1,2,3... If a chapter gets missing using \includeonly the numbers are misleading. It may be better if the refsections are labeled according to content. – Bernhard Kleine Jan 17 '17 at 21:21
  • @BernhardKleine do you have a workaround for this? it is very annoying to me. – Nicholas Hamilton Mar 15 '17 at 6:04
  • To avoid this, I put the \newrefsection commands in the master, so the full set of refsections are created in the same numeric sequence regardless of what is actually put in the includeonly{...} macro, although frankly i feel that the newrefsection macro should have an optional agrument to allow the user to specify a name, rather relying on a counter increment. – Nicholas Hamilton Mar 16 '17 at 3:00
  • @Nicholas hamilton, I donot have a workaround. I see the warning with each latexmk run, but it is only a warning. – Bernhard Kleine Mar 16 '17 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.