How does --------------------------- work?

The usual TeX convention is that two hyphens in a row generate an en-dash, while three generate an em-dash.

Consecutive em or en-dashes appear to form a solid line, although it is formed by distinct characters. However the hyphen does not combine, so if the number of hyphens is a multiple of three or one less than a multiple of three, you get a solid line. If the remainder of the division by three is one, you get a hyphen at the end.

However, solidity of the line depends on the font.

Plain TeX example

--------- % nine hyphens

-------- % eight hyphens

------- % seven hyphens

\bye

enter image description here

You could exploit this in order to make a long line (at least 0.5em), by superimposing en-dashes:

\def\solidline#1{%
  \leavevmode
  \hbox to #1{--\leaders\hbox{\kern-.125em--\kern-.125em}\hss--}%
}

\solidline{1cm}

\solidline{2em}

\solidline{1em}

\solidline{0.5em}

\bye

However, \vrule (or LaTeX's) rule is much more efficient. The same effect is obtained by

\def\solidline#1{%
  \vrule width #1 height 0.64ex depth\dimexpr0.2pt-0.64ex\relax
}

\solidline{1cm}    

\solidline{2em}

\solidline{1em}

\solidline{0.5em}

\bye

(requires pdftex; it could be made to work also with Knuth TeX, of course).


Just don't do this.

two -- ligature to an n-dash and three --- ligature to an em-dash so if you have a multiple of three - you have a row of em dashses which may or may not have white space between them depending on the font. use a \rule or \hrulefill to make a line.