0

Let us say I have defined the following theorem environments:

\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}

Now, I would like the counter for each type of theorem to be prefixed with a letter (specifically, the first letter of the environment name). So, for example, I would like the 4th corollary to be displayed as: Corollary C.4. I also want that, when I reference the theorem, the letter is included in the hyper reference to the theorem.

I have tried simply defining:

\newtheorem{corollary}{Corollary C.}

but there is a sizeable space between the C. and the counter.

Is there a neat way to achieve the above?

3
  • 3
    \renewcommand{\thecorollary}{C.\arabic{corollary}} should do it.
    – Bernard
    Jul 5, 2021 at 11:45
  • @Bernard That worked thank you, feel free to write it down as an answer. If I may ask a subsidiary question, I just noticed when implementing your solution that any label for an equation written inside a theorem environment seems to be overridden by the theorem's label itself when I reference it: e.g. if labelled equation (7) is inside labelled theorem T.2, when I reference (7) the compiled PDF is actually displaying T.2. Can I avoid this? Seems it was happening before too, I just hadn't noticed it. Jul 5, 2021 at 11:56
  • Could you post a minimal example reproducing this problem, so we can play with it and try to see what happens?
    – Bernard
    Jul 5, 2021 at 12:06

1 Answer 1

2

Following Bernard's comment:

\documentclass{article}
\usepackage{amsthm}

\newtheorem{corollary}{Corollary}

\renewcommand{\thecorollary}{C.\arabic{corollary}}

\begin{document}

\begin{corollary} \label{cor:lab}
Some text
\begin{equation}\label{eqnA}
a=b
\end{equation}
\end{corollary}

Now let's reference corollary \ref{cor:lab} and equation \ref{eqnA}.
\end{document}

corollary

You must log in to answer this question.

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