0

Consider the following document:

\documentclass{minimal}
\usepackage{biblatex}

\newsavebox{\foobox}
\newcommand{\doofoo}[1]{
  \ifdefined\donewithfoo
  \else
    \begin{lrbox}{\foobox}
      \begin{refcontext}
        \begin{refsection}[#1]
          foo
        \end{refsection}
      \end{refcontext}
    \end{lrbox}
  \fi
  \usebox\foobox
  \global\def\donewithfoo{}
}

\begin{filecontents}{bar.bib}
\end{filecontents}

\begin{document}
\doofoo{bar}
\doofoo{bar}
\end{document}

let's call it mydoc.tex.

This is a sort-of-minimal example of a more complex document involving an "artificially"-embedded partial bibliography (an idea presented here and used in a document class I'm maintaining here, but hopefully that is immaterial to the question I think).

I compile this document with: xelatex mydoc. This used to compile fine, but with recent TeXLive versions (2023 for sure, maybe 2022? 2021? I don't know), I get:

LaTeX Warning: Label `refsection:1' multiply defined.

the aux file has:

\relax 
\abx@aux@refcontext{nty/global//global/global}
\abx@aux@refcontext{nty/global//global/global}
\abx@aux@refsection{1}{1}
\newlabel{refsection:1}{{}{1}{}{}{}}
\newlabel{refsection:1}{{}{1}{}{}{}}
\abx@aux@read@bbl@mdfivesum{nobblfile}
\gdef \@abspage@last{1}

Anyway, my questions:

  • What changed in XeLaTeX, or perhaps biblatex, that now triggers the creation of two identical labels (when before, they were either not created, or only one was created, or they got distinct labels)?
  • What can I do to keep basically the same document, but ensure the labels are distinct?
4
  • 3
    If you put a \label into a box and reuse it you get multiplied label, try with \savebox\foobox{abc\label{blub}}\usebox\foobox \usebox\foobox. The only way to avoid that is to use \leaders, see tex.stackexchange.com/a/86546/2388 Commented Mar 5 at 23:08
  • 1
    this has not changed, latex has always done that (it can not really not do it, it's a basic tex feature) Commented Mar 5 at 23:28
  • 1
    I ran your example on overleaf you get that warning in all versions back to 2014, in versions older than 2019 you additionally get an error aout \refcontext not matching its definition Commented Mar 5 at 23:44
  • @UlrikeFischer: And - can't I avoid the refsection to not issue a label?
    – einpoklum
    Commented Mar 6 at 19:24

0

You must log in to answer this question.

Browse other questions tagged .