7

This is a follow-up to this question and the requirement for Plain TeX is still in place.

I am trying to create the effect of floating a string (date) above the long underscore I create using the first method in the accepted answer.

This is the closest I have come, but obviously the underline does not match up with the underscore.

Date \hskip 1 pt \underbar{12-25-2014} \vrule height .4pt width 7cm
merlin2011
  • 3,343

3 Answers3

5
foo $\underline{\hbox to 7cm{\hss12-25-2014\hss}}$ bar
\bye

enter image description here

4

If you need to keep the rule created by \vrule height -3pt depth 3.4pt width 7cm then you can write:

Date \rlap{12-25-2014}\vrule height -3pt depth 3.4pt width 7cm
wipet
  • 74,238
4

Split the rule into two parts and add the text as a zero width box in the middle; in order to enhance the “floating” character, I slightly raised the box.

\def\filltospace#1#2{{%
  \dimen0=#1\relax
  \dimen0=.5\dimen0
  \vrule height -3pt depth 3.4pt width \dimen0
  \raise1pt\hbox to 0pt{\hss#2\hss}%
  \vrule height -3pt depth 3.4pt width \dimen0
}}

Date \filltospace{7cm}{12-25-2014}

\bye

enter image description here

Adding variations about the positioning (not at the center, that is) is easy.

egreg
  • 1,121,712