[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 13:07:52 CEST 2011
Paul Isambert wrote:
> \def\toRight#1{{\unskip\nobreak\hfil\penalty50
> \hskip2em\hbox{}\nobreak\hfil #1
> \parfillskip=0pt \finalhyphendemerits=0 \par}}
>
> Explained in the _TeXbook_, page 106:
I am unconvinced that the solution is optimal, although
it is undoubtedly robust. I tried it with a number of
paragraphs of ever-increasing length to see how it
coped with all possible situations, and found the
following anomaly :
% RightJustifiedLastLine
\parindent = 0 pt
\parskip = \baselineskip
\def \HardRight #1%
{%
{\unskip \nobreak \hfil \penalty 50 \hskip 2 em \hbox {}\nobreak \hfil #1%
\parfillskip = 0 pt \finalhyphendemerits = 0 \par
}%
}
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last lineeeeee
\HardRight {and this is the text with which we wish to end it.}
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last lineeeeeee
\HardRight {and this is the text with which we wish to end it.}
\end
Look at the typeset PDF of the first para., and you will clearly see
that there is space for at least one, if not several, additional "e"s
at the end of "lineeeeeee". Then look at the next para., where you
will see that a line break has been forced prematurely. I believe that
a more optimal solution would not force a line break until it was
actually necessary, as in the following :
% RightJustifiedLastLine
\parindent = 0 pt
\parskip = \baselineskip
\def \HardRight #1%
{%
{\unskip \nobreak \hfil \penalty 50 \ \hbox {}\nobreak \hfil #1%
\parfillskip = 0 pt \finalhyphendemerits = 0 \par
}%
}
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line
\HardRight {and this is the text with which we wish to end it.}
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last lineeeeeeeeee
\HardRight {and this is the text with which we wish to end it.}
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last line,
Now is the time for all good men to end their paragraphs with a right-justified last lineeeeeeeeeee
\HardRight {and this is the text with which we wish to end it.}
\end
Notice just how many "e"s that line will actually accommodate !
Philip Taylor
More information about the texhax
mailing list