5

The following MWE works fine:

\documentclass{book}
\usepackage{makeidx}
% \usepackage[greek,english]{babel}
\makeindex
\begin{document}
\frontmatter
foo\index{foo}
\mainmatter
\printindex
\end{document}

But if I uncomment the \usepackage[greek,english]{babel} I get an error (even though the MWE doesn't contain any Greek text). My .idx file has changed from

\indexentry{foo}{i}

to

\indexentry{foo}{{\fontencoding  {OT1}\selectfont  i}}

and the .ilg file says

!! Input index error (file = test.idx, line = 1):
   -- Illegal space within numerals in second argument.

How can I get rid of the unwanted font encoding?

The document was compiled with latexmk (with the default options) in TexLive 2016.

1
6

Christian Hupfer's comment gives Does a current workaround for babel and indexing Roman-numeral page numbers exist? as an answer, but since I never want to use Roman numerals in Greek text, just restoring the LaTeX definition of \@roman after babel has "enhanced" it also works:

\documentclass{book}
\usepackage{makeidx}

\makeatletter
\let\save@roman\@roman
\usepackage[greek,english]{babel}
\let\@roman\save@roman
\makeatother

\makeindex
\begin{document}
\frontmatter
foo\index{foo}
\mainmatter
\printindex
\end{document}

The same idea would also work for \@Roman, of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.