Weird behavior of ntheorem.

I have the following strange phenomena using ntheorem:

I get $\Lambda$ instead of a \box. In other proofs I might get a \box or \Lambda. In the example I end with  if I use equation instead the box is not on the correct height.

This is the first part of my preamble:

\documentclass[a4paper,11pt, leqno, draft]{scrreprt}
\usepackage{amsmath, amssymb, bm, mathtools, marvosym}
\usepackage[amsmath, amsthm, thmmarks]{ntheorem}
\usepackage[varg]{txfonts}
\usepackage{theoremref}
\usepackage{graphicx}
\usepackage{fancyref}


A minimal example where this occurs:

\documentclass[a4paper,11pt, leqno, draft]{scrreprt}
\usepackage{amsmath}
\usepackage[amsmath, amsthm, thmmarks]{ntheorem}
\usepackage[varg]{txfonts}

\theoremstyle{change}
\newcounter{acounter}[chapter]
\def\theacounter{\thechapter.\arabic{acounter}}
\newtheorem{lemma}[acounter]{Lemma}
\begin{document}
\begin{proof}
$f = g$
\end{proof}
\end{document}


How do I solve this? It seems like the problem is with txfonts.

-
Note that math expression like $\Lambda$ don't work here on TeX.SX as they do on Math.SX. –  Martin Scharrer Apr 6 '11 at 19:46
@Martin: Thank you, I have changed it to code. –  Jonas Teuwen Apr 6 '11 at 19:48
Please add to your question a minimal working example illustrating the undesired bahaviour. –  Gonzalo Medina Apr 6 '11 at 19:49
@Gonzalo: Okay, done. –  Jonas Teuwen Apr 6 '11 at 20:00

In fact, the problem comes from amsmath.sty and txfonts.sty both defining the command \openbox.

Here's the definition in txfonts.sty:

\DeclareRobustCommand{\openbox}{\begingroup \usefont{U}{txsya}{m}{n}\thr@@\endgroup}


and here's the definition in amsthm.sty:

\newcommand{\openbox}{\leavevmode
\hbox to.77778em{%
\hfil\vrule
\vbox to.675em{\hrule width.6em\vfil\hrule}%
\vrule\hfil}}


One way to avoid the conflict would be to load txfonts first and then amsthm (as package option for ntheorem) and, with the help of the savesym package, rename the \openbox command from txfonts so that \openbox retains its amsthm.sty definition.

\documentclass[a4paper,11pt, leqno, draft]{scrreprt}
\usepackage{amsmath}
\usepackage[varg]{txfonts}
\usepackage{savesym}
\savesymbol{openbox}
\usepackage[amsthm,amsmath,thmmarks]{ntheorem}

\theoremstyle{change}
\newcounter{acounter}[chapter]
\def\theacounter{\thechapter.\arabic{acounter}}
\newtheorem{lemma}[acounter]{Lemma}

\begin{document}
\begin{proof}
$f = g$
\end{proof}
\end{document}


As a side note, the ntheorem package documentation suggests the following:

Thus, we recommend not to use amsthm, since the features for defining theorem- like environments in ntheorem.sty—following theorem.sty—seem to be more intu- itive and user-friendly.

Of course, if you don't use the amsthm option you'll have to define your own proof environment.

EDIT: This suggestion has to be taken carefully: Philippe Goutet has made an excellent comparison between amsthm and ntheorem in his answer to Theorem packages: which to use, which conflict?.

-
Great answer! I made my own proof environment and replaced the box by \blackbox. –  Jonas Teuwen Apr 6 '11 at 21:01
Do you happen to know why  doesn't work anymore? The equation* environment however does work. –  Jonas Teuwen Apr 6 '11 at 21:08
@Jonas T: I'll need to see a minimal working example to see your settings and be able to find the reason for the odd behaviour. –  Gonzalo Medina Apr 6 '11 at 22:33
I think you mean that the ntheorem (not amsthm) documentation says not to use amsthm anymore. And that's not quite true, as ntheorem has a few bugs which amsthm has not, see tex.stackexchange.com/questions/5599/… –  Philippe Goutet Apr 7 '11 at 9:02
@Philippe Goutet: yes, it was ntheorem documentation; fixed. I (until today) understood the quote as recommending not to use amsthm together with ntheorem; however, now that I reread it, it seems, in fact, to suggest not to use amsthm anymomore, and I don't agree with this. Thank you for noticing this and for the link. –  Gonzalo Medina Apr 7 '11 at 12:04