7

What is the equivalent construction of

\leaders\hrule height 1pt depth 1 pt\hskip 20pt \relax

in terms of the following construction or something similar

\leaders\hbox{\vrule height 1pt depth 1pt}\hskip 20pt \relax

In the first construction, there is no white gaps between the \hrules but in the second construction, there can be white gaps (horizontally) between the \vrules.

6
  • I suspect the \interlineskip
    – user31729
    Jul 2 '15 at 9:21
  • @ChristianHupfer \lineskip and friends control the vertical space between boxes. The gaps are coming from the algorithm of the used \(c|x|)leaders command. Jul 2 '15 at 9:39
  • @HeikoOberdiek: I thought the O.P. meant vertical gaps. I didn't check it
    – user31729
    Jul 2 '15 at 10:22
  • I suspect this is an XY question. Can you explain what your real aim is?
    – egreg
    Jul 2 '15 at 13:18
  • @egreg: My aim is to get the output of construction 1 using only construction 2. The reason that I want to go with construction 2 is that I have a leaking color issue with construction 1 so I prefer to use the second construction which does not produce leaking color problem.
    – user81070
    Jul 2 '15 at 13:25
8

The first case is \leaders with a rule. The rule can be easily extended to the desired width. The result is just one rule with the specified leaders width.

The second case is a box with fixed dimensions. The width of the box is the default rule width 0.4 pt. Then the space to be filled is filled with the boxes. There are three variants:

  • \leaders sets the boxes at fixed grid position. It is intended for dots in the table of contents, for example. Then no matter, where the dots start, they are always vertically aligned.

  • \xleaders calculates, how many boxes are needed to fill the space without overfilling. Then the space is divided in equal sized segments and the box is horizontally centered. The example below fills the space 20 pt with a box of width 7 pt. Thus two boxes fit in the space and the result is a "dashed" line.

  • \cleaders. Since the "dash" effect of the previous version is sometimes not desirable, \cleaders moves the boxes in the middle and put the remaining unfilled space at both sides of the space to be filled.

Example:

\noindent
\leaders\hrule height 1pt depth 1 pt\hskip 20pt \relax
[rule]

\noindent
\leaders\hbox{\vrule height 1pt depth 1pt width 7pt}\hskip 20pt \relax
[leaders + box]

\noindent
\xleaders\hbox{\vrule height 1pt depth 1pt width 7pt}\hskip 20pt \relax
[xleaders + box]

\noindent
\cleaders\hbox{\vrule height 1pt depth 1pt width 7pt}\hskip 20pt \relax
[cleaders + box]

\bye

Result

3
  • Thanks. Is there any way so that the output of my second construction will look almost like the output of my first construction? (i.e. there is no white gaps in between)
    – user81070
    Jul 2 '15 at 12:55
  • @user81070 -- if you give the rules in boxes a width that is obtained by dividing the width of the \hskip by an integer, the pieced-together segments should combine into a visibly unbroken rule. so, not good for a rule of indeterminate length. Jul 2 '15 at 13:02
  • 1
    LuaLaTeX also supports \gleaders. From the Reference Manual: “This type of leaders is anchored to the origin of the box to be shipped out. So they are like normal \leaders in that they align nicely, except that the alignment is based on the largest enclosing box instead of the smallest. The g stresses this global nature.” Aug 19 '19 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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