I'd like to combine a couple of constructions I've found on this site to create a custom-defined cases
environment so that each case will:
- be nested within a larger
theorem
environment; - end with a
qedsymbol
without needing aproof
environment; and - use a custom
qedsymbol
consisting of the boxed case name.
That sounds like a lot, so let me make this more precise.
I'd like the general form of my document to be as shown in this MWE:
\documentclass{article}
\usepackage{amsthm,xpatch}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\newtheoremstyle{underline}% name
{-1.5mm} % Space above, empty = `usual value'
{} % Space below
{} % Body font
{\parindent} % Indent amount (empty = no indent, \parindent = para indent)
{} % Thm head font
{:} % Punctuation after thm head
{1.5mm} % Space after thm head: \newline = linebreak
{{\underline{\thmname{#1}\thmnumber{ #2}~\thmnote{(#3)}}}} % Thm head spec
\theoremstyle{underline}
\newtheorem{case}{Case}
\begin{document}
\begin{thm}
Here is a theorem.
\end{thm}
\begin{proof}
Consider the following two cases:
\begin{case}
Case 1 is...
\end{case}
\begin{case}
Case 2 is...
\end{case}
As the preceding cases show, we've proven something!
\end{proof}
\end{document}
As written, that renders as follows:
What I'd like to do is to enhance this MWE by combining two separate SxE posts, namely:
- Using this solution, I want to end each instance of
case
with aqedsymbol
without requiring the addition of\begin{proof}...\end{proof}
; and - using this solution, I want to recognize that
case
is nested and to change theqedsymbol
mentioned previously to be boxed versions ofCase 1
,Case 2
, etc.
The desired end result would render something like this:
. For the record, the solution of the first linked question has the form
% redefine the \@endtheorem macro
\makeatletter
\def\@endtheorem{\qed\endtrivlist\@endpefalse } % insert `\qed` macro
\makeatother
(note that I'm trying to use the amsthm
solution), and the solution of the second linked question has the form
\makeatletter
\let\qed@empty\openbox % <--- change here, if desired
\def\@begintheorem#1#2[#3]{%
\deferred@thm@head{%
\the\thm@headfont\thm@indent
\@ifempty{#1}
{\let\thmname\@gobble}
{\let\thmname\@iden}%
\@ifempty{#2}
{\let\thmnumber\@gobble\global\let\qed@current\qed@empty}
{\let\thmnumber\@iden\xdef\qed@current{#2}}%
\@ifempty{#3}
{\let\thmnote\@gobble}
{\let\thmnote\@iden}%
\thm@swap\swappedhead
\thmhead{#1}{#2}{#3}%
\the\thm@headpunct\thmheadnl\hskip\thm@headsep
}\ignorespaces
}
\renewcommand{\qedsymbol}{%
\ifx\qed@thiscurrent\qed@empty
\qed@empty
\else
\fbox{\scriptsize\qed@thiscurrent}%
\fi
}
\renewcommand{\proofname}{%
Proof%
\ifx\qed@thiscurrent\qed@empty
\else
\ of \qed@thiscurrent
\fi
}
\xpretocmd{\proof}{\let\qed@thiscurrent\qed@current}{}{}
\newenvironment{proof*}[1]
{\def\qed@thiscurrent{\ref{#1}}\proof}
{\endproof}
\makeatother
(requiring only amsthm
and xpatch
).
Is this possible?
ntheorem
. – Bernard Apr 2 '16 at 21:46