1

I'm writing a text with many index entries:

Variable $\Kappa$\index{Kappa@$\Kappa$} is used to ...

I'd like to see a hint in the main text, that an entry was added to the index. I tried using \renewcommand, but it didn't work:

\usepackage[toc]{glossaries}
%\renewcommand{\index}[1]{\index{#1}\textbf{GY}}
\renewcommand{\index}{\textbf{GY}\index}
\makeglossaries

Is there an easy way to show a hint in the main text, that an index entry was added?

  • 1
    The problem in using \index in the redefinition of \index is that it is self-referential in a way that can't break out of the loop. – Steven B. Segletes Oct 31 '13 at 15:09
  • Your question doesn't have anything to do with glossaries, so I'm not sure why you have added it to your example. (Indexing can be done via glossaries, but not via \index.) – Nicola Talbot Nov 2 '13 at 14:18
2

I'm not sure how to use glossaries, but perhaps this will work:

\documentclass{article}
\usepackage[toc]{glossaries}
\let\svindex\index
\def\index{\textbf{GY}\svindex}
\makeglossaries
\begin{document}
Variable $\kappa$\index{kappa@$\kappa$} is used to ...
\end{document}

In this case, a copy of the original \index is stored in \svindex. Then, the redefinition of \index calls upon the stored copy of the original, rather than calling upon itself in an endless loop.

I can get away without specifying the argument list to \index, because \svindex is the very last thing the redefinition does. In this way, it will find its arguments waiting for it in the input stream, even though I haven't specified how those arguments should be structured.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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