# [NTG-context] Term "C++" in index

Hans Hagen pragma at wxs.nl
Thu Jul 5 18:45:59 CEST 2007

Duncan Hothersall wrote:
> A long long time ago, Hans said:
>> At 01:55 PM 10/31/2002 +0100, Matthias Heidbrink wrote:/
>>> Hi,
>>>
>>> possibly a trivial question, but can't find it anywhere:
>>>
>>> How do I get the term "C++" into an index? Unfortunately ConTeXT
>>> interprets the "+" as a separator for indexed terms and I did not find a
>>> way to escape it
>>> that did not confuse the index mechanism./
>> \index[&Cplusplus]{C++}
>> \index[Cplusplus]{Cpp}
>>
>> So, the & as started signals texutil that that is the separator
>> + while the plusplus makes sure that the sorting is ok
>>
>> Hans
> The second part of this advice I assume is now just out of date, since
> it will simply produce a second index entry called Cpp. However, the
> first part *almost* works - it outputs an entry "C" with a subentry "+"
> (without the & you can't get a + out at all).
>
> What is the up-to-date workaround for this issue to let me get a single
> entry in the index that just says "C++"?
>
> Minimal test file is as follows:
>
> \starttext
> We are talking about \index[&Cplusplus]{C++}C++, the programming language.
> \placeindex
> \stoptext

\unexpanded\def\CPP{c++}  \index[Cplusplus]{\CPP}

Hans

-----------------------------------------------------------------