I am currently using \rule to insert blank lines into paragraphs of text in a document though the lines often go past the document margins. I know I can use \hrulefill to stay within the margins, but often I do not want the line to stretch across the entire page. Does anybody know a way to either have \rule break between lines or display wholly on the next line if it does not fit within the margins?

For example:

If I have:

Lorem ipsum dolor sit amet, \rule{6em}{.5pt} consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \rule{6em}{.5pt} commodo consequat. Duis aute irure dolor in reprehenderit in \rule{6em}{.5pt} voluptate velit esse cillum dolore eu fugiat nulla \rule{6em}{.5pt} pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

How can I ensure that the \rules do not cross into my document margins?


To amend the short comment of cgnieder:


Some people are really modest. Guess who wrote the exsheets package:
The nick of the author is \blank[width=4cm]{cgnieder}, and his full
name is \blank[width=7cm]{Clemens Niederberger}.


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.