2

I was trying to run biber (version 2.10; using Texmaker) when this error occurred:

INFO - This is Biber 2.10 INFO - Logfile is 'provabib.blg' ERROR - provabib.bcf is malformed, last biblatex run probably failed. Deleted provabib.bbl INFO - ERRORS: 1

After a few attempts, I found out that the problem was the package constants, which I was using to automatically number the constants I define; removing it, everything works fine. I am definitely not an expert and I have no idea how to fix this, but I guess it's because the package constants is a bit outdated. Do you now any way to avoid this issue? Similar packages doing the same job are welcome too.

Here's a minimal working example:

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel} 
\usepackage[autostyle]{csquotes}
\usepackage[style=alphabetic,backend=biber]{biblatex}
%%\usepackage{constants}        %%<--- this one produces the error
   %% \newconstantfamily{K}{symbol=K}       %% An example
\begin{filecontents*}{\jobname.bib}
   @book{rudin,
   author  = "Rudin, Walter",
   title   = "Real and Complex Analysis",
   year    = "1966",
   publisher = "McGraw-Hill"
 }
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
   This is a citation: \cite{rudin}. \\
   %% This, instead, an example of use of the ``constants'' package:
   %% \[\Cl[K]{nameconstant}=e^\pi;\]
   %% now here's a new constant of the same family: $\C[K]$, while here I am referring to the first constant defined: $\Cr{nameconstant}$.
   \printbibliography
\end{document}
  • Welcome to TeX.SX! I can reproduce the error. Indeed, with the constants package the end of the bcf file is somehow missing. However, except for producing the error, the constants package is not actually used in your MWE. What exactly are you using it for? – gusbrs Mar 11 '18 at 21:51
  • I need to use several constants, and sometimes I have to refer to old ones; this package defines "families" of constants and automatically numbers them. Maybe I'll edit the question and insert an example of use of it. – Mattia Vedovato Mar 11 '18 at 21:59
  • I'm not sure this is what you are looking for, but have you considered the glossaries package? Anyway, I don't know what in constants causes it to tamper with the bcf file. Let's see what others have to say. I'm not really acquainted with constants either, so perhaps someone else has also other alternative suggestions to make. – gusbrs Mar 11 '18 at 22:01
  • I've had a look at the glossaries package and it doesn't seem what I'm looking for; thank you, anyway. – Mattia Vedovato Mar 11 '18 at 22:15
  • 2
    constants.sty inserts \@@end at the end of the document and so hinders biblatex to write its file. – Ulrike Fischer Mar 11 '18 at 22:24
  • So there's no chance of using both constants and biblatex? – Mattia Vedovato Mar 11 '18 at 22:30
  • 1
    Imho one shouldn't use this constants.sty. It probably breaks also other packages. – Ulrike Fischer Mar 11 '18 at 22:34
  • Thanks, I suspected so. There are probably more clever ways to do that task, I'll try on my own. – Mattia Vedovato Mar 11 '18 at 22:46
  • 1
    If I may, I suggest you take a second look at glossaries. It is quite a powerful package and does more than it looks at first glance. – gusbrs Mar 11 '18 at 22:52
  • Sure, I have to explore it a bit but I've seen it will also come in handy in other situations; in case I find something useful for this purpose, I'll write it here. – Mattia Vedovato Mar 11 '18 at 22:56
  • 2
    There are some example glossary documents at http://www.dickimaw-books.com/gallery/#glossaries if you want an idea of what you can do with the glossaries package. – Nicola Talbot Mar 12 '18 at 00:56
  • constants.sty destroys the \AfterEndDocument hook completely and disables all \AtEndDocument hooks that are issues after constants.sty is loaded. So quite some packages brake with constants, but many of those breakages can be fixed by loading constants later. Packages that use \AfterEndDocument, however, are broken beyond repair at least biblatex and pythontex are affected by this. – moewe Mar 12 '18 at 08:12
  • @UlrikeFischer It seems the OP has already found a solution that works for them, but maybe you also want to add an answer explaining what exactly is going wrong here. That would be really appreciated. – moewe Mar 12 '18 at 15:08
  • @moewe I added a short answer. – Ulrike Fischer Mar 12 '18 at 15:30

2 Answers2

6

The constants package inserts throught \AtEndDocument the commands \deadcycles\z@\@@end which end the compilation and so hinders biblatex to finish the bcf-file.

I don't know why the package does this -- it looks like a bad copy of the original code in the kernel -- but it means that the package can break other packages completly and so shouldn't be used.

Ulrike Fischer
  • 327,261
  • 1
    Thank you very much. To repeat my comment in this slightly more prominent place: \AfterEndDocument is completely broken by constants. So all packages that rely on it won't work properly (I could only find biblatex, minted andpythontex that use this). constants also prevents execution of all \AtEndDocument issued after constants is loaded. That potentially affects many more packages, but could probably be remedied by changing the loading order in most cases. – moewe Mar 12 '18 at 15:40
2

It turns out that the simple trick described in the first answer of the question Automatically numbering constants does exactly what I want, and avoids that error caused by constants.

In my case, I needed several "epsilons", numbered increasingly, and the possibility to refer to old ones.

The following counter was added in the preamble (notice that hyperref is needed):

\usepackage{hyperref}    
\newcounter{epscnt}                     %% Defines the counter for epsilon
\newcommand{\neweps}{                   %% Used to introduce a new epsilon
    \refstepcounter{epscnt}             %%    with the right subscript
    \ensuremath{\epsilon_\theepscnt}
    }
\newcommand{\oldeps}[1]{\ensuremath{\epsilon_{\ref*{#1}}}}  %% Used to refer to old constants

And here's a (working) example of how it's used (needs probably some improvement, in case other constants are needed):

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel} 
\usepackage[autostyle]{csquotes}
\usepackage[style=alphabetic,backend=biber]{biblatex}
\usepackage{hyperref}
\begin{filecontents*}{\jobname.bib}
     @book{rudin,
     author  = "Rudin, Walter",
     title   = "Real and Complex Analysis",
     year    = "1966",
     publisher = "McGraw-Hill"
     }
     \end{filecontents*}
 \addbibresource{\jobname.bib}

 \newcounter{epscnt}            %% epsilon
 \newcommand{\neweps}{
    \refstepcounter{epscnt}
    \ensuremath{\epsilon_\theepscnt}
    }
 \newcommand{\oldeps}[1]{\ensuremath{\epsilon_{\ref*{#1}}}}

 \newcounter{uckcnt}            %% uppercase K
 \newcommand{\newuck}{
    \refstepcounter{uckcnt}
    \ensuremath{K_\theuckcnt}
    }
 \newcommand{\olduck}[1]{\ensuremath{K_{\ref*{#1}}}}


 \begin{document}
   Here are some numbered constants: $\neweps$, $\neweps$, $\neweps\label{tre}$; now a citation: \cite[99]{rudin}. Finally, new epsilons, old ones and other constants: $\neweps$, $\oldeps{tre}$, $\newuck\label{uno}$, $\newuck$, $\olduck{uno}$.
   \printbibliography
 \end{document}

The output

This looks good to me; if you have suggestions on how to improve it, I'll be glad to hear them.

  • 2
    Mattia, thank you for reporting back. However link only answers are not encouraged on the site. Would you be so kind as to expand on the answer and how you used that link to solve the problem here? (preferably with a MWE). – gusbrs Mar 12 '18 at 13:43
  • 1
    @gusbrs Sure, I added it, thanks for the feedback. – Mattia Vedovato Mar 12 '18 at 21:54
  • It looks much nicer now. Thank you. (+1) – gusbrs Mar 13 '18 at 02:09