0

I have a theorem-like environment, examples that always will include an enumerate within its body. Using cleveref, how can I refer to the entire environment (i.e., all the enumerated items) with plural name 'Examples' yet refer to an individual item within it with the singular name 'Example'? (And a range of items within it again using the plural name 'Examples'?)

Example source:

\documentclass[12pt]{memoir}

\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{enumitem}

\usepackage[colorlinks=true,linkcolor=red]{hyperref}
\usepackage[nameinlink,noabbrev,capitalize]{cleveref}

\swapnumbers

\declaretheoremstyle[
  headfont= \sffamily\bfseries,
  headpunct={\sffamily\bfseries.},
  postheadspace=0.5em,
  notefont=\sffamily\bfseries,
  headformat=\NAME\NUMBER\let\thmt@space\@empty\NOTE,
  bodyfont=\mdseries\itshape,
  spaceabove=12pt,spacebelow=12pt
]{thmstyle}

\theoremstyle{thmstyle}% default
\declaretheorem[name=Theorem,numberwithin=chapter]{theorem}

\declaretheoremstyle[
  headfont= \sffamily\bfseries,
  headpunct={\sffamily\bfseries.},
  postheadspace=0.5em,
  notefont=\sffamily\bfseries,
 bodyfont=\normalfont,
 spaceabove=12pt,spacebelow=12pt
]{defstyle}

\theoremstyle{defstyle}
\newtheorem{examples}[theorem]{Examples}

\newlist{parensenum}{enumerate}{3}
\setlist[parensenum,1]{%
  label= \upshape(\arabic*),
  ref={\arabic*}, % strips formatting!
}

\crefname{examples}{Examples}{Examples}
\Crefname{examples}{Examples}{Examples}
\crefname{parensenumi}{}{}
\crefformat{parensenumi}{(#2#1#3)}
\Crefformat{parensenumi}{(#2#1#3)}

\begin{document}

\chapter{Chapter}

\section{Section}

\large % for visibility in posting 
\begin{examples}\label{exs:several-exs}

\begin{parensenum}
\item\label{ex:one}      First example.
\item\label{ex:two}      Second example.
\item\label{ex:three}   Third example.

\end{parensenum}

\end{examples}

\textbf{References}

\begin{itemize}

\item  \cref{exs:several-exs}.  [OK as is.]

\item \cref{exs:several-exs} \cref{ex:two}. [Want singular ``Example'' in hyperlink.]

\item \crefrange{ex:two}{ex:three}.  [Want hyperlink: Examples 1.1 (2)--(3).]

[Can do this too verbosely as: \cref{exs:several-exs} \cref{ex:two}--\cref{ex:three}.]

\end{itemize}

\end{document}

Output
Defective singular/plural crefs

Question(s)

My primary question is how to torture cref, or otherwise, so as to get the reference to a single item in the enumerated list within the examples environment to use singular "Example" instead of "Examples", while still keeping the plural "Examples" in the reference to the entire examples environment.

(If I must use the verbose form indicated to obtain a reference to a range of items in the enumerated list, that's OK — although I would prefer not to have to do that.)

If it makes a solution possible, or even significantly easier, I'm willing to give up the nameinlinks option to cleveref.

  • 3
    I would really like to encourage you to come up with a better way to distinguish verbally between instances of "Examples" as theorem-like environments and "Example"/"Examples" as enumerated items with examples environments. Otherwise, there will be a non-negligible risk that both you and your readers will be hopelessly confused as to what a given instance of the string "Examples" may refer to. – Mico Apr 23 '17 at 15:56
  • 3
    Both, I suppose. Your readers are almost certainly going to choke if they come across an expression such as "As illustrated by Examples (1) and (2) in Examples 3.4 ..." . Do you really expect them to keep track of the two different meanings of the plural word "Examples"? – Mico Apr 23 '17 at 16:34
  • 2
    In addition 'Examples 1.1' sounds ungrammatical to me. To make it grammatical, you'd have to say something like 'Set of examples 1.1' so that the singular 'Set' makes the reference sound OK. Compare 'Subsections 1` where you mean the three subsections in section 1. You need 'Section 1' or 'Subsections 1,1, 1,2 and 1,3' or 'the subsections in Section 1' or something similar. You can't use 'Subsections 1' to mean that and have it sound OK. (And it doesn't mean that, of course, so it isn't just how it sounds.) – cfr Apr 28 '17 at 1:30
  • 1
    @murray But you want 'Examples 1.8', say, which sounds equally ungrammatical. That is, 'Examples 1.1' is not OK as it is, as far as the grammar is concerned. And if you didn't want the plural there, you wouldn't have the problem of distinguishing the cases. – cfr Apr 28 '17 at 22:49
  • 1
    Still sounds wrong to me. '1.8 Examples', sure, but not 'Examples 1.8'. A set is singular. Just because something has parts, doesn't make the thing itself plural. The collection is singular. 'A network of nodes' but the network is singular. '1.8' contains examples, but it is not itself an instance of 'examples'. – cfr Apr 29 '17 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.