# Issue with ntheorem and \eqref

Whenever I try and label an equation in the following format

$$\label{eq:blah} blah$$


and then reference this equation

By \eqref{eq:blah}


I get the usual (??) of an ill-defined labeling. It only happens with equation environments though.

I've tried removing almost everything I can think of in my preamble to make it work, but to no avail.

Consequently, I am posting a MWE which is not very minimal—apologies!

Any help is greatly appreciated!

\documentclass{book}

\usepackage{amsfonts,amssymb,latexsym,verbatim,url,color,mathrsfs,tikz,extarrows,enumerate,lipsum,mathtools}
\usepackage{enumerate,fancyhdr,verbatim,comment}

\usepackage{dsfont}

\usetikzlibrary{matrix,arrows}

urlcolor  = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}

\usepackage[amsmath,thmmarks]{ntheorem}

\newcounter{dummy}
\numberwithin{dummy}{chapter}

\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}

\begin{document}

$$\label{eq:example} \int_a^b f(x)\, dx=F(b)-F(a)$$

By Equation \eqref{eq:example}

\end{document}


New MWE:

\documentclass{book}

\usepackage{amsfonts,amsmath,amssymb,latexsym,verbatim,url,color,mathrsfs,tikz,extarrows,enumerate,lipsum,mathtools}

\usepackage{enumerate,fancyhdr,verbatim,comment}

\usepackage{dsfont}

\usepackage[margin=1 in]{geometry}

\usetikzlibrary{matrix,arrows}

\usepackage[amsmath,thmmarks]{ntheorem}

urlcolor  = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}

\newcounter{dummy}
\numberwithin{dummy}{chapter}

\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{}
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}

\begin{document}

$$\label{eq:example} \int_a^b f(x)\, dx=F(b)-F(a)$$

By Equation \eqref{eq:example}

\end{document}

• The packages are loaded in the wrong order: load all of them before hyperref except cleveref which must be last. – egreg Nov 30 '15 at 7:47
• @egreg Thanks! It didn't actually seem to fix anything though. :( I have edited the above with how I interpreted your statement (plus what I read in the linked post). Am I doing something wrong still? – Alex Youcis Nov 30 '15 at 8:09
• @egreg Nope, I figured it out. Thanks so much!! – Alex Youcis Nov 30 '15 at 8:11
• Indeed this not a duplicate of the linked question. You need to pass the amsmath option to thmtools. – Andrew Swann Nov 30 '15 at 9:04
• Do you really need all those packages? Some of them are loaded twice. As I see, problematic are two of them: extarrows and comment. Both are not connected to the problem which you indicate in the question title. – Zarko Nov 30 '15 at 10:32

As I mentioned in my comment, problematic are packages axtarrows and comment. They cause errors even if ntheorem as well as equation with referencing is not presented. Both clashes also with some other packages, what I didn't further investigate. Do you really need those packages in your text?

I suggest to load your packages in grops with similar use (math, etc). I made this according to my taste/habits. So, after this the code of your MWE is:

\documentclass{book}
\usepackage{mathtools,amssymb,latexsym,
color,mathrsfs}
% amsfont is load by amsmath and amsmath by maththools
% url is also part of hypperref package, no need to be loaded
% verbatim enumerate are loaded twice
% extarrows make troubles, I suggest to omit it, most its functionality is achievable by mathtools
% tikz and lipsum I moved in new group of packages

\usepackage{enumerate,fancyhdr,verbatim}
% comment make troubles, in all my needs is sufficient to use \begin{comment} ... \end{comment} from verbatim package
\usepackage{lipsum}% produce dummy text

\usepackage{dsfont}
\usepackage[margin=1 in]{geometry}

\usepackage{tikz}% for drawing pictures
\usetikzlibrary{matrix,arrows}

\usepackage[amsmath,thmmarks]{ntheorem}
\newcounter{dummy}
\numberwithin{dummy}{chapter}

\theoremprework{\setlength
\theorempreskipamount{10 pt}\setlength\theorempostskipamount{10 pt}}

\theoremstyle{plain}
\theorembodyfont{\upshape}
\theoremsymbol{$\square$}% you not use a symbol for end of example
\theoremseparator{:}
\newtheorem{example}[dummy]{Example}

urlcolor  = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}

\begin{document}

$$\label{eq:1} \int_a^b f(x)\, dx=F(b)-F(a)$$
By Equation \eqref{eq:1} \dots
\begin{example}
Let explain \eqref{eq:1} with \dots
$$\label{eq:2} \int_a^b f(x)\, \mathrm{d}x = F(b)-F(a)$$
\end{example}
Regarding \eqref{eq:2} \dots
\end{document}


With above MWE I haven't any problem when I compile it: