# Wrong vertical position of heading created by \printindex [duplicate]

When compiling the following example, you can see that the heading heading "Index" (created by \printindex) has a different vertical position than the first two headings.

Strangely, it gets better when you comment out the line \KOMAoption{open}{right} although the positioning is still different.

What is the reason for this behavior and how can I fix it?

\documentclass{scrreprt}

\KOMAoption{open}{right}

\usepackage{makeidx}
\makeindex

\begin{document}

\chapter{First Test}
\chapter{Second Test}
\index{test}
\printindex

\end{document}

-

## marked as duplicate by lockstep, Werner, Stefan Kottwitz♦May 7 '12 at 19:37

I have a bit older version of TeXLive and really old versions of KOMA-script. Anyways, the word "Index" is a bit lower on the page than "2 Second Test", even without \KOMAoption{open}{right}. –  yo' Mar 29 '12 at 14:57

The index is set in twocolumn mode, and \twocolumn interferes with \topskip (LaTeX bug 3126). One solution is to load my idxlayout package which uses multicol instead.

(Note: In the process of answering this question, I stumbled upon what seems to be an incompatibility between idxlayout and v3.10a of the KOMA-Script classes -- the automatic loading of the ragged2e package fails. As a workaround, you have to load ragged2e manually.)

EDIT: idxlayout v0.4d, which fixes the mentioned incompatibility, is on its way to CTAN.

\documentclass{scrreprt}

\KOMAoption{open}{right}

\usepackage{makeidx}
\makeindex

\usepackage{idxlayout}
\usepackage{ragged2e}

\begin{document}

\chapter{First Test}
\chapter{Second Test}
\index{test}
\printindex

\end{document}

-
using your idxlayout package solved the problem - thanks! –  boothby81 Mar 30 '12 at 11:52

It seems to be a bug related to the command \twocolumn. If you load the imakeidx package instead of makeidx, the theindex environment will be redefined without \twocolumn and the problem disappears.

-
Using imakeidx worked for me and it also results in a correct vertical alignment of the heading. However, the space inserted between the heading and the first index entry differs from the space between a standard chapter heading and the first line of the following paragraph. That effect didn't show up when using idxlayout therefore I accepted lockstep's answer. –  boothby81 Mar 30 '12 at 11:57
@boothby81 idxlayout sets \multicolsep to 0pt within the theindex environment. –  lockstep Mar 30 '12 at 21:38