3

A similar question was asked in How do I repeat a theorem number? with a really awesome answer by Andrew Stacey. However, it requires amsthm to use \newtheorem, thus theorem amsthm style (name normal) and not llncs style (name bold). When I change \newtheorem*{rep@theorem}{\rep@title} to \spnewtheorem*{rep@theorem}{\rep@title}{\bfseries}{\itshape} I get error on undefined \rep@title.

Also, there is a similar question How do I repeat a theorem number with the llncs class?, however, the answer by egreg does not allow me to restate with varying text, which is what I need to achieve. (I think restatable environment from thm-restate seems to work for me for this use-case).

Thanks!

1 Answers1

4

The llncs class uses an approach different from amsthm, therefore the other solution is not applicable.

Add the following lines to your preamble:

\newcommand\repeatedtheorem[2]{%
  \expandafter\let\expandafter\repeatedtheoremtmp\csname#1name\endcsname
  \expandafter\def\csname#1name\endcsname{%
    \repeatedtheoremtmp\ \ref{#2}%
    \global\expandafter\let\csname#1name\endcsname\repeatedtheoremtmp
  }
}

To repeat the number of a theorem, you have to do the following things.

  • Define an unnumbered version of your theorem environment. E.g., if you want to recall/preview a theorem, add the following line to your preamble:

    \spnewtheorem*{theorem*}{Theorem}{\normalshape\bfseries}{\itshape}
    

    This will define an environment theorem* that looks like the theorem environment, but without numbers.

  • Add a label to the theorem whose number you want to reuse, say \label{myAmazingTheorem}.

  • At the place where you want to preview/recall the real theorem (with the number given there), use the unnumbered version \begin{theorem*}...\end{theorem*}.

  • Immediately before this unnumbered theorem, tell LaTeX to use the number of the real theorem by adding the line

    \repeatedtheorem{theorem*}{myAmazingTheorem}
    

enter image description here

\documentclass[envcountsect]{llncs}
\spnewtheorem*{theorem*}{Theorem}{\normalshape\bfseries}{\itshape}
\newcommand\repeatedtheorem[2]{%
  \expandafter\let\expandafter\repeatedtheoremtmp\csname#1name\endcsname
  \expandafter\def\csname#1name\endcsname{%
    \repeatedtheoremtmp\ \ref{#2}%
    \global\expandafter\let\csname#1name\endcsname\repeatedtheoremtmp
  }
}
\begin{document}

\section{Preview} \repeatedtheorem{theorem}{myAmazingTheorem} \begin{theorem}[just a preview] My amazing theorem that we will discuss later. \end{theorem*}

\begin{theorem} An unnumbered theorem. \end{theorem}

\section{The real thing} \begin{theorem}[The Amazing Theorem] \label{myAmazingTheorem} A theorem \end{theorem}

\end{document}

gernot
  • 49,614