Command to uppercase the first letter of each word in a sentence
\documentclass{article}
\usepackage{makeidx}\makeindex
\newcommand*{\formatfirst}[1]{\MakeUppercase{#1}}
\makeatletter
\newcommand*{\mymacro}[1]{%
\expandafter\formatfirst\expandafter{\@car #1\@empty\@nil}%
\@cdr #1\@empty\@nil}
\newcommand*\myMakeUpperCase[1]{%
\def\@myuppercasewords{\myuppercase@i#1 \@nil}%
{\itshape\@myuppercasewords}\index{#1@\@myuppercasewords}}
\def\myuppercase@i#1 #2\@nil{%
\mymacro{#1}%
\ifx\\#2\\%
\else
\@ReturnAfterFi{%
\space
\myuppercase@i#2\@nil
}%
\fi}
\long\def\@ReturnAfterFi#1\fi{\fi#1}
\makeatother
\begin{document}
foo
\myMakeUpperCase{capital letter} bar
\myMakeUpperCase{Next one} baz
\myMakeUpperCase{two words}
\printindex
\end{document}
The mfirstuc
package from the glossaries
bundle provides the handy \capitalisewords
command which could be used here. I adapted Herbert's example and the output is the same:
\documentclass{article}
\usepackage{mfirstuc}
\usepackage{makeidx}\makeindex
\makeatletter
\newcommand*\define[1]{%
\textit{#1}%
\index{#1@\protect\capitalisewords{#1}}%
}
\makeatother
\begin{document}
foo
\define{capital letter} bar
\define{Next one} baz
\define{two words}
\printindex
\end{document}
I am not sure if I understand your question correctly, but a short macro as shown below, will capitalize the first word you type and place it in the index.
\documentclass[11pt]{article}
\usepackage{index}
\makeindex
\begin{document}
\def\Index#1{\def\x##1##2{\MakeUppercase{##1}{##2}}\textit{\x#1} \index{\x#1}}
\Index{alpha}
\def\indeX#1#2{\def\x##1##2{\MakeUppercase{##1}{##2}}\x#1 \index{\x#2}}
\Index{alpha}
\indeX{test}{this}
\printindex
\end{document}