I'm using \leaders to make a flexible width rule, with the statement \leaders 0pt plus 1fil\hrule, but I also want to put text above this line. \rlap{text}\leaders works fine, except that the text is very close to the line (which isn't very aesthetic). I like the look of \underbar{text}, but I need the line to extend further, so I'm trying to use a more generic \leaders to accomplish this. This can't be done with a \vbox, as far as I can tell because once in a box that is not the one I'm trying to format, the glue doesn't expand as far as I'd like. So, I'm trying to use \lower 2pt\leaders. This fails because \lower requires a box as an argument. I had the thought that this might be improved by using a box, but there still has to be a leader statement for the box to be full size, and I can't find a way to set, for example, \box0, to be this size (which appears impossible because if the box is already constructed, it's inflexible). I've tried both using \lastbox and setting the box directly, but neither works because the box is already constructed.

The final product I imagine will look something like this minimal nonworking example (or maybe it will use a box with depth or another trick):

\line{\hfil\leaders\hbox{\lower2pt\hrule}\hfil}


It appears to me that this doesn't obviously violate any part of the TeX boxes-and-glue model, so I expect that it's possible. How can I construct this?

• Aug 12, 2020 at 15:13
• Something like this? x\makebox[30ex][l]{\leaders\hbox to 1ex{\rule[-1ex]{1ex}{.5pt}}\hfill}x ? Aug 12, 2020 at 15:25
• @StevenB.Segletes I am using Plain TeX, but this appears to be similar the solution I built from answers to from that question: \leaders\vtop{\vskip2in\hrule width 1pt}. Thank you for the reference. Aug 12, 2020 at 15:27

The issue with a construction like \leaders\vtop{\vskip2in\hrule width 1pt} is that leaders behave differently if used with a box instead of a rule: Instead of always filling the full width, you only get full copies of the box. So it is better to stay with a simple rule.
You can't easily \lower a rule, but you can draw it lower fro the beginning. A \hrule by default has height 0.4pt, depth 0pt, so to get a rule 2pt lower, you can use
abc