I'm trying to write a macro that puts subequations' labels in parentheses in a compact form. For example, if I have
\begin{subequations}
\begin{align}
y - ax &= b \label{subeq1}\\
x^2 + y^2 &= r^2 \label{subeq2}
\end{align}
\end{subequations}
with the two equations being tagged as (1a) and (1b), then I want to be able to type \ref{subeq1,subeq2}
and get (1a,b). Similarly, if I have three subequations, say (2a), (2b) and (2c) with labels subeq3
, subeq4
and subeq5
respectively, then I want to be able to type \ref{subeq3,subeq4,subeq5}
and get (2a--c). I would like this to work for any number of subequations.
cleveref
packagecleveref
package, but I don't think it can do what I'm asking.