0

I want to reference a proposition and sub-parts of a proposition as well.

screenshot

\documentclass[12pt, a4paper]{book}

\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{prop}{Proposition}

\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}

\usepackage{cleveref}

\begin{document}
\begin{prop}\label{p1}
    Let \(f \colon A \rightarrow B\).
    { \renewcommand\labelenumi{(\theenumi)}
        \begin{enumerate}
        \item A statement about \(f\). \label{p1.1}
        \item Another statement about \(f\). \label{p1.2}
    \end{enumerate}}
\end{prop}
\begin{proof}
We will first prove \cref{p1.1}, then we will prove \cref{p1.2}. We have proved \cref{p1}.
\end{proof}
\end{document}

Now, instead of item 1 and item 2, I want prop. 1(1) and prop. (2). Instead of ?? 1, I want prop. 1. How can I achieve that? Also, is it possible to create hyperlinks on the references so that when I click them, I am redirected? I am using XeLaTeX.

1 Answer 1

1

Does the following help?

\documentclass[12pt, a4paper]{book}

\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{prop}{Proposition}

\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}

\usepackage{enumitem}
\newlist{propenum}{enumerate}{1}
\setlist[propenum,1]{%
  label= \sffamily\upshape(\arabic*), % modfiy as desired!
  ref={\arabic*}, % strips formatting!
}
\usepackage{cleveref}
\crefname{prop}{prop.}{prop.}
\crefname{propenumi}{prop.}{props.}
\crefformat{propenumi}{prop.~(#2#1#3)}

\newcommand\crefproppart[2]{\namecref{#1}~\labelcref{#1}~(\ref{#2})}

\begin{document}

\begin{prop}\label{p1}
    Let \(f \colon A \rightarrow B\). Then:
    %{ \renewcommand\labelenumi{(\theenumi)}
        \begin{propenum}
        \item A statement about \(f\). \label{p1.1}
        \item Another statement about \(f\). \label{p1.2}
    \end{propenum}
\end{prop}

\begin{proof}
We will first prove \crefproppart{p1}{p1.1}, then we will prove \crefproppart{p1}{p1.2}. We have proved \cref{p1}.
\end{proof}

\end{document}

cleveref parts of enumerate in theorem

Adjust spacing as desired in the definition of crefproppart and change formatting in \setlist as needed.

3
  • Thanks. I don't fully understand your code, but your answer works. Commented Sep 12, 2020 at 3:23
  • @ApoorvPotnis: Any particular part of the code giving trouble with understanding it? Are you familiar with the enumitem package? If not, take a look at its documentation (or ask here). Commented Sep 12, 2020 at 17:05
  • I need to read the documentation of both the enumitem and cleveref packages. Commented Sep 14, 2020 at 9:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.