I have an array environment that is used to present inference rules (via a custom command). Now, these inference rules have names and i would like to refer to them using \label and \cref commands. I am guessing this is possible though the details elude me.
As a small example, this is the command:
\newcommand{\typerule}[3]{\ensuremath{\begin{array}{c}\textit{\scriptsize ({#1})} \\#2 \\\hline{\ensuremath{#3}}\end{array}}}
It produces an inference rule with hypotheses (#2), a line, a conclusion (#3), all topped by a name for the rule (#1).
My idea would be to add another parameter and something \label-style related to it, so that in the text later on i can use cleveref's \cref{} and then the name saved in the environment (and the related category name) pop up.
So i would write
\typerule{name}{premise}{conclusion}{labelidentifier}
and somewhere else
The \cref{labelidentifier} does ...
and the produced output should be something like
The rule name does
where rule is generated by cleveref and name is the one i specified previously.
zref-titleref
,\gettitlestring
andnameref
have more to offer.