14

Consider the following Minimal Working Example (MWE):

\documentclass{article}
\usepackage{xparse,titling}
\NewDocumentCommand\makethis {  } {%
  {\LARGE\theauthor\bigskip\par}
}
\author{Bob}
\usepackage[backend=biber]{biblatex}
\bibliography{biblatex-examples}
\begin{document}
\makethis
\end{document}

I would expect this - naïvely, as it turns out - to typeset the single word Bob in \LARGE letters. In fact, it renders thus:

zeroed Bob

[Note that without xparse, I would be giving you an NMWE (Non-Working Minimal Example) rather than an MWE, since replacing \NewDocumentCommand with \newcommand yields a compilation error as opposed to zero success.]

Or consider this MWE using Memoir:

\documentclass{memoir}
\author{Bob}
\usepackage[backend=biber]{biblatex}
\bibliography{biblatex-examples}
\begin{document}
\theauthor
\end{document}

Again, Bob is zeroed by Biblatex:

zeroed Bob

Removing the lines loading Biblatex resolves the issue, as does specifying \author{Bob} after loading Biblatex rather than before.

When Bob is defined after loading Biblatex, \theauthor resolves, as I'd expected, to Bob:

> \theauthor=macro:
->Bob.
l.100 \show\theauthor

When, however, Bob is defined before loading Biblatex, \theauthor resolves rather differently:

> \theauthor=macro:
->\@arabic \c@author .
l.100 \show\theauthor

Now I can easily protect Bob from being zeroed in other ways. Of greater concern is the fact that Biblatex appears to be competing with titling, Memoir and similar packages/classes for the use of \theauthor with, I assume, Biblatex using a counter named author, while its competitors define \theauthor to preserve the value passed to \author.

How should this incompatibility best be resolved? I'm guessing it has something to do with this code in biblatex_.sty:

\def\do#1{%
  \newcounter{#1}%
  \newcounter{saved#1}%
  \appto\abx@dobooleans{\do{more#1}}}

\abx@donames
\abx@dornames
\abx@dolists

which possibly ?? has something to do with defining booleans for conditional processing with things like \ifauthor. But, if so, this seems to rely rather dangerously on macro names which lack any sort of package prefix and are really quite likely to get inadvertently overwritten or to inadvertently overwrite other things.

Equally, Memoir and titling using \theauthor, \thetitle and \thedate has always struck me as unfortunate given the use of \the... for typesetting counters. But several classes and packages have used this convention for some time when it is desirable to preserve the values given to \author, \title and \date beyond the use of \maketitle.

A superficial grep of the first level of sub-directories in tex/latex/ suggests that this issue may also affect several thesis classes, uspatent, seminar, droit-fr, ltugboat, ametsoc and abntex2 etc. However, since I'm not familiar with most of these, I cannot say immediately whether the issue is likely to produce any symptoms in their cases and have not pursued the investigation further.

  • 3
    I don't think that the biblatex behavoiur is new. I have already observed this for some time for other packages classes. – Guido Apr 9 '16 at 0:35
  • 1
    For what I can see, the problem was there at least since August last year. For me the problem was a compilation error (the command \c@author) already defined (it is used by the class I was using) and I did not see any visible effects (at the end I undefined it and load biblatex after). I agree with your concerns. For what I can see the counter is used in \abx@donames – Guido Apr 9 '16 at 0:52
  • 1
    It is a class for IOS Press proceedings/books (IOS-Book-Article.cls), and it is use as a counter. – Guido Apr 9 '16 at 1:39
  • 1
    This is very unfortunate, while most uses of \c@author and friends are internal, there are some calls to \value{author} etc. in the .def files and I assume custom styles also use this. So it isn't a matter of simply renaming the name counter to something that avoids clashes. I assume it is quite safe to override biblatex's name counters in the preamble as they are only used in biblatex's macros, where they are re-filled with the correct values before use. – moewe Apr 9 '16 at 5:37
  • 1
    @Guido There are some more \value{editor} and \value{translator}s out there (biblatex-chicago, biblatex-historian, biblatex-dw, biblatex-jura, biblatex-musos, biblatex-trad, historische-zeitschrift) – moewe Apr 9 '16 at 9:37
4

I put in a save/restore for all such "bare" counters derived from the datamodel. This doesn't seem to impact anything as far as I can tell - all test docs generate identical output. The problem was larger than \theauthor as the default datamodel also generates \thetitle etc. DEV version 3.4 has this fix.

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.