2

I want to create lemmas with my own enumeration, e.g. Lemma A.1, A.2, ..., using \newtheorem. However, when compiled and referenced, the number is wrong for what seems a simple reason. LaTeX enumerates by section, but I want my own labeling "A.1" to carry over. How do I force that for any arbitrary labeling? My challenge us I have many such Lemma A.# in a section that cannot be section "A" for easy to explain but space consuming reasons.

Here is a working example of my dilemma. The referenced "Lemma A.1" comes as as Lemma B, but I need it to come out as "Lemma A.1".

\documentclass[12pt]{article}
\usepackage{amsthm}

\newtheorem*{lemmaA1}{Lemma A.1}

\begin{document}

\section{Stuff\label{app:stuff}}

\begin{lemmaA1}\label{lm:11}
We have that $1=1$.
\end{lemmaA1}

Lemma \ref{lm:11} is true.

\end{document}

enter image description here

1 Answer 1

4

You don't want to define a bunch of \newtheorems for each key you need. Moreover, \newtheorem* defined environments don't set a counter, so \label inside them won't work and you'd get a random reference.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\genericname}{}
\newtheorem{generic}{\genericname}

\newenvironment{lemma*}[1]{%
  \renewcommand{\genericname}{Lemma}%
  \renewcommand{\thegeneric}{#1}%
  \generic
}{\endgeneric}

\begin{document}

\begin{lemma*}{A.1}\label{lm:11}
We have that $1=1$.
\end{lemma*}

Lemma~\ref{lm:11} is true.

\end{document}

You may defined other generic based environments.

enter image description here

1
  • That's perfect: thanks so much (I should have reached out about this years ago)!
    – JBH
    Commented Sep 15, 2022 at 19:39

You must log in to answer this question.

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