38

This seems like a simple question ...

I know from this question that \hrule and presumably \hrulefill have a thickness of 0.4pt. I think \hrule is a primitive, so does that mean that you cannot change the thickness of \hrulefill?

StrongBad
  • 20,495

1 Answers1

45

The default height for \hrule is 0.4pt (not a parameter whose default value is 0.4pt) so you are correct that it may not be changed via setting a parameter. However \hrulefill is only a macro so you can change it if you wish.

It is defined by

\def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}

so

\def\hrulefill{\leavevmode\leaders\hrule height 2pt\hfill\kern\z@}

would make it thicker

David Carlisle
  • 757,742
  • I am assuming it is not possible to define a primitive that depends on a parameter, since that doesn't seem like it would be a primitive anymore. – StrongBad Aug 04 '12 at 12:20
  • 2
    Well yes you or I can't define a primitive however it would have been possible for tex-the-program to define the default widths of rules to be a dimen register \defaultrulewidth or some such, but it doesn't. Compare with the primitive \indent which indents by an amount given by the primitive dimen parameter \parindent. Somewhat unusually in TeX, the rule width is a hard wired numerical default. – David Carlisle Aug 04 '12 at 12:29
  • 2
    Perhaps instead of \z@ we Plain TeX guys could use 0pt? Searching on it brought me to this answer which suggests so. – Daniel Lyons Jun 18 '15 at 15:19
  • @DanielLyons you could but \z@ is defined in plain as well (plain.tex line 258) – David Carlisle Jun 18 '15 at 15:40
  • 1
    I see it there, but I get Undefined control sequence from xetex. – Daniel Lyons Jun 18 '15 at 15:45
  • 1
    @DanielLyons of course you would in latex too: you need to make the definition at a point that @ is a letter (\catcode\@=11)otherwise you have\z(undefined) followed by@` – David Carlisle Jun 18 '15 at 15:47
  • Sounds like a lot of work to save one character. :) – Daniel Lyons Jun 18 '15 at 15:49
  • @DanielLyons It makes the code noticeably quicker to run, In 1980 it made the code much quicker to run. – David Carlisle Jun 18 '15 at 16:10
  • I'm sorry to "extend the discussion" but how can that be true? \z@ is just a 0pt dimension value... how can it be faster to use that than a 0pt literal? I believe you... I would just like to understand why. – Daniel Lyons Jun 18 '15 at 17:00
  • @DanielLyons there is extensive discussion on that and explicit timings in my answer to the question that you referenced in my comment see also Knuth's comment on the line above in plain.tex – David Carlisle Jun 18 '15 at 17:57
  • Very interesting! Thanks, and sorry I didn't see it earlier--it was right there! – Daniel Lyons Jun 18 '15 at 18:07