0

In the code below, I use starred theorems through some macros and commands.

\documentclass[]{article}
\usepackage[english]{babel}
\usepackage{amssymb,amsthm,amsmath,xparse}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{thmtools, thm-restate}

\newcommand{\starBool}{0} 
\newcommand{\starCommand}{\if\starBool1{ $(\footnotesize{\bigstar})$}\fi}
\makeatletter
\def\thmhead@plain#1#2#3{%
    \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2\starCommand}}%
    \thmnote{{\the\thm@notefont (#3)}}}
\let\thmhead\thmhead@plain
\makeatother
\newcommand{\starToggle}{\if\starBool0{\gdef\starBool{1}}\else{\gdef\starBool{0}}\fi}
\newtheorem{theorem}{Theorem}

\begin{document}

\section{Main part of the paper}

Proofs of theorems marked with a $\star$ are moved to the appendix.

\starToggle
\begin{restatable}{theorem}{AB}
    $A \subseteq B$.
\end{restatable}
\starToggle

\begin{theorem}
    $B \subseteq A$.
\end{theorem}

\begin{proof}
    Trivial.
\end{proof}

\appendix
\section{Details of the proofs}

\AB*

\begin{proof}
    Knuth told me by text message.
\end{proof}

\end{document}

I'd like to create a new environment called starTheorem, which would be simpler to use then the above code. Below, I've tried to do just that.

\documentclass[]{article}
\usepackage[english]{babel}
\usepackage{amssymb,amsthm,amsmath,xparse}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{thmtools, thm-restate}

\newcommand{\starBool}{0} 
\newcommand{\starCommand}{\if\starBool1{ $(\footnotesize{\bigstar})$}\fi}
\makeatletter
\def\thmhead@plain#1#2#3{%
    \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2\starCommand}}%
    \thmnote{{\the\thm@notefont (#3)}}}
\let\thmhead\thmhead@plain
\makeatother
\newcommand{\starToggle}{\if\starBool0{\gdef\starBool{1}}\else{\gdef\starBool{0}}\fi}
\newtheorem{theorem}{Theorem}
\newenvironment{starTheorem}[1]
{\starToggle
    \begin{restatable}{theorem}{#1}
    }
    { 
    \end{restatable}
\starToggle
}

\begin{document}

\section{Main part of the paper}

Proofs of theorems marked with a $\star$ are moved to the appendix.

\begin{starTheorem}{AB}
    $A \subseteq B$.
\end{starTheorem}

\begin{theorem}
    $B \subseteq A$.
\end{theorem}

\begin{proof}
    Trivial.
\end{proof}

\appendix
\section{Details of the proofs}

\AB*

\begin{proof}
    Knuth told me by text message.
\end{proof}

\end{document}

But I get the error "File ended while scanning use of \thmt@collect@body" instead. Any way to fix this?

2
  • 1
    The restatable theorems collects its whole content. Replace \begin{restatable} and \end{restatable} respectively by \restatable and \endrestatable. Note that \footnotesize shouldn't be used in math mode and you are surely getting warnings about that.
    – campa
    May 13 at 13:59
  • @campa this worked, you can put it in an answer
    – J. Schmidt
    May 13 at 14:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.