I want to redefine by hand a "restatable" environment for theorems. I have to do so because for some obscure reason the jloganal
class (for the Journal of Logic and Analysis) mess it up: when restated, theorems have a new number corresponding to the section they are restated in. The journal suggests to "fake the environment" and rewrite it entirely. I do not like this "solution". By the way, this exercise is a good occasion to improve my Latex skills.
Here is an attempt:
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{xparse}
\NewDocumentEnvironment{restate}{mmmb}{
\expandafter\xdef\csname #2\endcsname{#4}
\begin{#1}\label{#3}#4\end{#1}
}{}
\newtheorem{thm}{Theorem}
\begin{document}
\begin{restate}{thm}{thmun}{thmlabel}
test-text $\forall x\in\mathbb{R}\quad f(x)=1$
\end{restate}
\thmun
\end{document}
My problem is that \mathbb{R}
leads to an error:
26: Undefined control sequence. \end
26: Undefined control sequence. \end
26: Undefined control sequence. \end
26: Undefined control sequence. \end
27: Missing { inserted. \thmun
: File ended while scanning text of \errhelp.
Also I am looking for a command that would behave like this: \getEnvName{thm}
would write Theorem
.
Thank you for your help.
\NewDocumentCommand{\thirdofthree}{ m m m }{#3} \NewDocumentCommand{\getEnvName}{ m }{\expandafter\expandafter\expandafter\thirdofthree\csname #1\endcsname}
to retrieve Theorem when you issue\getEnvName{thm}
. If you use other theorem-related packages, the process may not work as expected.