1

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?

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

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}

enter image description here

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

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.