# \pfill probably conflicting with other commands or packages

Friends, I'm stuck with the following issue: I have a document with several indices. The splitidx package deals with them with no problems. It happens that I have some very long index entries, so I decided to make them look more aesthetic:

Styling very long index entries to look more aesthetic

lockstep provided an amazing solution that works like a charm. This solution works in my other documents. Unfortunately, when I try to use it in my "production document", it does not work. egreg suggested me to reduce my document to a minimal example, so here it is. Thankfully it still does not work:

% since the first example was full of "package noise",
% I left only the needed ones.
\documentclass[12pt,oneside]{book}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{savesym}

\usepackage[useindex]{splitidx}
\savesymbol{newindex}
\makeindex
\orignewindex[My custom index]{stl}
\AtWriteToIndex{stl}{\let\thepage\thesongnum}

\usepackage{idxlayout}
\usepackage[lyric]{songs}

\newindex{reltitleidx}{cbreltitle}

\begin{document}

\showindex{{\normalfont\bfseries My songs index}}{reltitleidx}

\begin{songs}{reltitleidx}

\beginsong{Funny song}[by={},sr={}]

\sindex[stl]{Cool@\textbf{Cool}!Stuff}

\beginchorus
This is my chorus.
\endchorus

\beginverse
Verse 1.
\endverse

\beginverse
Verse 2.
\endverse

\beginverse
Verse 3.
\endverse

\endsong

\end{songs}

\printindex*

\end{document}


Any help is really appreciated.

EDIT 1: I forgot to mention. \pfill seems to raise the errors. If I remove it from my ist style file, the document is successfully compiled.

There are the commands: pdflatex mydocument.tex, splitindex mydocument.idx, makeindex -s mystyle.ist mydocument-stl.idx, pdflatex mydocument.tex.

EDIT 2: Errors raised:

! Undefined control sequence. <recently read> \efill l.4 \item \textbf{Cool}\efill

and

! Undefined control sequence. \pfill ...ll \penalty 500 \strut \nobreak \dotfil ~\ignorespaces l.5 \subitem Stuff\pfill 1

EDIT 3: I owe egreg a drink. The first error is gone! The index is properly generated, but this annoying error still bugs me:

! Undefined control sequence. \pfill ...ll \penalty 500 \strut \nobreak \dotfil ~\ignorespaces l.5 \subitem Stuff\pfill 1

EDIT 4: It's now solved, thanks to egreg's fantastic solution. =)

EDIT 5: For completeness sake, my style file is based on gind.ist. Since those commands were not defined in terms of others, the above errors raised. Once you correctly define them, the errors are gone.

-

\pfill is a macro from ltxdoc

\def\pfill{\unskip~\dotfill\penalty500


You might need also \efill:

\def\efill{\hfill\nopagebreak}


\dotfil is defined just as

\def\dotfil{\leaders\hbox to.6em{\hss.\hss}\hfil}

-
Thanks, egreg! But for some reason, it still does not work. Two errors were raised: ! Undefined control sequence. <recently read> \efill l.4 \item \textbf{Cool}\efill and ! Undefined control sequence. \pfill ...ll \penalty 500 \strut \nobreak \dotfil ~\ignorespaces l.5 \subitem Stuff\pfill 1. Did it work for you? – Paulo Cereda Jul 18 '11 at 10:45
Thanks! Now one of the errors is gone! It works (my index is displayed correctly), but this error is still raised: ! Undefined control sequence. \pfill ...ll \penalty 500 \strut \nobreak\dotfil \ignorespaces l.5 \subitem Stuff\pfill 1. Any ideas? – Paulo Cereda Jul 18 '11 at 11:05
What's the undefined control sequence? It's the last in the first line of the error message. – egreg Jul 18 '11 at 11:08
I think it's l.5 \subitem Stuff\pfill. The last line has only a 1. =P – Paulo Cereda Jul 18 '11 at 11:16
Thanks a million! Sorry for the trouble. – Paulo Cereda Jul 18 '11 at 11:22


This is makeindex, version 2.15 [TeX Live 2011] (kpathsea + Thai support).
Scanning input file song.idx...
!! Input index error (file = song.idx, line = 1):
-- Unknown index keyword \indexentry[stl].
done (0 entries accepted, 1 rejected).
Nothing written in song.ind.
Transcript written in song.ilg.


Is this the error you're getting as well?

-
Sorry, I forgot to mention, the four \renewcommand commands are optional. =) I just kept them for testing purposes. The CTAN version of songs is very outdated, the one I use is the last stable one available here. Anyway, I updated my question and put the errors I'm getting. I'm running splitindex then makeindex. The errors seem not to be in those parsers per se (nothing is rejected, and if I keep the default style for makeindex, everything works), but in my source itself. =( – Paulo Cereda Jul 18 '11 at 11:00