[texhax] ntheorem and hyperref (resent)

Philip G. Ratcliffe philip.ratcliffe at uninsubria.it
Tue Dec 20 12:16:52 CET 2005


> I tested ntheorem package with hyperref package, like this:
>
> [code]
> \documentclass{article}
>
> \usepackage{hyperref}
> \usepackage[standard,thref,hyperref]{ntheorem}
>
> \begin{document}
>
> \section{This is a test}
> \begin{Theorem}
> \label{thmtest}
> this is only a test
> \end{Theorem}
>
> See \thref{thmtest}. % should return `See Theorem 1'
> \end{document}
> [/code]
>
> The purpose of `thref' option (ntheorem) is to procedure:
>  `See Theorem 1'
>
> Drop using `hyperref' package and `hyperref' option works.
> But within the `hyperref'  package (like above), the result is
> incorrectly:
>  `See 1This is a testTheorem1.'
>
> Reading the code I see that the `\newlabel', `\label' of
> `hyperref' package
> was used instead the ones provided by `ntheorem' package.
> (`ntheorem' designs `\label' to read the optional argument like this:
>   \label{test}[category]
> Using `hyperref' package, the optional part `[category]' will be ingore)

Seems to be a bug!  Try putting this in your preamble (spot the difference):

\makeatletter
\def\thref#1{%
   \expandafter\ifx\csname r@#1 at type\endcsname\None
     \PackageWarning{\basename}{thref: Reference Type of `#1' on page
      \thepage \space undefined}\G at refundefinedtrue
     \else\csname r@#1 at type\endcsname~\fi%
   \expandafter\@setref\csname r@#1\endcsname\@fourthoffive{#1}%
}%
\makeatother

You might want to write to the authors of ntheorem - I'm afraid I don't have
time.

Cheers,  Phil



More information about the texhax mailing list