I would like an example environment which is numbered according to theorems (e.g. theorem 1, example 2, theorem 3, example 4, ...) and ends with a clubsuit. I've already seen this solution, but I would rather have one which doesn't use the ntheorem
package; either by creating a new environment, or by rewriting the existing one (e.g. the proof environment). I'm not particularly experienced with LaTex, so I'm asking this.
This is the code I have so I can get started. I can live with the error for now.
\documentclass{amsart}
% \usepackage[utf8]{inputenc}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{example}[theorem]{Example}
\newenvironment{example}{\paragraph{Example:}}{\hfill$\clubsuit$\vspace{10pt}}
% produces Error: Command \example already defined.
It mostly works. It is numbered according to theorem, and ends with a clubsuit:
\begin{example}
First example.
\end{example}
However, there are some issues, as illustrated below:
\begin{example}
Second example.
\end{example}
Line after second example breaks it.
This can be fixed by adding a new line as follows:
\begin{example}
Third example.
\end{example}
A line after a newline after the third example is okay.
But I'd rather not have to do this fix in the first place. Also, the environment doesn't work with equations.
\begin{example}
Example ending on an equation (qedhere does not work)
\begin{equation*}
a = b.
\end{equation*}
\end{example}
Unlike the
proof
environment, \qedhere
does not work. Similar issue goes with itemize/enumerate. In summary, I would like a minimal, non-ntheorem
-based example
environment, which is essentially a copy of the proof environment, but the QED symbol is replaced by a clubsuit (such that the \qedhere
command or equivalent can bring the clubsuit into an ending equation). I'm sure there is a simpler solution than what I have.
Update. The following solution adapted from here is very close to what I want:
\newcommand{\newmarkedtheorem}[1]{%
\newenvironment{#1}
{\pushQED{\hfill$\clubsuit$}\csname inner@#1\endcsname}
{\popQED\csname endinner@#1\endcsname}%
\newtheorem{inner@#1}%
}
\newmarkedtheorem{example}[theorem]{Example}
However, there is still an issue with the equation
and align
environments.
\begin{example}
Example ending in align environment:
\begin{align*}
1 + 1 + 1 &= 1 + 2\\
&= 3.\qedhere
\end{align*}
\end{example}
\qedhere
is putting it in the right place. Since you always want to change the qed box to the clubsuit, you might want to define a\clubhere
that resets the symbol and then goes on to do the rest of what\qedhere
does, namely the change of location. (I thought that was covered in the answer I linked.)\clubhere
with that functionality? That might very well solve the issue I'm having right now (see update). Thank you.