
No início, quero definir um ambiente de teoremasem número, então tentei o seguinte código:
\LoadClass[a4paper]{article}
\RequirePackage{amsmath,amssymb,amsthm}
\RequirePackage{thmtools}
\declaretheoremstyle[]{testbox}
\declaretheorem[style=testbox,name=Theorem]{theo}
\renewcommand{\thetheo}{} %Cancelling the number
\begin{document}
\begin{theo}
Content.
\end{theo}
\end{document}
Isso funciona bem. Então tentei estendê-lo para
\LoadClass[a4paper]{article}
\RequirePackage{amsmath,amssymb,amsthm}
\RequirePackage{thmtools}
\declaretheoremstyle[]{testbox}
\newcommand{\newtestbox}[2]{
\declaretheorem[style=testbox,name=#1]{#2}
\renewcommand{\the#2}{} %Error
}
\newtestbox{Theorem}{theo}
\begin{document}
\begin{theo}
Content.
\end{theo}
\end{document}
Mas agora parece que isso \the#2
é reconhecido como uma contra-chamada mal formada. Como posso usá-lo corretamente? Me desculpe se a história for muito longa.
Responder1
Use numbered=no
(página 3 do manual do thmtools).
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{thmtools}
\declaretheoremstyle[]{testbox}
\declaretheorem[
style=testbox,
numbered=no,
name=Theorem,
]{theo}
\begin{document}
\begin{theo}
Content.
\end{theo}
\end{document}
Compare com a saída (errada) que você obtém sem, numbered=no
mas com \renewcommand{\thetheo}{}
, ou seja,
Responder2
Você pode dizer:
\LoadClass[a4paper]{article}
\RequirePackage{amsmath,amssymb,amsthm}
\RequirePackage{thmtools}
\declaretheoremstyle[]{testbox}
\newcommand{\newtestbox}[2]{
\declaretheorem[style=testbox,name=#1]{#2}
\expandafter\renewcommand\csname the#2\endcsname{} %Error
}
\newtestbox{Theorem}{theo}
\begin{document}
\begin{theo}
Content.
\end{theo}
\end{document}