# Conflict between amsmath and ntheorem, or, how I fell into an infinite troubleshooting loop

There are similar questions on this site, but nothing quite fixed this problem for me.

When using amsmath with ntheorem I get either a missing end of theorem symbol (when my theorem ends with an equation) or my cross-referencing gets screwed up.

Here is a minimal example of the missing end of theorem mark:

\documentclass{article}

\usepackage{amsmath}
\usepackage[thmmarks,amsmath]{ntheorem}
\theoremsymbol{*}
\newtheorem{myDefinition}{Definition}

\begin{document}

\begin{myDefinition}
I don't get my end of definition mark \ldots
$$x=y \label{test}$$
\end{myDefinition}

\ldots but the equation cross-reference works: \eqref{test}.

\end{document}


Here is a minimal example of the screwed-up cross-referencing (the argument amsmath has been omitted from the ntheorem package call):

\documentclass{article}

\usepackage{amsmath}
\usepackage[thmmarks]{ntheorem}
\theoremsymbol{*}
\newtheorem{myDefinition}{Definition}

\begin{document}

\begin{myDefinition}
Now I get my end of definition mark \ldots
$$x=y \label{test}$$
\end{myDefinition}

\ldots but the equation cross-reference fails: \eqref{test}.

\end{document}


I'm probably missing something obvious.

-
When I run your first MWE on my machine (MacTeX2012, MacOSX 10.7.5), I do get an endmark, below the equation number. – Mico Sep 23 '12 at 13:12
I think it's bad style to use end marks along with equation numbers on the right: the mark is fighting against the number and loses. – egreg Sep 23 '12 at 13:32

I can verify your problem on an up-to-date TL 2012. I agree with @egreg that it doesn't look great, but if you'd like to stick to your guns, then you can use an \mbox{} to make things 'work'.

This trick also works when using the mdframed package with a frame that ends with an equation

\documentclass{article}

\usepackage{amsmath}
\usepackage[thmmarks,amsmath]{ntheorem}
\theoremsymbol{*}
\newtheorem{myDefinition}{Definition}

\begin{document}

\begin{myDefinition}
I don't get my end of definition mark \ldots
$$x=y \label{test}$$
\mbox{}
\end{myDefinition}
\ldots but the equation cross-reference works: \eqref{test}.

\end{document}

-
If I'm not mistaken this used to work in earlier versions. Sometimes it help using the empheq package with no emphasizing, some of the extra options for empheq fix some placement problems in ntheorem – daleif Sep 23 '12 at 16:05
@daleif my distribution is completely up to date- did you mean that your method worked on earlier versions? – cmhughes Sep 23 '12 at 17:31
In earlier versions. Now a days I just use empheq, I'll post an example as an answer. – daleif Sep 24 '12 at 18:47
I confirm the workaround and appreciate the confirmation. I might try to submit a bug report. – Stephen Mc Ateer Sep 30 '12 at 4:49
@StephenMcAteer you're welcome- I don't know if I'd call it a bug, but of course you can see what the maintainers say :) – cmhughes Sep 30 '12 at 5:37

This works

\documentclass{article}

\usepackage{amsmath}
\usepackage[ntheorem]{empheq}
\usepackage[thmmarks,amsmath]{ntheorem}
\theoremsymbol{*}
\newtheorem{myDefinition}{Definition}

\begin{document}

\begin{myDefinition}
I don't get my end of definition mark \ldots
\begin{empheq}{equation}
x=y
\label{test}
\end{empheq}
\end{myDefinition}
\ldots but the equation cross-reference works: \eqref{test}.

\end{document}

-
That code produces the theoremmark overlapping the equation number and the cross-refernce does not work. – Stephen Mc Ateer Sep 30 '12 at 4:41
This used to work. I've just tested with the ntheorem version from 2005 (v1.25) and then it works and the marker is placed correctly. And that ntheorem can actually place the marker correctly by itself! I'll send an email to Wolfgang May – daleif Oct 1 '12 at 10:15

Please try the examples with the "development" version 1.33 of ntheorem.

This version, although by now more than 1 year old is still a bit unstable an not sufficiently tested since I changed major things in the handling of skips - so please check the skips in your documents.

-