Capitalization of index entries

Djones9976 djones9976 at aol.com
Mon Mar 16 17:04:28 CET 2020


Many thanks Herbert, it worked like a charm.    D. W. Jones


-----Original Message-----
From: Herbert Voss <Herbert.Voss at fu-berlin.de>
To: Djones9976 <djones9976 at aol.com>; texhax <texhax at tug.org>
Sent: Sun, Mar 15, 2020 4:16 pm
Subject: Re: Capitalization of index entries



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}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20200316/8b9765f6/attachment.html>


More information about the texhax mailing list.