可重述定理,换行符不同

可重述定理,换行符不同

我有一个使用可重述格式编写的定理。但是,在文本的一部分中,我使用了双列格式,需要在定理中换行。当我在单列部分重述定理时,我希望定理不再使用这些不必要的换行符(见下面的示例)。这可能吗?

\documentclass{article}
\usepackage{amsmath}
\usepackage{thm-restate}

\newtheorem{theorem}{Theorem}[section]

\begin{document}

% the original theorem
\begin{restatable}[My Theorem]{theorem}{labelname}
\begin{multline*}
    \text{some equation too long for one part} \\ \text{overflow stuff}
\end{multline*}
\end{restatable}

% the restated theorem where I no longer want line breaks
\labelname*

\end{document}

答案1

\IfRestatedTF{<true code>}{<false code>}您可以使用 thmtools 条件创建新命令\ifthmt@thisistheone

\documentclass{article}
\usepackage{amsmath}
\usepackage{thm-restate}

\newtheorem{theorem}{Theorem}[section]

\makeatletter
\newcommand{\IfRestatedTF}[2]{\ifthmt@thisistheone #2\else #1\fi}
\makeatother

\begin{document}

% the original theorem
\begin{restatable}[My Theorem]{theorem}{labelname}
\begin{multline*}
    \text{some equation too long for one part} \IfRestatedTF{}{\\} \text{overflow stuff}
\end{multline*}
\end{restatable}

% the restated theorem where I no longer want line breaks
\labelname*

\end{document}

相关内容