I'm playing a bit with TeX's leaders and ran into a problem I don't understand. Given the following example code:
\documentclass{article}
\begin{document}
\def\bul{%
\begingroup
\setbox0=\hbox to 10pt{\hss\textbullet\hss}%
\skip0=\wd0 plus 0.5\wd0 minus 0.5\wd0
% \skip0=10pt plus 5pt minus 5pt % the same as above
\cleaders\box0\hskip\skip0
\endgroup
}
1: \fbox{\hbox to 30pt{\null\hskip13pt\bul\hskip13pt\null}} okay, too few space
2: \fbox{\hbox to 30pt{\null\hskip10pt\bul\hskip10pt\null}} okay, space fits exactly
3: \fbox{\hbox to 30pt{\null\hskip7.5pt\bul\hskip7.5pt\null}} okay, maximum stretch
\medskip
4: \fbox{\hbox to 30pt{\null\hskip11pt\bul\hskip11pt\null}} wrong, still enough space left
5: \fbox{\hbox to 30pt{\null\bul\null}} wrong, too many bullets
\end{document}
\bul
should, as I understand, output at most one \textbullet
centered across the available space if there's some free horizontal space of 5pt up to 15pt. Here's the result:
On the first line there's only 4pt left, so no bullet occurs. On line 2 the bullet can take its natural width and fits exactly once. On the third line it needs to stretch to its maximum width. Those cases are fine. The ones I don't understand are on the next two lines.
Line 4 should leave a space of 8pt in which a bullet can fit quite comfortably. No bullet occurs, though. Why?
The opposite problem is on line 5. Here the maximum stretch is exceeded, hence TeX gives an underfull \hbox
warning. But why does it output three boxes?
Section 9.3.3 of TeX by Topic explicitly states that you should use \copy
with the various leaders commands to make sure the box register is not empty after it has been used first. Actually, this is exactly the effect I want to achieve, which is why I used \box
. The output still has three bullets.
Could anyone explain why that is happening (and also how to fix it)?