1

I know that, in LaTeX, one can tag equations. As a result, equations are not numbered. Instead, they are assigned an arbitrary string that then appears whenever the equation is referenced. I would like to do the same, but with a theorem environment.

Here is something along the lines of what I would like to write:

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

to obtain something along the lines of:

Theorem TheoSPC. Statement!
Proof. Proof!

As one can see from Theorem TheoSPC, statement is true!

Is it possible to achieve anything like this?

4
  • Since theorems are normally numbered and one refers to these numbers, you probably have to explain in more detail what exactly it is you want that are different from what onw normally does. For example what exacly is myspecialtheoremenvironment
    – daleif
    Aug 3, 2020 at 8:01
  • Exactly! Theorems are normally numbered and one refers to those numbers. What I would like is for a theorem to be identified instead by an arbitrary string that I assign it. In the example above, I'd like a theorem to be identified by the string "TheoSPC" instead, e.g., by the number 1. Aug 3, 2020 at 8:52
  • It is more or less the same thing you can do with equations by using the \tag command. But \tag does not seem to work with theorems. Did I explain my problem now? Aug 3, 2020 at 8:54
  • 1
    You may use \begin{theorem}[name]\label{thm:x} (with environment theorem defined with a special theorem style) and then \nameref{thm:x} to get name. \nameref is provided in nameref package, which is also auto-loaded by hyperref. Changing the theorem header by inserting something after \begin{theorem} might need more tricks. Aug 8, 2020 at 23:10

1 Answer 1

1

Assuming you don't want this to step the theorem counter, one option is to use thmtools' internal \thmt@suspendcounter command. I've implemented it as the tag key to be used as the optional argument to a theorem.

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

thm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .