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

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.

  \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}


enter image description here

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

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

enter image description here

  • Was does \hss do? I've never heard of this command before. – Svend Tveskæg Dec 26 '14 at 11:56
  • 1
    inserts infinitely stretchable and shrinkable horizontal glue, like \hfill in LaTeX – user2478 Dec 26 '14 at 11:59
  • 1
    \hss and hfill are both primitives so also defined in latex, \hfill only has stretch component, not shrink \hss has both. – David Carlisle Dec 26 '14 at 13:08
  • I get an error on \underline. This may not be available in plain tex. – merlin2011 Dec 26 '14 at 17:22
  • do you forgot hte $...$? it is a math command – user2478 Dec 26 '14 at 18:32

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.