9

I have something that looks like this:

\usepackage{amsmath}
\begin{document}
\begin{thm}
The following are true:
\begin{enumerate}
\item \label{foo} Foo
\item \label{bar} Bar
\item \label{baz} Baz
\end{enumerate}
\end{thm}

Refer to Theorem \ref{bar}

\end{document}

Right now, the reference to bar shows up as Theorem 1. I want it to show up as Theorem 1.2. Is there any way to do that? To give a sub-numbering to each label within a theorem?

1 Answers1

12

I agree with Jubobs comment: using "Theorem 1.2" is very likely to be confusing.

Here's how one might do:

\documentclass{article}
\usepackage{enumitem}

\newenvironment{thmenum} {\begin{enumerate}[label=\upshape(\arabic),ref=\thethm(\arabic)]} {\end{enumerate}}

\newtheorem{thm}{Theorem}

\begin{document} \begin{thm} The following are true: \begin{thmenum} \item \label{foo} Foo \item \label{bar} Bar \item \label{baz} Baz \end{thmenum} \end{thm}

Refer to Theorem \ref{bar}

\end{document}

I'd give the items a distinctive numbering, so that it will be clearer that "Theorem 1(2)" refers to statement 2 in theorem 1.

enter image description here

Edit for feature request

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}

\NewDocumentCommand{\refprefix}{m}{% \ifinproofref\else #1\fi } \newif\ifinproofref \newcommand{\proofref}[1]{\begingroup\inproofreftrue\ref{#1}\endgroup}

\newenvironment{thmenum} {\begin{enumerate}[label=\upshape(\arabic),ref=\refprefix{\thethm}(\arabic)]} {\end{enumerate}}

\newtheorem{thm}{Theorem}

\begin{document} \begin{thm} The following are true: \begin{thmenum} \item \label{foo} Foo \item \label{bar} Bar \item \label{baz} Baz \end{thmenum} \end{thm} \begin{proof} \proofref{foo} is easy. \proofref{bar} is not difficult and immediately proves also~\proofref{baz}. \end{proof}

Refer to Theorem~\ref{bar}

\end{document}

The format of the ref is made so \thethm can be omitted. You have to use \proofref when referring to the item.

enter image description here

egreg
  • 1,121,712