# How to stop index letter headers being at the bottom?

I have a (three column) index with letter headers at the start of each alphabetic set of entries. In some cases the letter headers are at the bottom and the following entries start at the top of the next column. I would like the letter header to be in the same column as (the start of) the alphabetic entries; either shifted to the head of the next column of the following entry shifted below the header. The following is my .ist file for the output style parameters for MakeIndex.

% glisterb.ist MakeIndex style file for Glister Book

% @ may be a valid character in some entries
actual '?' % ? instead of @

% output main entry as: \item \idxmark{<entry>}
item_0 "\n\\item \\idxmark{"
delim_0 "}, "
% not forgetting the subitem case
item_x1 "} \n \\subitem "

% Wrap and uppercase head letters
headings_flag 1
heading_prefix "\\doidxbookmark{"
heading_suffix "}"


and \doidxbookmark is defined as

 \makeatletter
\newcommand{\doidxbookmark}[1]{{\def\@tempa{Symbols}\def\@tempb{#1}%
\centering\bfseries \ifx\@tempa\@tempb %
Analphabetics
\phantomsection%
%    \pdfbookmark[0]{Analphabetics}{Analphabetics-idx}%
\else
#1%
\phantomsection%
%    \pdfbookmark[0]{#1}{#1-idx}%
\fi%
\vskip\onelineskip\par}}


I am calling the index via

\usepackage[columns=3]{idxlayout}
...
\printindex


I know that it is preferable that I provide a full MWE but the problem doesn't show until the fourth page of the index. Do you really need all the code to get to there? I think that my problem could be solved by an adjustment to the headings codes in glisterb.ist.

• \nopagebreak before the \vskip ? Mar 16 '20 at 20:01
• If \nopagebreak doesn't do the job, then \needspace should work; I'd try it with 2.5\baselineskip to start, and experiment from there. Mar 17 '20 at 0:45
• @DavidCarlisle Thank you, the \nopagebreak worked. Do you want to make that an answer? I also tried instead putting \@afterheading at the end, which improved things but still left one infelicity in the output. Mar 17 '20 at 18:06

## 1 Answer

You can prevent a page break at he the space by using \nopagebreak before the \vskip.