I'm using htlatex to create an ebook.
For some customization reasons, I need to use imakeidx instead of makeidx. Additionally, some of my index entries are using \textit{}, e.g. \index{\textit{example}}.
This works fine with standard latex. But with htlatex, it's a problem. Specifically, for the index I need to run:
tex '\def\filename{{doc}{idx}{4dx}{ind}} \input idxmake.4ht'
and it's getting tripped up by the \textit{} in the index entry. The error message is:
! Undefined control sequence.
l.1 \indexentry{\textit
{example}}{1}
Here is an MWE:
\documentclass{book}
\usepackage{imakeidx}
\makeindex
\begin{document}
An \textit{example}\index{\textit{example}}.
\printindex
\end{document}
The commands I'm using to process this are:
htlatex doc "xhtml,charset=utf-8" " -cunihtf -utf8"
tex '\def\filename{{doc}{idx}{4dx}{ind}} \input idxmake.4ht'
makeindex -o doc.ind doc.4dx
htlatex doc "xhtml,charset=utf-8" " -cunihtf -utf8"
If I change imakeidx to makeidx, it works. But, I need to use imakeidx.