TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The idea is to place \LBL{some_label_name} in a paragraph so that I can refer back to the particular point inside that paragraph where the \LBL was placed. I would like to define the macro for \LBL.

Unfortunately the \label must be placed inside an environment with a counter. I tried phantomsection but the label picks up the true section counter. I'm using the hyperref package.

How can I achieve this, what would the \def for \LBL look like?

share|improve this question
up vote 13 down vote accepted

There are many ways. The following is using \refstepcounter that generates implicitly an anchor. Also instead of a section number \theword is redefined to get the word instead, if called by \ref.


  The \ref{word} is referenced.

  \lipsum*[1] \LBL{word} \lipsum[2]


If the word is complicate that it cannot be used as label name, then the optional argument helps: \LBL[labelword]{weird word}\ref{labelword}.

share|improve this answer
As it turned out, I would need more. Could you please check my new question? – Ali Oct 1 '12 at 21:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.