3

We all know that "restatable" package can help repeat theorems in exactly the same format. However, what I need is to restate a theorem while changing its name in the parentheses. For example, the original theorem displays like "Theorem 1 (Name Here)"; later when I restate it, I want "Theorem 1 (Restated)." Is it possible to achieve that?

I noticed that in the document of "thmtools" there is a parameter called "restate". But there was not enough explanation and I do not know how to use it.

Thanks for any help!

1

1 Answer 1

3

thmtools provides an environment called restatable with the following syntax

\begin{restatable}[theorm-title]{envname}{commandtorestate}
<some text>
\end{restatable}

On page 7 of the documentation we have to following example

\documentclass{article}

\usepackage{thmtools, thm-restate}
\declaretheorem{theorem}

\begin{document}

\begin{restatable}[Euclid]{theorem}{firsteuclid}
\label{thm:euclid}%
For every prime $p$, there is a prime $p'>p$.
In particular, the list of primes,
\begin{equation}\label{eq:1}
2,3,45,7,\dots
\end{equation}
is infinite.
\end{restatable}

\firsteuclid*
\vdots
\firsteuclid*

\end{document}

which produce the following

enter image description here

If I understand you correctly, the following patch is what you want

\documentclass{article}

\usepackage{thmtools,thm-restate}
\declaretheorem{theorem}

\usepackage{regexpatch}
\makeatletter
\xpatchcmd\thmt@restatable{%
\csname #2\@xa\endcsname\ifx\@nx#1\@nx\else[{#1}]\fi
}{%
\ifthmt@thisistheone
\csname #2\@xa\endcsname\ifx\@nx#1\@nx\else[{#1}]\fi
\else
\csname #2\@xa\endcsname[{Restated}]
\fi}{}{}
\makeatother


\begin{document}
    
    \begin{restatable}[Euclid]{theorem}{firsteuclid}
        \label{thm:euclid}%
        For every prime $p$, there is a prime $p'>p$.
        In particular, the list of primes,
        \begin{equation}\label{eq:1}
            2,3,45,7,\dots
        \end{equation}
        is infinite.
    \end{restatable}
    
    \firsteuclid*
    \vdots
    \firsteuclid*
    
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .