Restate theorem without final sentence

amsthmtheoremsthmtools

I am short on space for my paper, so I want to put some theorem proof in appendix, but I also want to put the sentence saying "Proof in appendix" on the same line as the theorem statement.

\documentclass{article}
\usepackage{amsthm,thmtools}
\declaretheorem[name=Theorem]{thm}

\begin{document}

\section{Body}
\begin{restatable}[Goldbach's conjecture]{thm}{goldbach}
\label{thm:goldbach}
Every even integer greater than 2 can be expressed as the sum of two primes.
{\em (Proof in appendix)}
\end{restatable}

\newpage\appendix

\section{Appendix}
\goldbach*

\begin{proof}
It is trivial.
\end{proof}

\end{document}

What I get:

wig

What I want:

wiw

What should I do?

Thank you for your help.

Best Answer

\IfRestatementTF{<true>}{<false>} will leave <true> when it's used in a restatement, and <false> otherwise. Be careful to only use it in thmtools-defined theorems, since its implementation is not so robust.

\documentclass{article}
\usepackage{amsthm,thmtools}
\declaretheorem[name=Theorem]{thm}

\makeatletter
\newcommand\IfRestateTF{%
  \ifx\label\thmt@gobble@label % or just compared to \@gobble
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\makeatother

\begin{document}

\section{Body}
\begin{restatable}[Goldbach's conjecture]{thm}{goldbach}
\label{thm:goldbach}
Every even integer greater than 2 can be expressed as the sum of two primes.
\IfRestateTF{This is restatement.}{This is the original statement. \emph{(Proof in appendix)}}
\end{restatable}

%\newpage
\appendix

\section{Appendix}
\goldbach*

\begin{proof}
It is trivial.
\end{proof}

\end{document}

enter image description here

Related Question