2

I'm writing a standard complex document (ie, thesis), in which chapters are separated into different files which are included. I am using biblatex, and I would like to have a separate bibliography per chapter, so I am using the refsection option to automatically separate bibliographical scopes per section (as explained here and on the biblatex documentation, in section 3.11.3: "Multiple bibliographies").

However, my existing document did not like this at all, and crashed with an error stating

! You can't use `\relax' after \advance.
<recently read> \blx@sectionciteorder@1 

I use Kile as my IDE, and according to Kile, the file where the error occurred was the .lot file. After some strategic commenting, I managed to pinpoint the problem:

When a float (figure or table) inside a refsection has a caption with a citation, printing a list of tables or list of figures (as appropriate) causes the error.

Removing the refsection fixes the problem. Removing the citation from the caption (either using the optional argument in \caption or by removing the caption altogether) fixes the problem. Removing the LoT or LoF fixes the problem. But how can I fix the problem without removing any of these?

MWE follows:

\documentclass{book}

\usepackage[
  backend=biber,
  refsection=chapter,
]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{A,
  title = {A title},
  pages = {55--61},
  journal = {{JoRS}},
  author = {Author, A.N.},
  date = {1990}
}
@article{B,
  title = {Another title},
  pages = {550--610},
  journal = {{JoBS}},
  author = {Other, A.N.},
  date = {1995}
}
\end{filecontents}

\begin{document}

\tableofcontents
\listoftables

\chapter{One}

This is a test \textcite{A}.

\begin{table}
  \centering
  \caption{A table. From \textcite{A}}
  \begin{tabular}{ccc}
    A & B & C \\
    1 & 2 & 3 \\
  \end{tabular}
\end{table}

\printbibliography

\chapter{Two}

This is a test \textcite{B}.

\printbibliography

\end{document}

As common as this seems to me, I was not able to find anything online that referred to this specific circumstance. There is one more question on this site with a promising title, but the core problem is one of sorting, not a crash. (And it's marked as a duplicate of something unrelated to my question).

There is also an issue on the biblatex repository on GitHub, but it doesn't seem to deal with citations in captions and LoF/LoTs at all. In any case, I tried both the development and the experimental versions mentioned in that discussion, and the problem still exists on both.

jja
  • 1,813
  • 1
    Use optional argument → \caption[]{... –  Apr 12 '15 at 23:45
  • Yeah, that does work. But when I reproduce tables/figures from other publications, I would like to have the citation in the LoT/LoF (to distinguish them from my own). Is there no other way? – jja Apr 12 '15 at 23:50
  • @HarishKumar, I didn't mention you on my reply to your comment, so here goes. I – jja Apr 14 '15 at 17:28
  • 1
    I have the same problem (citations in figure captions), but only on my Linux machine where biblatex v2.92 (2014) is installed. Instead, on my MAC where an old biblatex v1.7 (2011) is installed, I have no problems in compiling the same .tex code (and I get the citation in the List of Figures as well). Very strange... something broke in between the two versions... – rmbianchi Sep 17 '15 at 16:14
  • A related issue has been brought up at the biblatex bug tracker: issue #361 – moewe Dec 05 '15 at 17:43
  • Allow me the following comment though: If you use local labels in your chapters you probably don't want to appear those labels in a (more) global list of tables. If you cite B in the second chapter in a table caption as well you will get "[1]" for both of those in the the lot. (If your real document set-up is different and does not suffer from this problem, please ignore this comment.) – moewe Dec 05 '15 at 17:47
  • 1
    Issue #361 in the biblatex bugtracker has been fixed. As far as I could tell the fix also resolves your issue here, would you be able to confirm that (note that the biblatex version on CTAN doesn't incorporate the fix yet, you will have to pull from github or download the dev version from sourceforge)? – moewe Dec 09 '15 at 10:29
  • @moewe Do you want to write something answer-like? – Johannes_B Dec 21 '15 at 12:30
  • 1
    @Johannes_B Mhhh, I thought about just waiting till the update comes out and then close as "do an update". I also hoped the OP would get back and test with the dev version to verify that the issue was indeed solved. (I don't get the problem in the MWE with the fix any more, but maybe there is something more involved going on in the actual document.) – moewe Dec 21 '15 at 12:33
  • 2
    @moewe I just noticed that your comments are from last week. I just skimmed and thought they were from april as well. Let's wait then. – Johannes_B Dec 21 '15 at 12:37
  • 1
    Thank you both for your attention. Truth be told, this problem was always a bit erratic, and it sort of came and went as I worked. Eventually I abandoned the chapter-specific ToC for a unified one (for unrelated reasons), and lost track of this problem. Now I cannot reproduce it either. I'm all for deleting this question, or for closing it. – jja Dec 22 '15 at 08:02
  • Version 3.2 of biblatex has been on CTAN for over a week and should be available in MikTeX and TeX live. When I tried the MWE above with the new version the error was gone. – moewe Jan 04 '16 at 12:41
  • Could you confirm that the error is fixed? (Maybe if you can find the time, you could even try that in your actual document, if you like to go back to per-chapter bibliographies) – moewe Jan 14 '16 at 09:40
  • 5
    I'm voting to close this question as off-topic because it is about a bug in biblatex that has been resolved in a recent update. An update resolves the issue. – moewe Jan 20 '16 at 08:52

0 Answers0