I use hyperrefs extensively in my document and I define them like this:

\hyperref[label]{some text \ref*{label}}

It's really annoying that I need to repeat the label twice. Is it possible to parameterize the content of {} with contents of []?

I'd like to achieve something like this:

\hyperref[label]{some text \ref*{#1}}

I guess it is possible if you define your own command, but the question is if it is possible to do that without defining any commands.

  • 3
    \newcommand{\myref}[2]{\hyperref{#1}{#2 \ref*{#1}} Aug 9, 2015 at 14:04
  • Yes, that's a possible solution but I pointed out that I don't want creating a new command. Aug 9, 2015 at 14:06

1 Answer 1


It is not possible in general. TeX does not provide such kind of access. Also this will not work for expandable macros. A definition of a macro, which contains the argument would destroy the expandability, because a definition is not expandable.

In this case, \hyperref is not expandable anyway, thus the latter argument does not apply. The label form with the optional argument \hyperref[<label>]{...} is implemented internally by macro \label@hyperref, which can be redefined to remember the label argument by a macro, e.g. \arglabel:


  \org@label@hyperref[{#1}]% or \org@label@hyperref[\arglabel]%



You must log in to answer this question.

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