# Defining a double star (**) for theorem environment

This is a follow-up question of QED symbol after statements without proof, and I am really not sure whether this is the right approach to solve the problem raised there. But it seems to solve all situations I encounter perfectly, so I will try...

The theorem environment has the usual version with numbering and a *'ed version without numbering. I would now like to have another **'ed (or something similar) version that puts something around the theorem environment.

Here is what I currently need to do:

\documentclass{amsart}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\begin{document}
\begin{proof}[\unskip\nopunct]
\begin{theorem}
$e^{2\pi i} = 1$. \qedhere
\end{theorem}
\end{proof}

\begin{proof}[\unskip\nopunct]
\begin{corollary}[{myref}]
The expression $e^{2\pi i} - 1$ equals $0$. Moreover, there is more text to actually add here. \qedhere
\end{corollary}
\end{proof}
\end{document}


and I want to avoid adding the \begin{proof}[\unskip\nopunct] and the \end{proof} myself, but get this automatically using a double star in both situations.

It might actually be better to interchange the order of the proof and the theorem environment, so a solution that provides that version would also be appreciated!

That is

\begin{myXYZ**}[...]
...
\end{myXYZ**}


(with myXYZ defined as a theorem environment in the header) should simply translate into

\begin{proof}[\unskip\nopunct]
\begin{myXYZ}[...]
...
\end{myXYZ}
\end{proof}


Is this (or the ** replaced with something else, independent of using theorem or lemma or proposition) possible?

• Have you tried \newenvironment{theorem**}[]{\begin{proof}[\unskip\nopunct]\begin{theorem}[#1]}{\end{theorem}\end{proof}}? – Werner Oct 18 '16 at 19:29
• This does not seem to behave like the usual theorem environment with only having adding a proof environment around. More immportantly, I would actually also want this to be independent of theorem but it should work equally well with lemma and any other theorem-like environment in the very same way without having to define it for each of these independently. – Christian Oct 18 '16 at 19:35
• How about providing the foundation to start from in the form of a minimal example that shows your setup, including the expected output (even if you have to hard-code it). – Werner Oct 18 '16 at 19:38
• @Werner: I am not sure it is clearer now, but I tried to add a mwe. – Christian Oct 18 '16 at 19:57
• I'm not sure what you're about. Doesn't the \addqed macro I proposed do the job without any additional proof environment around? One might add a further abstraction layer, but I don't think that \newtheorem{theorem}{Theorem}\addqed{theorem} is so long to type. Besides it was your request not to define environments with an additional *. – egreg Oct 18 '16 at 21:13

Maybe this solves your problem. I define a \varnewtheorem command with the same syntax as \newtheorem, but that creates four variants for each label we call. So with \varnewtheorem{foo}{Foo} we create the four environments

• foo (theorem, proof follows)
• foo* (unnumbered theorem, proof follows)
• foo+ (theorem, no proof)
• foo*+ (unnumbered theorem, no proof)

The syntax accepts the optional arguments as usual.

\documentclass{amsbook}
\usepackage{amsthm}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\varnewtheorem}{momo}
{
\IfValueTF{#4}
{\newtheorem{#1}{#3}[#4]}
{
\IfValueTF{#2}
{\newtheorem{#1}[#2]{#3}}
{\newtheorem{#1}{#3}}
}
\newtheorem*{#1*}{#3}
\newenvironment{#1+}
{\pushQED{\qed}\begin{#1}}
{\popQED\end{#1}}
\newenvironment{#1*+}
{\pushQED{\qed}\begin{#1*}}
{\popQED\end{#1*}}
}
\ExplSyntaxOff

\varnewtheorem{theorem}{Theorem}[chapter]
\varnewtheorem{proposition}[theorem]{proposition}

\begin{document}

\chapter{Test}

\begin{theorem}
A standard theorem statement
\end{theorem}

\begin{theorem*}
A standard unnumbered theorem statement
\end{theorem*}

\begin{theorem+}
A theorem statement without proof
\end{theorem+}

\begin{theorem*+}
An unnumbered theorem statement without proof
\end{theorem*+}

\begin{proposition}
A standard theorem statement
\end{proposition}

\begin{proposition*}
A standard unnumbered theorem statement
\end{proposition*}

\begin{proposition+}
A theorem statement without proof
\end{proposition+}

\begin{proposition*+}
An unnumbered theorem statement without proof
\end{proposition*+}

\end{document} • Many thanks, I really like this solution, I will use this and the one by @Werner to see which seems more natural to use. – Christian Oct 19 '16 at 7:26

For each \newtheorem{X}, you can call the below function \doublestarenv{X} to create an X** environment: \documentclass{amsart}

\newcommand{\doublestarenv}{%
\newenvironment{#1**}[]
{\proof[\unskip\nopunct]
\csname #1\endcsname[##1]}
{\csname end#1\endcsname
\endproof}%
}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}

\doublestarenv{theorem}
\doublestarenv{corollary}

\begin{document}

\begin{proof}[\unskip\nopunct]
\begin{theorem}
$e^{2\pi i} = 1$. \qedhere
\end{theorem}
\end{proof}

\begin{proof}[\unskip\nopunct]
\begin{corollary}[{myref}]
The expression $e^{2\pi i} - 1$ equals $0$. Moreover, there is more text to actually add here. \qedhere
\end{corollary}
\end{proof}

\begin{theorem**}
$e^{2\pi i} = 1$. \qedhere
\end{theorem**}

\begin{corollary**}[{myref}]
The expression $e^{2\pi i} - 1$ equals $0$. Moreover, there is more text to actually add here. \qedhere
\end{corollary**}

\end{document}


You can automate this process by updating \newtheorem to automatically execute \doublestarenv:

\newcommand{\doublestarenv}{%
\newenvironment{#1**}[]
{\proof[\unskip\nopunct]
\csname #1\endcsname[##1]}
{\csname end#1\endcsname
\endproof}%
}

\usepackage{xparse}

\let\oldnewtheorem\newtheorem
\RenewDocumentCommand{\newtheorem}{ m o m o }{%
\IfValueTF{#2}
{\edef\x{\noexpand\oldnewtheorem{#1}[#2]{#3}}}
{\IfValueTF{#4}
{\edef\x{\noexpand\oldnewtheorem{#1}{#3}[#4]}}
{\edef\x{\noexpand\oldnewtheorem{#1}{#3}}}%
}%
\x\doublestarenv{#1}%
}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}

• Many thanks, this solution is closer to the actual question, but the outcome seems to be basically the same as in @egreg's solution. I will play with both to see which seems more natural to use. – Christian Oct 19 '16 at 7:26
{"ft_lang_label":"__label__en","ft_lang_prob":0.8630032,"math_prob":0.95527685,"size":2241,"snap":"2020-34-2020-40","text_gpt3_token_len":591,"char_repetition_ratio":0.14528386,"word_repetition_ratio":0.0,"special_character_ratio":0.24899599,"punctuation_ratio":0.10075567,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9989025,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,4,null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-11T16:55:08Z\",\"WARC-Record-ID\":\"<urn:uuid:584cdde1-1cad-4987-8040-ab656439a1cf>\",\"Content-Length\":\"166562\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d2db968d-f6e1-4621-ad9a-f29ada9c1bd7>\",\"WARC-Concurrent-To\":\"<urn:uuid:e9c109b3-aae8-4675-8099-7311c8eba6bd>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/334688/defining-a-double-star-for-theorem-environment\",\"WARC-Payload-Digest\":\"sha1:LT5VORVS7BV6NP4Z2MBQVVDEPL2RE7UZ\",\"WARC-Block-Digest\":\"sha1:TO53JMMB6JNVEJMQO4EJSZSMTHUY2S6L\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439738816.7_warc_CC-MAIN-20200811150134-20200811180134-00337.warc.gz\"}"}