1

I'm using ntheorem with the thmmarks option but without the amsthm option (for reasons I won't go into). I would like to define the proof environment à la amsthm. Specifically, I want:

  • To be able to use the proofSymbol command to affect all proofs, as described in this answer.
  • To be able to specify that, by default, proofs will have no QED symbol.
  • For the proof symbol, when it appears, to appear by default at the end of the line (i.e. after an \hfil).

What I did was 'lift' the definition from ntheorem.sty:

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

And add a counter definition. Here's the result in an working example:

\documentclass{article}
\usepackage[thmmarks]{ntheorem}
\usepackage{amssymb}
\usepackage{lipsum}

\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

\renewcommand\proofSymbol{\ensuremath{\blacksquare}}

\begin{document}
\begin{proof}
Without \verb|\qed| in this one.
\end{proof}
\begin{proof}
With \verb|\qed| in this one. \qed
\end{proof}
\end{document}

(Edit: Dropped the \lipsum 's from the MWE) What happens is that I get a black square when not specifying \qed, but no black square when I do specify it. So,

  • How do I get \qed to work now?
  • To avoid a symbol by default now, I'll just set \theoremsymbol{\relax}, right?
  • Can I overcome the "no \par before the end" limitation?
  • Please post an MWE. It would be instructive to know which document class you use, and also which other packages you load. When I try to build a minimal example, I unfortunately get the error message ! LaTeX Error: No counter 'currproofctr' defined.. – Mico Feb 28 '16 at 20:09
  • (1) why all this code? (2) why a proof env with no marker by default? Why not two different envs, cleaner interface, both can be make with approx 4 lines of code each. More if you want to lift openbox, but it is just as easy to just use square – daleif Feb 28 '16 at 20:34
  • @daleif: See edit. It's not me, it's ntheorem... also, remember I just want to replicate amsthm's proof environment, not do anything better/smarter. – einpoklum Feb 28 '16 at 20:44
  • @Mico: See edit. – einpoklum Feb 28 '16 at 20:44
  • 1
    @mico yes ntheorem really dislikes \par before \end.... – daleif Feb 28 '16 at 20:53
1

Here is a way to do it in detail: I define two different environments, proof(with a qed symbol) and proof-wo without qed symbol.

However, note it is enough to define only a proof environment (with qed symbol by default), and add \NoEndMark if you do not want this symbol.

Also I do not see the point of numbering proofs. Nevertheless, should you really want to, just change the theorem style to plain and replace \newtheorem{proof-wo}{Proof} with \newtheorem{proof-wo}[proof]{Proof}if you want to have only one counter for both environments.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage[amsmath, thmmarks]{ntheorem}
\usepackage{amssymb}
\usepackage{lipsum}
 \theoremstyle{nonumberplain}
 \theoremheaderfont{\itshape}
 \theorembodyfont{\normalfont}
 \theoremseparator{.\,—}
 \theoremsymbol{}
 \newtheorem{proof-wo}{Proof}
 \theoremsymbol{\ensuremath{\color{lightgray}\blacksquare}}
 \newtheorem{proof}{Proof}

\begin{document}

\begin{proof-wo}
Without \verb|\qed| Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat
ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hen-
drerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellen-
tesque cursus luctus mauris.
\end{proof-wo}

%
\begin{proof}
With \verb|\qed| Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat
ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hen-
drerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellen-
tesque cursus luctus mauris.
\end{proof}
%
\begin{proof}\NoEndMark
Without \verb|\qed| Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat
ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hen-
drerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellen-
tesque cursus luctus mauris.
\end{proof}

\end{document} 

enter image description here

0

Too long for a comment

The standard method of making an ntheorem proof env is something similar to (untested, in a hurry)

\usepackage[amsmath,thmmarks]{ntheorem}
\theoremstyle{nonumberplain}
\theoremheaderfont{\itshape}
\theorembodyfont{\normalfont}
\theoresymbol{\ensuremath\square}
\newtheorem{proof}{Proof}

I do not understand why you are using all that code.

I would then also make a variant that has an empty \theoremsymbol and call it say proof*

Remember that ntheorem and amsthm are very different beasts and the former does not support \qed

  • WHen I use your code with my body I get compilation erros. Also, remember, no amsmath. As for not understanding - again, tell that to the ntheorem author(s), I didn't make that stuff up. – einpoklum Feb 28 '16 at 21:13
  • @einpoklum I'm not loading any amsthm, there is a typo, should read bodyfont – daleif Feb 28 '16 at 21:15
  • Sorry, meant no amsmath. Oh, I just noticed I had that in the title as well. I meant the amsmath option to ntheorem. – einpoklum Feb 28 '16 at 21:16
  • @einpoklum Just remove the option, why no amsmath? It is more or less standard – daleif Feb 28 '16 at 21:16
  • Compiling this: pastebin.com/LYMrQ1xf I get ! Undefined control sequence. l.5 \theorembodybont {\normalfont} . Using TeXLive on Debian Stretch. – einpoklum Feb 28 '16 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.