TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I am trying to mark places in my document automatically (for later bookmarking). I defined a counter nops and my marking macro should be like this: \newcommand{\nop}{\addtocounter{nops}{1}\hypertarget{nop\value{nops}}{}}, but it seems that this is not the correct way to do it, since a bookmark like \bookmark[dest=nop3]{third occurrence} always just brings me to the title page.

I assume this is a more general problem like 'how to use commands where text is expected' but I don't know enough about latex to properly classify it. Someone more knowledgeable may change the title and tags (seems I can't create any meaningful tags like 'counter value hypertarget name' or 'dynamic bookmarks' for this anyhow).

share|improve this question
up vote 4 down vote accepted

With \value{nops}, you get the internal representation of the counter (\c@nops) instead of its actual value which you can get e.g. with \arabic{nops} as an arabic number. So your definition must be


to make your bookmarks work.

share|improve this answer
Thanks, it works. That was easy. So when would I use \value? – peter Apr 30 '11 at 20:46
I found it out while preparing and thereby obsoleting my next question: mathematics.nsetzer.com/latex/latex_for_loop.html. – peter Apr 30 '11 at 20:59

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.