When labelling theorems and such, the label often takes this form :
\label{th:pyth}
So when referring to theorems, we often write :
According to theorem \ref{th:pyth} ...
But there is a little bit of redundancy with "theorem" and "th", so i wanted to create a command that would look like \refenv{th}{pyth}
and that would output theorem 1
.
In order to do that, I would need to match the first argument to a string, so I tried this with the boolexpr
package :
\usepackage{boolexpr}
\NewDocumentCommand{\refenv}{mm}{
\switch
\case{#1 = th} theorem
\case{#1 = prop} proposition
\case{#1 = coro} corollary
\case{#1 = lem} lemma
\case{#1 = prf} proof
\case{#1 = def} definition
\case{#1 = rem} remark
\case{#1 = eq} equation
\endswitch
\ref{#1:#2}
}
Without success, since the boolexpr
package only compares numbers.
How can I find an equivalent that does not require multiple nested ifthenelse
commands?
cleveref
?cleveref
has done the job as I wanted it to.