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 would like to have a command which empasizes a term (like a definition in a mathematical text) and produces an item for the index (I use makeindex). Ideally the macro should not be too invasive, such that the index can be turned off it this might be desired.

Can you provide me a solution for this task?

share|improve this question
@Martin: I think that it would be more semantic to name the macro something like \keyword for example because what you want to do is to focus one special word. – projetmbc Apr 4 '12 at 19:11
up vote 3 down vote accepted

Here is an example: using the macro \myemph{} causes the word to be added to the index and the regular \emph{} macro is still available and does not add the term to the index.

enter image description here

enter image description here


This is in index: \myemph{foo}

This is not in index: \emph{bar}

share|improve this answer

Or also this, if you prefer:


Now you can use \emph as you wished.

If you want a starred version, this might help (you need the suffix package):



\let\oldemph\emph    % save old \emph
\renewcommand\emph[1]{\oldemph{#1}}    % "new" \emph without star
\WithSuffix\newcommand\emph*[1]{\oldemph{#1}\index{#1}}    % new \emph with a star

  \emph{test} \\   % doesn't get indexed
  \emph*{test2}   % gets indexed
share|improve this answer
But the OP specifically requested that he want to be able to turn this feature off, so perhaps defining \emph* which added to the index would be an option, and the regular \emph would not add it to the index. – Peter Grill Apr 4 '12 at 19:22

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.