I've defined a C++ symbol in latex as \CC, which works fine:

\newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}}

However, I'd also like to include it in my index. I'm currently just using \index{\CC}, but this puts the entry for C++ at the start of the index (presumably because it's a symbol):

C++ appearing first in index

I'd like to instead preserve the alphabetical order of the C in the index. How can I achieve this?

  • 2
    Try \index{C++@\CC} – Nicola Talbot Aug 20 '14 at 12:43
  • @NicolaTalbot Thanks, that did the trick! If you post as an answer I'll accept it. – berry120 Aug 20 '14 at 12:48

You can override the default sort key using the @ specifier:


This tells makeindex to sort according to C++ but to use \CC in the index.


You could simplify this repetitive indexing by redefining your C++-command:

  C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}%
  \nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}%

Then you will just write \CC and have it indexed every time.

  • 2
    That'll save you keystrokes, but, depending on the type of document, it may sacrifice the quality of the index a bit. – Brent.Longborough Aug 20 '14 at 16:23

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.