Capitalization of index entries

Herbert Voss Herbert.Voss at fu-berlin.de
Sun Mar 15 22:16:24 CET 2020



Am 15.03.20 um 22:03 schrieb Djones9976 via texhax:
> I completed a manuscript for a book making entries for words I wanted 
> to index using the command \index{xxxxx} or \index{Xxxxx} if I wanted 
> to capitalize the word in the index.  Now I find that the generally 
> accepted rule is to capitalize all words whether they are capitalized 
> in the text or not.   Is there a way that I can correct all my 
> \index{xxxxx} entries to read \index{Xxxxx} without changing them one 
> by one?
>

\documentclass{article}
\usepackage{makeidx}\makeindex
\let\myIndex\index
\makeatletter
\renewcommand\index[1]{\index at i#1\@nil}
\def\index at i#1#2\@nil{\myIndex{\MakeUppercase{#1}#2}}
\makeatother
\def\foobar{foobar}% only for demo
\begin{document}

foo\index{foo \foobar} bar\index{a nice bar} baz\index{Baz}

\printindex
\end{document}


More information about the texhax mailing list.