# first letter uppercase in index

I am currently using the following index:

\documentclass[a4paper,11pt,twoside, openleft]{book}

\definecolor{DarkDarkPurple}{RGB}{63, 22, 59}

\usepackage{imakeidx}
\newcommand{\boldindex}[1]{\textcolor{DarkPurple}{\textbf{#1}}\index{#1}}
\makeindex[intoc]

\begin{document}

\boldindex{Test}\\
\boldindex{tEst}\\
\boldindex{teSt}\\
\boldindex{tesT}

\printindex

\end{document}


How am I able to have index every word starting with an uppercase letter, while holding a lowercase in the text?

• So you want that all those entries are treated as if they were “Test” and so indexed? Jul 8 at 10:11
• @egreg I would like it to have it in my index as: Test, TEst, TeSt, TesT Jul 8 at 10:12

Please, make compilable examples: the definition for DarkPurple is missing and the openleft option does not exist for book.

\documentclass[a4paper,11pt,twoside]{book}
\usepackage{xcolor}
\usepackage{imakeidx}

\makeindex[intoc]

\ExplSyntaxOn
\NewDocumentCommand{\boldindex}{m}
{
\textcolor{DarkPurple}{\textbf{#1}}
\index{\char_titlecase:N #1}
}
\ExplSyntaxOff

\colorlet{DarkPurple}{purple} % ???

\begin{document}

\boldindex{Test}
\boldindex{tEst}
\boldindex{teSt}
\boldindex{tesT}

\printindex

\end{document}


Of course this will not work if the first letter is a composite character.