Usually I use the lipsum package to produce random text. But sometimes I want to test something just after the text (e.g. some \hrulefill command).

I noticed that \lipsum[1] ends with a \par or \newline or something similar.

How to avoid this so that \lipsum[1]\hfill{foo} works like foo\hfill{foo}?


lipsum provides a starred version of the traditional \lipsum macro which suppresses the paragraph breaks, or the package option nopar that removes the paragraph breaks altogether:

enter image description here

\usepackage{lipsum}% http://ctan.org/pkg/lipsum

From the lipsum documentation (p 2):

...the paragraphs generated by \lipsum will be separated by the macro \par, or, more precisely, every paragraph will be terminated by \par. Sometimes, this may cause some unintended effects. Therefore the package provides the option nopar that causes \lipsum to omit the terminating \par. For this purpose, the package should be included via


Furthermore, a starred version of \lipsum, \lipsum*, exists that, with respect to the terminating \par, does the opposite of \lipsum: If no option is provided, it omits the insertion of \par after each paragraph, if the option nopar is provided, it typesets the paragraphs separated by \par.

Note that \lipsum* calls the macro \ChangeLipsumPar inside a group and subsequently calls the internal macro \@lipsum that generates the output. \ChangeLipsumPar alternates the internal macro \lips@par between \relax and \par. \lips@par is called at the end of each paragraph and therefore \ChangeLipsumPar provides a switch to alter the output of this package within a single document when it is required to avoid additional groups.


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.