TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote the following style for makeindex:

headings_flag 1
heading_prefix "{\\bfseries "
heading_suffix "}\\nopagebreak\n"
delim_0 " \\dotfill "
delim_1 " \\dotfill "
delim_2 " \\dotfill "

which works pretty good. It happens that I have some very long index entries, and their display is not what I expected. This is a MWE:




Hello again.\index{Hello again}
Hi there.\index{Hello there, this is a very long text here}

When I run makeindex mwe.idx -s mystyle.ist, this is the output:

Index 1

To be honest, I was expecting something like this:

Index 2

I tried to find some help on styles in The LaTeX Companion book, but I could not assimilate much. I'm relying on the belief that I could solve this by using a proper ist file.

Any ideas?

share|improve this question
up vote 9 down vote accepted

Your belief is correct -- use the style file gind.ist.

EDIT: Or try to change your custom file mystyle.ist as follows:

headings_flag 1
heading_prefix "{\\bfseries "
heading_suffix "}\\nopagebreak\n"
item_x1   "\\efill \n \\subitem "
item_x2   "\\efill \n \\subsubitem "
delim_0   "\\pfill "
delim_1   "\\pfill "
delim_2   "\\pfill "
share|improve this answer
Thanks, lockstep! But for some reason, when I try to compile it again, it raises ! Undefined control sequence. l.3 \makeatletter\scan@allowedfalse. Do I need to set anything else? – Paulo Cereda Jul 17 '11 at 20:59
Sadly, for some reason, it didn't work. I'm gonna try it again and see if I discover what's happening in my (La)TeX kingdom. =) – Paulo Cereda Jul 17 '11 at 21:07
Found it! There's a nice explanation in this comp.text.tex thread: "gind.ist is meant to be used with the class ltxdoc. It requires certain macros only defined in doc.sty (loaded by ltsdoc.cls)." I'll study those macros and see if I can come up with something. =) – Paulo Cereda Jul 17 '11 at 21:19
Don't worry, my friend. =) We both learned something new about gind.ist. Your new solution works like a charm, thanks! – Paulo Cereda Jul 17 '11 at 21:23
@swiper: I fixed an error in the makeindex line, it should be mwe.idx instead of mwe.tex as stated previously. That said, I had problems with \efill and \pfill myself, but this answer helped me a lot. – Paulo Cereda Jul 26 '11 at 18:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.