I would like to have two commands \makelabel{foo} and \referlabel{foo} to be used as in the example

 \[ A \overset{\makelabel{foo}}{=} B \overset{\makelabel{bar}}{=} C \]
 where \referlabel{foo} is given by \ldots and \referlabel{bar} is given by \ldots
\[ C \overset{\makelabel{foobar}}{=} D\]
Equality \referlabel{foobar} \ldots

such that the output is the same as for the code

 \[ A \overset{(1)}{=} B \overset{(2)}{=} C \]
 where (1) is given by \ldots and (2) is given by \ldots
\[ C \overset{(3)}{=} D\]
Equality (3) \ldots

That is, the label should be created from a counter. Possibly, \referlabel{foo} should create a hyperlink to \makelabel{foo}. Could you point me to existing solutions or indicate how to implement the commands, please?

1 Answer 1


\makelabel is already a known command, so I've changed the interface to \setlabel/\reflabel:

enter image description here




  A \overset{\setlabel{foo}}{=} B \overset{\setlabel{bar}}{=} C
where~\reflabel{foo} is given by \ldots and~\reflabel{bar} is given by \ldots
  C \overset{\setlabel{foobar}}{=} D
Equality~\reflabel{foobar} \ldots


To avoid a "Multiple \label" error with the loading of amsmath, we use the traditional LaTeX \label macro, stored in \ltx@label.

  • Would it suffice to just use \eqref instead of defining a new \reflabel?
    – Herr K.
    Commented Jan 30, 2015 at 18:48
  • 1
    @KevinC: Since it would syntactically not refer to an equation, but an equality, I kept the interface, even though it should work.
    – Werner
    Commented Jan 30, 2015 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .