12

How thick a rule does \hline produce (in a bog-standard tabular environment) ?

2 Answers2

12

The default definition of \hline in the LaTeX kernel with:

\def\hline{%
  \noalign{\ifnum0=`}\fi\hrule \@height \arrayrulewidth \futurelet
   \reserved@a\@xhline}

So you can see it has the height \arrayrulewidth. The dimension \arrayrulewidth is initialed in the LaTeX kernel but without any specifications. This is done by the document class. For the most classes the value is 0.4pt:

\setlength\arrayrulewidth{.4\p@}%.4pt
Xavier
  • 13,947
Marco Daniel
  • 95,681
  • Any idea why 0.4pt is the default? I always wondered why not 0.3pt or 0.5pt :) – Xavier Jul 07 '13 at 15:44
  • @Xavier: This is a question for David or Frank, but 0.4 pt is the default value of TeX for any hrule/vrule – Marco Daniel Jul 07 '13 at 15:45
  • @MarcoDaniel Probably for Leslie :-) I suspect it's to do with matching the width of the rule with that of the thickness of lines in the font (the usual is the upright of the capital 'I'). – Joseph Wright Jul 07 '13 at 15:46
  • @nuttyaboutnatty 0.4pt. Notice the . before 4\p@. I just corrected the code comment in the answer. – Xavier Jul 07 '13 at 15:47
  • Is .4pt and 0.4pt (generally) equivalent for (La-)TeX ? Is it ever not equivalent ? – nutty about natty Jul 07 '13 at 15:49
  • 1
    @nuttyaboutnatty: "generaly" yes, but always no. It depends on the contents. But normally you don't need the leading zero. – Marco Daniel Jul 07 '13 at 15:50
  • @MarcoDaniel Really? When can it not be equivalent (other than if there is code / something else before the .)? – Xavier Jul 07 '13 at 15:52
  • @Xavier: This is the exception ;-) – Marco Daniel Jul 07 '13 at 15:52
  • 1
    The 0.4pt width is the default TeX uses for \hrule or \vrule; it's a built-in value, by the way. Specifying 0.4pt or .4pt is equivalent. – egreg Jul 07 '13 at 15:58
  • @MarcoDaniel ;) – Xavier Jul 07 '13 at 16:17
  • @egreg So we need to ask Donald to understand why 0.4pt? Or is it explained somewhere in the TeXbook? ;) – Xavier Jul 07 '13 at 16:18
  • @Xavier Probably that was the value Knuth found the best for his rules. Or the most common in the books he analyzed. – egreg Jul 07 '13 at 16:19
  • 3
    @egreg -- default_rule_thickness is parameter \sigma_8 (texbook, p.447), so it is drawn from the .tfm file of the symbol fonts. in volume e (computer modern typefaces), p.13, rule_thickness for cmr10 is specified as .4(pt); more explanation of how values for the cm parameters were derived appears on the previous page. i don't believe the "prose" portions of volume e are in distribution (unlike texbook.tex and `mfbook.tex'); i know the original book was pasted up, but with the re-issue of the c&t set, this may change; i will ask at the next bug review. – barbara beeton Jul 07 '13 at 18:46
  • @barbarabeeton That's the default thickness for fraction lines; the default value for \hrule and \vrule are defined in module 463 of tex.web. – egreg Jul 07 '13 at 19:11
  • @egreg -- thanks; i searched through volume b for nearly half an hour, but missed that. however, since don really does value consistency, i'm willing to bet a small amount that the value is based on the setting adopted for fraction lines as i described. – barbara beeton Jul 07 '13 at 19:19
  • @barbarabeeton Or the other way around, since 0.4pt for \hrule and \vrule is built in. – egreg Jul 07 '13 at 19:20
  • @egreg -- remember that don worked on tex/mf/cm simultaneously. (see "digital typesetting" and conversations in "companion to the papers of donald knuth".) all "monoline" math symbols are the thickness of rule_nib, defined as (vol.e, p.551) "{\bf pickup pencircle} scaled {\it rule_thickness}; {\it rule.nib $:=$ savepen};", where rule_thickness is set to .4pt (see setups for parameter files on pp.32ff, vol.e, where "rth# := .4pt#; % assume that rules will come from cmex10)". but i'll ask don when i deliver the problem reports later this year. – barbara beeton Jul 07 '13 at 20:04
8

In module 463 of tex.web (the source for “TeX the program”) we find

Here’s a similar procedure that returns a pointer to a rule node. This routine is called just after TeX has seen \hrule or \vrule; therefore *cur_cmd* will be either hrule or vrule. The idea is to store the default rule dimensions in the node, then to override them if ‘height’ or ‘width’ or ‘depth’ specifications are found (in any order).

    define default_rule = 26214 { 0.4 pt }

Thus the default value for rule is 0.4 pt. LaTeX offers the \rule interface, which has no default. However the default value of \arrayrulewidth in the standard classes is set to 0.4pt, I suppose for compatibility with TeX's rules. The parameter \arrayrulewidth is what governs the default value for rules in tabular and array environments, either produced by the | specifier, \vline, \hline or \cline.

egreg
  • 1,121,712