TransWikia.com

How to limit the number of page numbers in one line of an index?

TeX - LaTeX Asked by user280391 on May 22, 2021

Index excerpt
I’m using PDFLaTeX and makeidx to compile an index for a book. Some of the index entries have many page numbers associated. The first line includes so many page numbers that there is no space, or in this case, dots between the entry name and the first page number. See the image.

I’d like to limit the number of entries such that there is some minimum amount of space between the entry name and the first number – say, at least 3 dots. Or I’d like to have an even distribution of page numbers across the first line and next wrapped line. Or any good solution that provides more space.

I tried to decrease the size of the indentation in the IST file, but it didn’t work.

My IST file looks like this:

%MakeIndex style style file IndexStyle.ist

% Reduce size of indent from default '16' to '8' - to try prevent page numbers squashing against entry name
indent_length 0
indent_space "t"

% Big letter for Index headings
heading_prefix "{bfserieshfil "                  % Insert in front of letter
heading_suffix "hfil}nopagebreakn"              % Append after letter
headings_flag    1                                   % Turn on headings (uppercase)

% Add dots between entry and page numbers
delim_0 "dotfill "
delim_1 "dotfill "
delim_2 "dotfill "

One Answer

LaTeX defines dotfill as:

defdotfill{%
  leavevmode
  cleaders hb@xt@ .44em{hss.hss}hfill
  kernz@}

The problem here is that hfill can have a minimal width of 0 which isn't what you want.

So, you can change your .ist file to use, e.g., mydotfill instead of dotfill and then define mydotfill as:

defmydotfill{%
  leavevmode
  cleaders hbox to .44em{hss.hss}hskip 1em plus1fill
  kern 0pt}

and this will ensure that you have at least 1em of leader dots.

Answered by Don Hosek on May 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP