Possible Duplicate:
Is there a way to measure the remaining space of a line of text?
I have some text and want to put a \hrulefill at the end following by a period. However, if the text of the line comes too close to the end of the line, the rule is omitted and just a period results — or — a new line is created, the rule is omitted, and the line begins with a period.
How can I determine if there is enough space at the end of the line for a sizeable enough hrulefill of some specified length?
Best Answer
How about the following (using ideas from the command
\qed
in amsart.cls):That guarantees you at least 1em of hrulefill (you can change that 1em to some other length, of course), and prevents the hrulefill from being on a line by itself. You'd just put the command
\myrulefill
at the end of your paragraph.