8

I have the following strange phenomena using ntheorem:

Weird phenomena http://www.cgti.nl/gf/weird.png

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.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
JT_NL
  • 2,153

1 Answers1

6

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?.

Gonzalo Medina
  • 505,128
  • Great answer! I made my own proof environment and replaced the box by \blackbox. – JT_NL Apr 06 '11 at 21:01
  • Do you happen to know why \[ \] doesn't work anymore? The equation* environment however does work. – JT_NL Apr 06 '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 06 '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 http://tex.stackexchange.com/questions/5599/theorem-packages-which-to-use-which-conflict – Philippe Goutet Apr 07 '11 at 09: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 07 '11 at 12:04