I have a long document with lots of index entries defined like \index{Surname!Name}
, and I've decided that for one particular purpose, I would like the index formatted as if I had written \index{Surname, Name}
throughout, but I don't particularly want to edit each use of the \index
. Is there a strategy for doing this? In case it's relevant, I'm using imakeidx
and XeLaTeX.
I don't think a MWE really adds anything, but it seems to be expected all the same:
\documentclass{article}
\usepackage{imakeidx}
\usepackage[columns=1]{idxlayout}
\makeindex
\begin{document}
John\index{Smith!John} and William Smith\index{Smith!William}
were brothers. Jack Jones\index{Jones!Jack} is another person.
\printindex
\end{document}
What I want is for the index to read
Jones, Jack, 1
Smith, John, 1
Smith, William, 1