I want a code that can provide a link (ref) to a theorem with text which follows these conditions:

1.) If the theorem have a name (like \begin{theorem}[name]\end{theprem}), the text will be name Theorem.

2.) Otherwise, the text will be Theorem 1.1. (the number of the theorem).

I will be very gladful if someone can write me that code. Thank you.


Here is a way (as far as I understood the question):

\newtheorem{theorem}{Theorem}[section]%added section after edit and picture
\newtheorem{mytheorem}{\thname{} Theorem}

\section{Test Section}
\begin{mtheorem}[Some Other]


enter image description here

|improve this answer|||||
  • Edited the code but not the screenshot in order to have theorem within section... ie 1.1, 1.2 etc – koleygr Aug 11 '19 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.