I was getting "The control sequence at the end of the top line" referring to \leavevmodeifvmode for all my entries in an .ind file. Each entry of \indexentry in the idx file is translated to
\item \emph {{\textendash }\leavevmodeifvmode \kern .5em \textnormal {something }, 11,22
in the .ind file.
Since I could not find any reference to leavevmodeifvmode I guess this relates to leavevmode@ifvmode which seems to be a new definition from 2018/12/01 Function and usage of \leavevmode.
The related lines in preamble are:
\RequirePackage[texindy]{imakeidx}
\makeindex[intoc, name=title, title={Index: Titles}, columns=1, options=-M title -C utf8 ]
I could fix the problem temporarily by doing something like this:
\begin{filecontents*}{title.xdy}
(require "tex/inputenc/utf8.xdy")
(require "texindy.xdy")
\begin{theindex}
\makeatletter
\providecommand*\leavevmodeifvmode{\leavevmode@ifvmode}
\makeatother
....
\end{filecontents*}
However, I guess there is a problem with in translating \indextermto the correct lines (whether by xindy or imakeidx ?). Is this a problem to wait for a bug fix or I wrote something wrong (sorry, not easy to make a MWE)
edit
An MWE (I had to involve biblatex as the index is populated by biblatex, so now I think a suspect might be biblatex):
\documentclass{article}
\usepackage{filecontents}
\usepackage[texindy]{imakeidx}
\usepackage[
style=numeric-comp,
autocite = superscript,
indexing=true,
backend=biber,
sorting=none
]{biblatex}
\begin{filecontents}{\jobname.bib}
@book{Knu86,
author = {Knuth, Donald E.},
year = {1986},
title = {The \TeX book},
}
\end{filecontents}
\bibliography{\jobname.bib}
\begin{filecontents*}{title.xdy}
(require "tex/inputenc/utf8.xdy")
(require "texindy.xdy")
(require "page-ranges.xdy")
(require "book-order.xdy")
(markup-index :open "~n
\begin{theindex}
% \makeatletter
% \providecommand*\leavevmodeifvmode{\leavevmode@ifvmode}
% \makeatother
\providecommand*\lettergroup[1]{%
\textit{#1}
\nopagebreak
}
~n"
:close "~n~n\end{theindex}~n"
:tree)
\end{filecontents*}
\indexsetup{level=\section*,toclevel=section}%
\makeindex[intoc, name=title, title={Index: Titles}, columns=1, options=-M title -C utf8 ]
\DeclareIndexFieldFormat{indextitle}{%
\usebibmacro{index:title}{\index[title]}{{\textendash}\enspace\textnormal{#1}}}%
\renewbibmacro*{citeindex}{%
\ifciteindex%
{\indexnames{labelname}%
\indexfield{indextitle}%
\indexfield{maintitle}% booktitle
\indexfield{booktitle}% booktitle
}{}%
}
\renewbibmacro*{bibindex}{%
\ifbibindex%
{\indexnames{author}%
\indexnames{editor}%
\indexnames{editora}%
\indexnames{editorb}%
\indexnames{editorc}%
\indexfield{indextitle}}%
{}
}
\DeclareCiteCommand{\supercite}[]%
{\usebibmacro{cite:init}%
\let\multicitedelim=\supercitedelim
\iffieldundef{prenote}
{}
{\BibliographyWarning{Ignoring prenote argument}}%
\iffieldundef{postnote}
{}
{\BibliographyWarning{Ignoring postnote argument}}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}}
\begin{document}
For test \autocite{Knu86}.
\printindex[title]
\end{document}
Note: look at the title.ind at this line:
\item m {}book\emph {{\textendash }\leavevmodeifvmode \kern .5em \textnormal {The T\kern -.1667em\lower .5ex\hbox {E}\kern -.125emX\spacefactor \m {}book}}, 1