[Tex/LaTex] Italicise index entry

indexingitalic

I am making an index using makeidx.

Is the following not okay? This does not work for me.

\index{Brazil!\textit{subentry text}}

The same without italics (\index{Brazil!subentry text}) works fine.

Best Answer

The sort order of the subentries will be wrong likely, because \textit is included in the sort string. The @-notation can be used to specify a sort key without markup commands:

\documentclass{article}
\usepackage{makeidx}
\makeindex

\begin{document}
\null
\index{Brazil!aaa}
\index{Brazil!zzz}
\index{Brazil!\textit{wrong entry}}
\index{Brazil!subentry text@\textit{subentry text}}
\printindex
\end{document}

Commands:

pdflatex test
makeindex test
pdflatex test

Result

Related Question