マクロを呼び出すときにパラメータを含めるにはどうすればいいですか?

マクロを呼び出すときにパラメータを含めるにはどうすればいいですか?

まず、定理環境を定義したいと思います番号なしそこで、次のコードを試しました。

\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}

うまくいきました。それから、それを拡張してみました

\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}

しかし、今ではそれは不完全なカウンターコールとして認識されているようです\the#2。どのようにすれば適切に使用できるのでしょうか? 話が長くなりすぎたらすみません。

答え1

使用方法numbered=no(thmtools マニュアルの 3 ページ)。

\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}

ここに画像の説明を入力してください

numbered=noを使わずに を使った場合の(間違った)出力と比較すると\renewcommand{\thetheo}{}

ここに画像の説明を入力してください

答え2

次のように言うことができます:

\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}

関連情報