I need an \hrule which is right aligned and the size is exactly equal to the text above it.

And the same for text below it.

Is such a thing possible outside of LuaTeX? I am using XeTeX.

EDIT: For example:

Line:1        aaaaaa
Line:2        ______ (hrule)


Line1:        ______ (hrule)
Line2:        aaaaaa

By size I mean horizontal dimension.

I'm looking for how to get it to work with single line text but ultimately I'm looking for is pointers to the concept behind how \hrule works so I don't have to come back again with a minor modification :)

  • Welcome to TeX.SX! Could you add a bit more context how the rules relate to the text surrounding them? Should the text be single line/\hboxed only or normal paragraph text? By size, do you mean height+depth or the current font size? – siracusa Apr 13 at 7:03
  • @siracusa I edited the question. Please let me know if there is anything else that needs to be made clear. Thank you for your attention to the question. – 0fnt Apr 13 at 8:02
  • (This is a comment, because I'm not able to test.) I would try \underline{\phantom{<text>}} and otherwise use the same coding as for the text on the separate line. – barbara beeton Apr 13 at 14:26

You can use \halign (in disguise as \ialign)


\ruleabove{aaaaaa}\qquad \rulebelow{aaaaaa}


enter image description here

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.