Is there a command that expands to the current section name (which I can then use with \index{})?
This is similar to Name of current section/figure, but I like to get the name of the section instead of the current type, also \nameref{} doesn't work when using index. I tried
\label{sec:foo} \index{\nameref{sec:foo}}
which will show the current section name in Index, but it's out of order with the other non-\nameref{} Index entries. I believe that's because they are hyperlinked.
\let\oldsection\section,\def\section#1#{\sectionii{#1}}\def\sectionii#1#2{\def\currsecname{#2}\oldsection#1{#2}}to your preamble; then in each section\currsecnameholds the name of the current section. – Bruno Le Floch Feb 13 '12 at 13:06