TeX - LaTeX Asked by infoshoc on April 30, 2021
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!
The llncs
class uses an approach different from amsthm
, therefore the other solution is not applicable.
Add the following lines to your preamble:
newcommandrepeatedtheorem[2]{%
expandafterletexpandafterrepeatedtheoremtmpcsname#1nameendcsname
expandafterdefcsname#1nameendcsname{%
repeatedtheoremtmp ref{#2}%
globalexpandafterletcsname#1nameendcsnamerepeatedtheoremtmp
}
}
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}{normalshapebfseries}{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}
documentclass[envcountsect]{llncs}
spnewtheorem*{theorem*}{Theorem}{normalshapebfseries}{itshape}
newcommandrepeatedtheorem[2]{%
expandafterletexpandafterrepeatedtheoremtmpcsname#1nameendcsname
expandafterdefcsname#1nameendcsname{%
repeatedtheoremtmp ref{#2}%
globalexpandafterletcsname#1nameendcsnamerepeatedtheoremtmp
}
}
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}
Answered by gernot on April 30, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP