# How do I make a long underscore in Plain TeX?

I have looked at this question as well as here and here but I cannot figure out how to produce a long underscore in plain TeX, as in the following example.

Date _____________________________


The closest I have come is the obviously undesirable concatenation which leaves gaps in the rendered output.

Date  \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

• \vrule height .4pt width 7cm – Manuel Nov 2 '14 at 8:13
• @Manuel, I accept this answer! But can it be placed below the baseline as in this answer? – merlin2011 Nov 2 '14 at 8:20
• Mmm… let's wait for a “pro answer”, the definition in LaTeX has some \leavevmode\hbox{..} but then the definition of \_ is \leavevmode\vbox{\hrule ..} so I don't really know enough. – Manuel Nov 2 '14 at 8:22

Use a negative height and a slightly bigger depth:

\vrule height -3pt depth 3.4pt width 7cm


The same idea can be used for “raised rules” (with a negative depth). No rule will appear if depth + height is negative.

If you want a “low rule” that fills up a given space, leaders should be used:

\def\lowhrulefill{%
\leavevmode % be sure to be in horizontal mode
\leaders\hrule height height -3pt depth 3.4pt\hfill % fill all available space
\kern0pt % so \par won't remove the rule
}


Note that \leavevmode is necessary because the command appearing in vertical mode would raise an error because of \hfill (and would do nothing good either).

• As noted in comments on the question, is \leavevmode best here? – Joseph Wright Nov 2 '14 at 9:21
• @JosephWright \vrule is a horizontal command, so there's no need. There is for \hrulefill, because it does \leaders\hrule\hfill and it would give errors in vertical mode. – egreg Nov 2 '14 at 9:25
• Why then the definition of \_ and \rule have \leavevmode\vbox{\hrule..} and \leavemode\hbox{\vrule..}? In particular, why \leavevmode when it's unnecessary and why the definition varies between \_ with \vbox{\hrule..} instead of \hbox{\vrule..}? Even, why the \hbox/\vbox? – Manuel Nov 2 '14 at 9:36
• @Manuel \vbox and \hbox are not horizontal commands, so they don't start a paragraph. – egreg Nov 2 '14 at 9:37

Plain TeX already defines an \hrulefill command that does this. Use it like this:

\noindent
Date \hbox to 3cm{\hrulefill}

\bye


to produce

If you would rather have the line drawn a bit lower down, then try this:

\noindent
Date \lower.2ex\hbox to 3cm{\hrulefill}

\bye


If you were going to use it more than a few times, then you could make a macro:

\def\filler#1{\noindent\lower.3ex\hbox to #1{\hrulefill}}

\noindent
Date \filler{3cm}

\bigskip
\noindent
Name: \filler{2in}

\bigskip
\filler{\hsize}

\bye