# Italicise index entry

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.

• \index{Brazil!\textit{subentry text}} works for me, so I've deleted my first comment. You should say what does not work then! – user31729 Aug 1 '15 at 23:28
• Doesn't work in what sense? Do you get an index entry but non-italicised? An error? (Which?!) No entry? Partial entry? Also, since it works in general, we need you to provide a small document which we can copy-paste-compile to reproduce the problem (whatever it is). Without understanding the problem, we can't suggest a solution. So 'Is the following not okay?' gets the answer 'No, it's fine.' Now what? Help make it not work for us ;). – cfr Aug 2 '15 at 0:01

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