5

I'm using ntheorem with the amsthm option, to define a theorem-like environment for stating notes:

\documentclass{article}
\usepackage[amsthm]{ntheorem}
\theoremstyle{plain}
\theoremheaderfont{\normalfont\itshape}
\theorembodyfont{\normalfont}
\newtheorem*{myenv}{Note}

\begin{document}
\begin{myenv}
The quick brown fox jumps over the lazy dog.
\end{myenv}
\end{document}

I should be getting an environment beginning with the word 'Note' in italic font, followed by the contents in normal roman font. Instead, I get 'Note' in boldface roman and the body in italic:

enter image description here

Trying to define a new theoremstyle doesn't seem to work either:

\newtheoremstyle{nonumberabc}%
  {\item[\normalfont\itshape \hskip\labelsep ##1\theorem@separator]\normalfont}%
  {\item[{\normalfont\itshape \hskip \labelsep ##3}\theorem@separator]\normalfont}
\theoremstyle{abc}
\newtheorem*{myenv}{Note}

this gives the same results with the above document.

What am I doing wrong?

The problem does not occur if I drop the amsthm option - but then I don't get some nice amsthm definitions I'm expecting... (it was psychologically hard enough to drop amsthm for ntheorem after years or use!) Most importantly, I like the amsthm proof environment. So, for those suggesting that I just drop amsthm - how can I reproduce proof with the exact same behavior (including the QED box size etc.) with ntheorem? I can't just lift code out of ntheorem, because it doesn't seem to use its own theoremstyle commands to get the proof environment. Rather, it does something else.

4 Answers 4

5

I'm using ntheorem with the amsthm option. I should be getting a environment with 'Note' in italic and the contents in normal roman font. Instead, I get 'Note' in boldface roman and the body in italic. What am I doing wrong?

I believe you need to provide a couple of \newtheoremstyle commands before you can issue the command \newtheorem{myenv}{Note}. According to the documentation of the ntheorem package, the theoremstyles of both numbered and unnumbered "theorem" environments must be defined explicitly if the package was loaded with the amsthm option. Here's what I suggest you do in the preamble, given your description of how you'd like the "note" environment to be styled:

\usepackage[amsthm]{ntheorem}
\theorembodyfont{\upshape}
\newtheoremstyle{notes} % for numbered notes
  {\item[\hskip\labelsep \itshape ##1\ ##2.]}%
  {\item[\hskip\labelsep \itshape ##1\ ##2, ##3.]}
\newtheoremstyle{nonumbernotes} % for unnumbered notes
  {\item[\hskip\labelsep \itshape ##1.]}%
  {\item[\hskip\labelsep \itshape ##1, ##3.]}
\theoremstyle{notes} % switch to newly defined theorem style
\newtheorem*{myenv}{Note}

After this, you should have no problems with your myenv environments.

5

It is possible to "lift" the proof environment code from ntheorem:

\documentclass{article}
\usepackage[thmmarks]{ntheorem}% http://ctan.org/pkg/ntheorem

\makeatletter
\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
\gdef\proofSymbol{\openbox}
\newcommand{\proofname}{Proof.}
\newcounter{proof}\newcounter{currproofctr}\newcounter{endproofctr}%
\newenvironment{proof}[1][\proofname]{
  \th@nonumberplain
  \def\theorem@headerfont{\itshape}%
  \normalfont
  %\theoremsymbol{\ensuremath{_\blacksquare}}
  \@thm{proof}{proof}{#1}}%
  {\@endtheorem}
\makeatother

\theoremstyle{plain}
\theoremheaderfont{\normalfont\itshape}
\theorembodyfont{\normalfont}
\newtheorem*{myenv}{Note}

\begin{document}
\begin{myenv}
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\begin{proof}
This statement is true, because the fox did jump over the lazy dog.
\end{proof}
\end{myenv}
\end{document}

ntheorem with amsthm proof environment

The QED-symbol is displayed when using the thmmarks package option of ntheorem. In ntheorem this is manually defined in \openbox, and subsequently used as \proofSymbol.

6
  • It's missing the point after 'Proof'. I can add that, I hope it's not missing anything else.
    – einpoklum
    Oct 2, 2011 at 17:52
  • As mentioned, the above was "lifted" from ntheorem based on the amsthm style option. Based on a browse of amsmath.sty, the only addition is \ignorespace after typesetting the point/period after Proof.
    – Werner
    Oct 2, 2011 at 18:06
  • Added a slightly modified version as an alternative answer, you're welcome to have a look.
    – einpoklum
    Oct 22, 2011 at 15:43
  • \blacksquare seems to require other packages.
    – einpoklum
    Jan 14, 2021 at 21:30
  • 1
    @einpoklum: Yes, \usepackage{amssymb}.
    – Werner
    Jan 14, 2021 at 21:49
4

The package documentation answered as follows:

3.2.2 amsthm

Here, the user has to express his definitions by the \newtheoremstyle command provided by ntheorem.sty, including the use of \theoremheaderfont and \theorembodyfont. The options [amsthm] and [standard] are in conflict since they both define an environment proof. 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 intuitive and user-friendly.

Package ntheorem

To get a similar proof environment without the option amsthm you get do the following:

 \documentclass[english]{article}
\usepackage{babel}
\usepackage{amsmath,amssymb}
\usepackage[thmmarks,amsmath]{ntheorem}
\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
\theoremstyle{nonumberplain}

\theoremsymbol{\openbox}
\newtheorem{proof}{Proof}

\theoremsymbol{}
\theoremstyle{plain}
\theoremheaderfont{\normalfont\itshape}
\theorembodyfont{\normalfont}
\newtheorem*{myenv}{Note}



\begin{document}
\begin{myenv}
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\end{myenv}

\begin{proof}[Alternative Text]
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
\end{proof}
\end{document}
4
  • But I'm not using the [standard] option... and I do like amsthm's proof.
    – einpoklum
    Oct 2, 2011 at 17:28
  • @EyalRozenberg: Please see my edit. Oct 2, 2011 at 18:58
  • Your suggestion has a significant issue with optional arguments: Try \begin{proof}[Alternative Text] ... you get the Atlernative text twice.
    – einpoklum
    Oct 2, 2011 at 20:06
  • @EyalRozenberg: I fixed it. Oct 2, 2011 at 20:10
0

Following Werner's answer and my comment there, here's code for a proof environment with the final-period-mark issue fixed; it's a slight tweak of the code Werner lifted from the `ntheorem' sources:

\makeatletter
\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
\gdef\proofSymbol{\openbox}
\newcommand{\proofname}{Proof}
\newcounter{proof}\newcounter{currproofctr}\newcounter{endproofctr}%
\newenvironment{proof}[1][\proofname]{
  \th@nonumberplain
  \def\theorem@headerfont{\itshape}%
  \normalfont
  %\theoremsymbol{\ensuremath{_\blacksquare}}
  \@thm{proof}{proof}{{#1}.}}%
  {\@endtheorem}
\makeatother

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .