# \declaretheorem with labels rather than numbers that works with cleveref

I use the theorem environment defined by

\declaretheorem[style=definition,name=Property]{property}


to introduce some properties.

\begin{property}[local continuity]\label{lc}
blah blah
\end{property}

\begin{property}[liftable]\label{lift}
blah blah
\end{property}


I'd like to then refer to these properties using cleveref, and so I add

\crefname{property}{Property}{Properties}


and use it via

By some theorem, $\mu$ has \cref{lc} and $\tau$ has \cref{lc,lift}.


Which would then produce output like

By some theorem, $\mu$ has Property 1 and $\tau$ has Properties 1 and 2.

But I'd prefer to be able to associate strings to these properties, such as "LC" and "L", and have TeX output

By some theorem, $\mu$ has Property (LC) and $\tau$ has Properties (LC) and (L).

where LC is then a hyperlink back to the property block defining it. I can fake this by creating a macro, such as \LC and \L, but then I don't get the nice facility that cleveref offers to list multiple properties at once. I prefer these strings to numbers because these properties are literally used everywhere throughout a 50 pages document.

Any suggestions? I'm also happy to hear about more idiomatic ways to do what I'm doing.

• (1) welcome, (2) you will greatly help those able to help you by providing a full minimal example, not just sniplets. That way people trying to help can just copy your example and work with it without having to add anything. – daleif Oct 24 '16 at 16:10
• Using \tag with amsthm environments? may cover similar ground. – Dai Bowen Oct 24 '16 at 22:40
• I guess that the label should read “Property LC”, rather than “Property 1”. – egreg Oct 24 '16 at 22:46

I assume you want the label to be “Property LC” instead of “Property 1”.

The tricks are two: one is defining an inner environment with \declaretheorem and an outer one with a mandatory argument (and the standard optional one following it). This sets the string to be used in the label and for the cross-references.

The second trick is to use \crefformat and\crefmultiformat for adding the parentheses at the cross-references.

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{cleveref}

\declaretheorem[style=definition,name=Property]{propertyINNER}

\newenvironment{property}[1]
{\renewcommand{\thepropertyINNER}{#1}\propertyINNER}
{\endpropertyINNER}
\crefformat{propertyINNER}{Property~#2(#1)#3}
\crefmultiformat{propertyINNER}
{Properties~(#2#1#3)}
{ and~(#2#1#3)}
{, (#2#1#3)}
{ and~(#2#1#3)}

\begin{document}

\begin{property}{LC}[local continuity]\label{lc}
blah blah
\end{property}

\begin{property}{L}[liftable]\label{lift}
blah blah
\end{property}

By some theorem, $\mu$ has \cref{lc} and $\tau$ has \cref{lc,lift}.

\end{document}


If you instead want “Property (LC)” it is easier:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{cleveref}

\declaretheorem[style=definition,name=Property]{propertyINNER}

\newenvironment{property}[1]
{\renewcommand{\thepropertyINNER}{(#1)}\propertyINNER}
{\endpropertyINNER}
\crefname{propertyINNER}{Property}{Properties}

\begin{document}

\begin{property}{LC}[local continuity]\label{lc}
blah blah
\end{property}

\begin{property}{L}[liftable]\label{lift}
blah blah
\end{property}

By some theorem, $\mu$ has \cref{lc} and $\tau$ has \cref{lc,lift}.

\end{document}
`