我知道,在 LaTeX 中,可以标记方程式。因此,方程式没有编号。相反,它们被分配一个任意字符串,然后每当引用方程式时,该字符串就会出现。我想做同样的事情,但使用定理环境。
以下是我想写的内容:
\begin{myspecialtheoremenvironment}
\tag{TheoSPC}
\label{mytheorem}
Statement!
\begin{proof}
Proof!
\end{proof}
\end{myspecialtheoremenvironment}
As one can see from Theorem \ref{mytheorem}, statement is true!
获得如下结果:
Theorem TheoSPC. Statement!
Proof. Proof!
As one can see from Theorem TheoSPC, statement is true!
有可能实现这样的事吗?
答案1
假设你不想让这个定理计数器踩到,一个选择是使用thmtools
' 内部\thmt@suspendcounter
命令。我已将其实现为tag
用作定理的可选参数的关键。
\documentclass{article}
\usepackage{amsthm,thmtools}
\newtheorem{theorem}{Theorem}
\makeatletter
\thmt@define@thmuse@key{tag}{%
\thmt@suspendcounter{\thmt@envname}{#1}%
}
\makeatother
\begin{document}
\begin{theorem}[tag=TheoSPC]
\label{mytheorem}
Statement!
\begin{proof}
Proof!
\end{proof}
\end{theorem}
As one can see from Theorem \ref{mytheorem}, statement is true!
\end{document}