1

Is there a good way to make it so that the proof end marker (i.e., the \qedsymbol) looks one way for proofs of theorems, and a different way for proofs of lemmas?

I know I could locally change the definition of \qedsymbol anytime a lemma proof comes up, but I'm wondering if there's a way to do this automatically, without manually redefining \qedsymbol each time.

Edit (Further Clarification):

Here's an alternate phrasing of my question: I have

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}

in my header to make theorem and lemma environments. I want it to be the case that \begin{proof} \end{proof} environments after theorems have different endmarkers when compared to \begin{proof} \end{proof} environments after lemmas. Is there a way I could do this? For example, is there a way I can easily make some sort of separate lemmaproof environment which has a different endmarker than the default proof environment?

3
  • 3
    you have not shown how you define the environments but probably you can add \def\qedsymbol{???} where you specify the font Commented Jun 8, 2023 at 22:59
  • Sorry, I don't understand your comment (I might just not know enough about TeX). I've tried adding a clarification to my original question. Let me know if there's more relevant information I'm missing.
    – Naysh
    Commented Jun 10, 2023 at 15:41
  • show a small complete document with a lemma and a theorem with the same qed and someone will show you how to change it. Commented Jun 10, 2023 at 15:54

1 Answer 1

2

You can use LaTeX3's hook management tools to tap into execution of code after the end of environments. For example,

\AddToHook{env/theorem/after}{<stuff>}

would execute <stuff> after the theorem environment. This way you can update \qedsymbol after every specific theorem-like environment.

enter image description here

\documentclass{article}

\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}

% Default \qedsymbol is \openbox
% Make any subsequent proof have unique \qedsymbol
\AddToHook{env/theorem/after}{\renewcommand\qedsymbol{\openbox}}
\AddToHook{env/lemma/after}{\renewcommand\qedsymbol{$\clubsuit$}}

\begin{document}

% Theorem
\begin{theorem}
This is a theorem.
\end{theorem}

\begin{proof}
This is a proof of the theorem.
\end{proof}

% Lemma
\begin{lemma}
This is a lemma.
\end{lemma}

\begin{proof}
This is a proof of the lemma.
\end{proof}

\begin{proof}
This is a different proof of the lemma.
\end{proof}

% Theorem
\begin{theorem}
This is a theorem.
\end{theorem}

\begin{proof}
This is a proof of the theorem.
\end{proof}

\end{document}

If you're interested in a theorem-style specific environment, you can use something like this:

\NewDocumentEnvironment{lemmaproof}{ }{%
  \RenewDocumentCommand{\qedsymbol}{}{$\clubsuit$}% proof-specific \qedsymbol
  \proof
}{%
  \endproof
}

The above updates \qedsymbol locally, inside the newly-defined lemmaproof, while still allowing the use of the proof environment's optional argument.

You must log in to answer this question.

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