[Tex/LaTex] Underlining a whole line with a short text in its beginning


I would like to underline a whole line with a single word in the beginning of the line. I tried


but this underlines only the word “HOMEWORK'', leaving the rest of line not underlined.

Any other suggestion?

Best Answer

It might be easiest to create a macro to do this which measures the length of the text and then produces an \hspace for the remaining space: