Take the 2-minute tour ×

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
add comment

1 Answer

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
add comment

Your Answer


