Yes, I want exactly the same thing as in this question. However, I'm trying to get rid of the following three issues with repeatindex/afterpage:

  1. afterpage causes loathsome small vertical space after the second entry in the column.
  2. repeatindex does not work if index entries contain commands.
  3. My solution for the second issue works incorrectly with entries that have only subentries.

I don't know what really causes the first issue, but it's definitely afterpage. Its doc says that it does not work in two-column mode, so it kinda justifies this, but anyway... I've tried doing something like

% ...
\newcommand{\metaitem}[2]{\item #1 #2\relax\AfterFix}

and then putting \gdef\AfterFix{\vskip-1234pt\ResetAfterFix} into what afterpage should output, but it seems that afterpage expands and lays out its 'aftertext' after the first couple of lines on the second page, so the \AfterFix is applied at the wrong place.

repeatindex appears to have a solution for this expansion issue (see \@entry and \@@entry) but I failed to adapt it to my case.

I don't really understand how afterpage works by delaying the output, but I also suspect its \baselineskip 'faking' in \addboxcontents as the cause of the issue.

I've circumvented the second issue by ditching the empty continuation checks from repeatindex which were expanding the contents:

% Reset afterpage contents

% This will be put at the top of the page

% Continuation label

% These commands are output by index-preparing program
    \item #1 #2
    \gdef\index@cont{#1\relax\ \indexcont}% Store what will be repeated
    \ResetAfterPage{}% And prevent repeating it without any following \subitems
    \subitem #1 #2
    \subsubitem #1 #2

The third issue has to do with the entries like

   bar, 12
   baz, 42

which result into

foo (cont.)
   bar, 12
   baz, 42

if this happens at the top of the column. I believe it has to do something with afterpage again: it appears to be tricked by LaTeX into thinking that foo was left behind, but then LaTeX puts it onto the next page. However, I doubt this is a correct explanation as this happens regardless of the entry length or something, but the page numbers after the item do matter.

I've circumvented this by making the index preparer to output \ResetAfterPage{} after the first subitem of items without pages , but this is hardly an elegant solution.

Your Answer

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

Browse other questions tagged or ask your own question.