I was using the texlive version from Ubuntu's repos, but then started needing some features from the latest versions of some packages, so I replaced the repos' texlive with a new system from https://tug.org/texlive/acquire-netinstall.html
Then, some documents that compiled perfectly started giving this error message
(let's call it a "bug"):
ERROR: Paragraph ended before \Hy@setref@link was complete.
(After a mini heart attack)
I managed to isolate the problem to this (sort-of-MWE):
\documentclass{abntex2} % subclass of memoir that loads hyperref
% using any other class is not an option
\usepackage[
backend = biber,
%style = abnt, % this option doesn't matter for the bug
]{biblatex}
\usepackage[thref]{ntheorem}
\begin{document}
\section{Lorem ipsum}\label{loremipsum}
Reference to section~\ref{loremipsum}.
Some other text.
\end{document}
Some comments:
- Some versions:
ntheorem: 1.33 2011/08/15
,
abntex2: 1.9.7 2018/11/24
,
hyperref: 7.00 2022/06/20
. - Changing the class from
abntex2
tomemoir
(its base class) dispels the bug; - Omitting the
thref
option ofntheorem
dispels the bug, but you must also erase the files the compilation generates, and then recompile; - Loading
amsmath
(with or without theamsmath
option tontheorem
) has no effect on the bug; - Using the
hyperref
option inntheorem
has no effect also.
It seems I didn't really need the thref
functionality described in the package's docs, so for now I'll just remove it,
but I'd appreciate if someone savvier could tell what went wrong, whether there's a way to fix it, etc.
(Although ntheorem[thref]
and hyperref
seem known not to get along very well,
they were behaving just fine with the slightly outdated versions from the Ubuntu repos,
behave fine with the memoir
class,
and ntheorem
should (theoretically=according to its docs) work with hyperref
, as long as you give it the proper loading option,
so I think there's some value in pointing out this "bug").
Best Answer
unchanged things
The
thref
option ofntheorem
is and was always incompatible withhyperref
.Without hyperref a label like
\label{theo}[additional text]
will writeto the aux file, and a
\thref
can then retrieve theadditional text
.If
hyperref
is loaded this no longer works.ntheorem
contains here a bit of repair code to retrieve at least a "keyword", but the optional argument of\label
can no longer be used:what is new
Since a few months
hyperref
no longer delays the loading ofnameref
to\begin{document}
but loads it directly. For your example that means thathyperref
andnameref
are both loaded beforentheorem
and so no longer overwrite its\label
definition to repair at least in part the damage thethref
option does.So either don't use this option, or force the loading of
ntheorem
beforehyperref
:what is new 2023
Since the LaTeX release 2023-06-01, the LaTeX kernel itself defines
\label
as needed for links.hyperref
therefore no longer redefines it later.Now the
thref
option of ntheorem really harms, as it redefine\label
in way that is not usable with LaTeX andhyperref
. The option should not be used anymore!