3

I've seen this post Defining my own proof environment? and I have a follow-up question, because the answers there are unsatisfying.

I would like to define two proof environments—one with a black qed square and one with a white qed square. I made the default proof environment to have a black qed symbol by the following code snippet:

\renewcommand{\qedsymbol}{$\blacksquare$}

I defined another proof environment by a modification of the advice given in the page I mentioned above and wrote the following:

\newenvironment{claimproof}[1]{\par\noindent\textit{Proof.}\space#1}{\hfill$\square$}

This seems like it works, but I ran into some edge cases where there are discrepancies between the two. The latter claimproof environment does not guarantee that the qed-box is placed at the same place where the default proof environment would place it. Here is an example where I found an actual difference.

Picture 1 (uses custom claimproof environment with white qed-box).

enter image description here

Picture 2 (uses default proof environment with black qed-box).

enter image description here

The claimproof environment fails to place the white box to the right (I could fix that by adding \newline but that would make unnecessary new lines that the default proof environment doesn't do). I want claimproof to act exactly the same way as the default proof environment works. Is there a less ad-hoc way to do this that actually replicates the true proof environment?

1
  • 1
    Well, most of those answers are unfortunately very disputable. None, except the ones based on amsthm or ntheorem fail to guarantee correct positioning of the tombstone (aka QED symbol).
    – egreg
    Feb 8, 2023 at 21:18

1 Answer 1

7

The following code defines the environment claimproof as the proof environment from the amsthm package, but also redefines \qedsymbol at the beginning of the environment. Since the redefinition of \qedsymbol is done inside a group, it is only applied locally (inside the claimproof environment).


\documentclass{article}
\usepackage{amssymb,amsthm}

\newenvironment{claimproof}[1][\proofname]
{\renewcommand\qedsymbol{$\blacksquare$}\proof[#1]}
{\endproof}

\begin{document}
    \begin{proof}
        a proof with a hollow square as a Q.E.D
    \end{proof}

    \begin{claimproof}
        a proof with a solid square as a Q.E.D
    \end{claimproof}
\end{document}  

enter image description here

I thought it might be better to not modify the proof environment, and made claimproof to have a solid qed symbol. If you wish for the proof environment to have a solid square, you could save the original \qedsymbol and do the redefinition inside claimproof to the original symbol.

\documentclass{article}
\usepackage{amssymb,amsthm}

\let\origqedsymbol\qedsymbol
\renewcommand\qedsymbol{$\blacksquare$}

\newenvironment{claimproof}[1][\proofname]
{\renewcommand\qedsymbol{\origqedsymbol}\proof[#1]}
{\endproof}

\begin{document}
    \begin{proof}
        a proof with a solid square as a Q.E.D
    \end{proof}

    \begin{claimproof}
        a proof with a hollow square as a Q.E.D
    \end{claimproof}
\end{document}

enter image description here

4
  • 1
    I'd use \proofname as the default value of the optional argumen. Otherwise this is the answer.
    – egreg
    Feb 8, 2023 at 21:20
  • @egreg, thank you for the remark, you are right... I will edit.
    – Udi Fogiel
    Feb 8, 2023 at 21:21
  • This is perfect. Simple and avoids ad-hoc hacks. Thank you! Feb 8, 2023 at 21:23
  • @MaximalIdeal you are welcome :)
    – Udi Fogiel
    Feb 8, 2023 at 21:24

You must log in to answer this question.

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