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

once I asked in Insert key words & key phrases into toc whether it is possible to insert some keywords in the toc that it looks like this:


1 section .............................1

key word 1 - key phrase 2 - key word 3

    1.1 subsection ...............................5

    key word 1 - key phrase 2 - key word 3 -

    key word 4 - key phrase 5 - key word 6

egreg provided this answer which works perfectly well:




\newcommand{\keyword}[1]{\@bsphack\keywordstoks=\expandafter{\the\keywordstoks\kwsep#1} \@esphack}
\newrobustcmd{\kwsep}{~-- }




Abc \keyword{key1} def \keyword{key2}


Ciao \keyword{key3} ciao \keyword{key4}




Now my question: Is it possible to hyperref-ize the keywords?

share|improve this question
It depends on what you want these hyperlinks do. – egreg Jul 27 '11 at 6:38
they should behave like the hyperlinked toc. If you press the cursor on the keyword in the toc, the document should "jump" to the corresponding position in the text. – Philip Jul 27 '11 at 7:16
up vote 2 down vote accepted

Change the definition of \keyword into

share|improve this answer
Thank you! Once again you helped me very much! – Philip Jul 27 '11 at 13:03

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.