# Index and newcommand

I have a short question about indexing.

Is it possible that latex automatically creates an entry in the index, when I first use a notation fixed by \newcommand?

• Your question is not very clear. Could you give an example? In general, introducing notation into your publications by \newcommand is a good idea especially because it allows to bind index or glossary entries to it. Mar 23 '12 at 14:53
• Dear S.Lehmke, that is exactly what i intended to do. Mar 23 '12 at 16:35

You can create your own command (called \notation here) to do this.

\documentclass{article}
\usepackage{makeidx}
\usepackage{mathabx} %For the \rip symbol
\makeindex
\begin{document}
\notation{\tomb}{$\rip$}
After shooing them, I buried the bodies in a \tomb.
\printindex
\end{document}


Note that this creates the index entry when the command is defined, rather than upon its first use.

• Thank you, though I can not yet upvote;) Mar 23 '12 at 16:24
• I'd use \newcommand instead of \def. Mar 23 '12 at 16:51
• Sadly, this does not work with amsbook. Mar 23 '12 at 16:56
• @user12882: for amsbook simply delete (or comment out) the line \usepackage{makeidx}. Mar 23 '12 at 17:22
• No I tried this as well - no error message, but no index in pdf file as well;( Mar 23 '12 at 17:26