I want to show index entries in the margins. Here's what I'm doing:
\documentclass[a4paper, 12pt, twoside]{report}
\usepackage{kantlipsum}
\usepackage{marginnote}
\let\oldmarginnote\marginnote
\renewcommand{\marginnote}[1]{\oldmarginnote{\footnotesize #1}}
\usepackage{makeidx}
\makeindex
\let\oldindex\index
\renewcommand{\index}[1]{\oldindex{#1}\marginnote{\bfseries{#1}}}
\begin{document}
\kant[1]
\index{Kant}
\kant[2]
\index{Kant!Test}
\kant[3]
\index{Kant|textbf}
\kant[4]
\index{Kant|see {blah}}
\kant[5]
\index{Kant|seealso {xyz}}
\kant[6]
\end{document}
This works fine, but not for 'special' index keys: the ones that use the special characters ! and | to indicate special index entries. They're displayed in the margin as well, like so:

Is there a way to not do this, and either:
- Only show the main entry (here always 'Kant')
Somehow get all the different parts of the index (main entry, sub entry, style, see, see also, etc.) separated and use them myself in the margin. This could give something like this in the end:
\marginnote{\bfseries{Main entry} (Sub entry)}
I have seen Mark indexed entries in the text itself? and Visualize index entries in the text? but they don't seem to take care about this.



\marginfont:) – Keelan Apr 02 '15 at 07:56\index{ecole@\'ecole}, and in that case we would want to take everything after the@sign. It's thus somewhat similar to the\splitentryBAR, but not quiet. I don't fully understand your code and can't get it to work... suggestions? Is it possible to also make it work for things likeschool system!grand ecole@grand \'ecole? – Keelan Apr 03 '15 at 12:45