# [texhax] have a piece of thest ragged right à the end of a paragraph

Philip TAYLOR (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Mon Sep 19 21:51:18 CEST 2011


Donald Arseneau wrote:

> What a very long-winded way to say "I think 2em is too large
> for the minimum separation".  Optimal is in the eye of the
> beholder.

"Optimal", in terms of the original question posed :

> I would like to write a command \toRight{#1} allowing me to
> align a piece of text to be flushed the right at the end of a
> justified paragraph, creating a next line of necessary.

Nowhere in that problem statement do I see any desire that
the text be separated from any preceding text by 2 em of space,
or indeed by any space at all.  My own solution is open to
criticism on the same basis, in that it forcibly inserts
the space of the line. The following version attempts to
rectify that, although it has not yet been as rigorously
tested :

\newskip \myskip
\def \HardRight #1%
{%
{\myskip = \lastskip \unskip \nobreak \hfil \penalty 50 \hskip \myskip \hbox {}\nobreak \hfil #1%
\parfillskip = 0 pt \finalhyphendemerits = 0 \par
}%
}

Philip Taylor