[Tex/LaTex] Printing index in 2 columns with starting letter before every section

imakeidxindexing

I'm trying to make an index looking like this — 2 columns, starting letter at the beginning of each section:

I tried to use

\usepackage{makeidx}
\makeindex
 .
 .
 .
\printindex

the result looked good since it contained starting letter, but was printed only in one column:

so I tried using this:

\usepackage{imakeidx}
\makeindex[columns = 2]
.
.
.
\printindex

and the index was divided into 2 columns, but starting letters disappeared

Can someone please help me how to make it the way I need?
Thanks a lot.

Best Answer

Just add the starting lines exactly like in the following example:

%%%% A simple MakeIndex style
\begin{filecontents*}{\jobname.mst}
headings_flag 1
heading_prefix "{\\textbf{"
heading_suffix "}}\\nopagebreak\n"
\end{filecontents*}
%%% end

\documentclass{book}

\usepackage{imakeidx}

\makeindex % two column is the default

\begin{document}

Some text

\index{Apple}\index{Apricot}

\index{Banana}\index{Cherry}

\index{Lemon}\index{Lime}

\printindex

\end{document}

enter image description here

Related Question