Saturday, 25 May 2013

Simplify index nested entries

Simplify index nested entries

I want create index nested entries and typeset the indexed word with the same command.
For simple entries like \index{foo} I can solve this with some macro or \index*{foo} or \Index{foo} with the packages index and hvindexrespectively, but the problem is with nested entries like foo!bar where I want type only "bar" and the nested entry in the index.
According to manual of hvindex, this package do just that, but I am unable to obtain any nested entry twith this package in an updated TeXLive 2013. This MWE type correctly "bar" in text but only "bar, 1" as index entry in my computer:
\documentclass{article}
\usepackage[makeidx]{hvindex}
\begin{document}
\Index{foo!bar}
\printindex
\end{document}
Instead, index make the correct nested entry but write "foo!bar" as is in the body text:
\documentclass{article}
\usepackage{index}
\makeindex
\begin{document}
\index*{foo}
\index*{foo!bar}
\printindex
\end{document}

No comments:

Post a Comment