[Tex/LaTex] New theorem environment with manual theorem number

amsthmenvironmentsmacrosnewtheoremnumbering

I am wondering how to create a new theorem environment / style which allows me to insert the theorem number manually. That is, I am imagining something like

 \begin{newtheorem}{2.3'}[title]
      This is a theorem.
 \end{newtheorem}

to translate into

Theorem 2.3' (title). This is a theorem.

As a second example,

 \begin{newtheorem}{A}[title]
      This is a theorem.
 \end{newtheorem}

should give

Theorem A (title). This is a theorem.

How would one be able to define such a theorem environment with argument which is (apart from the manual insertion of the "number") identical to the usual theorem environment?

Note, if I add a \label to a theorem of this type, I would like the corresponding \ref command to print the theorem number defined in the argument. That is, in the above example \ref should print 2.3'.

I would be grateful for any help with this! Many thanks in advance!

Best Answer

Quite easy! ;-) 1

\documentclass{article}
\usepackage{amsthm}

\newtheorem{manualtheoreminner}{Theorem}
\newenvironment{manualtheorem}[1]{%
  \renewcommand\themanualtheoreminner{#1}%
  \manualtheoreminner
}{\endmanualtheoreminner}

\begin{document}

\begin{manualtheorem}{2.3'}[title]\label{foo}
This is a theorem.
\end{manualtheorem}

\begin{manualtheorem}{A}[title]\label{baz}
This is a theorem.
\end{manualtheorem}

Here is \ref{foo} and \ref{baz}.

\end{document}

enter image description here


1 Been there, done that.

Related Question