Short form: Suppose I have sporadically numbered theorems:
Thm A
Thm 1
Thm B
Code below shows how to force this numbering when printing the Theorems. However, when I refer back to these via \ref
, they still show up as "Thm 1", "Thm 2", "Thm 3", respectively. How to force \ref
to show their displayed titles?
Long form: I devised a way to replicate Serre's numbering of Corollaries by the number of the preceding Lemma / Proposition [see bottom for full code]. For example:
Section 1
Lemma 1.1
Corollary 1.1
Proposition 1
Corollary 1
Section 2
Lemma 2.1
Proposition 2
Lemma 2.2
Corollary 2.2A
Corollary 2.2B
I want to say: by Corollary 2.2A, we win!
Instead, TeX gives: by Corollary 2, we win!
However, the displayed Corollary number does not affect the internal numbering of the Corollary. For example, the first replem corollary (1.1) is internally remembered as Corollary 1, the second one (2.1) as Corollary 2, etc.
Then, when I refer to the corollary in text, I get a reference to the internal number instead. How to modify the internal numbering to match the labeled text?
\documentclass[11pt]{amsart}
\usepackage{amsmath}
\makeatletter
\newtheorem*{rep@theorem}{\rep@title}
\newcommand{\newreptheorem}[2]{%
\newenvironment{rep#1}[2][]{%
\def\rep@title{#2 \ref{##2}##1}%
\begin{rep@theorem}}%
{\end{rep@theorem}}}
\makeatother
\newtheorem{lem}{Lemma}
\newreptheorem{lem}{Corollary}
\newtheorem{Lem}[lem]{Lemma}%*
\numberwithin{lem}{section}
\newtheorem{prop}{Proposition}
\newreptheorem{prop}{Corollary}
\newtheorem{Prop}[prop]{Proposition}
\newtheorem{Cor}{Corollary}%}[lem]{
\newtheorem{cor}[Cor]{Corollary}%*
\begin{document}
\section{asdf}
\begin{lem}\label{lem1}
\end{lem}
\begin{replem}{lem1}\label{cor1}
\end{replem}
\begin{prop}\label{p1}
\end{prop}
\begin{repprop}{p1}\label{cor2}
\end{repprop}
\section{fdsa}
\begin{lem}\label{lem2}
\end{lem}
\begin{prop}\label{p2}
\end{prop}
\begin{lem}\label{lem3}
\end{lem}
\begin{replem}[A]{lem3}\label{cor3}
\end{replem}
\begin{replem}[B]{lem3}\label{cor4}
\end{replem}
By Corollary \ref{cor3}, we win!
\end{document}
One solution is to say: "By Corollary \ref{lem3}
A..." instead of "By Corollary \ref{cor3}
; however, the corollaries tends to move frequently, so I'd like a way to make the reference independent of the actual Lemma.
By Corollary 2, we win!
... Do you have some older TeX distribution, older than April 2015? If so, try\usepackage{fixltx2e}
– user31729 Dec 31 '16 at 21:16By Corrollary 2
orBy Corollary 3
, it's still notBy Corollary 2.2A
, which is what I want. – Alex Dec 31 '16 at 21:20