I need to draw a line from the end of a sentence in a question to the right margin. In exam class, I can do this with \hrulefill if I don't use \droppoints, but as soon as I do, the line is no longer to the right margin.

First question works without \droppoints, second question cuts line short.

    This is a question to answer here:\hrulefill

    This is another question:\hrulefill \droppoints

enter image description here

1 Answer 1


The reason for this is because \droppoints also inserts a rubber length - \hfill - to stretch to the right side of the page. The length is shared between the two components, \hfill and \hrulefill.

You can either force a new paragraph and then jump back to insert the \droppoints, or create a new macro (say) \droppointshere that doesn't insert the \hfill:

enter image description here


  % \leavevmode\unskip\nobreak\hfill% <----- removed
  \rlap{\hskip\rightmargin  % Defined by the list environment
        \hskip\@rightmargin % Defined by exam.cls
  }% rlap


    This is a question to answer here: \hrulefill

    This is another question: \hrulefill \droppoints

    This is another question: \hrulefill \par

    This is a final question: \hrulefill \droppointshere


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.