[texhax] use of \rightskip

Paul Isambert zappathustra at free.fr
Thu Jul 29 09:06:51 CEST 2010

Selon "D. R. Evans" <doc.evans at gmail.com>:

> \def\subchapter#1%
> {{\noindent\subchapnamefont  #1}
> %{{\noindent\subchapnamefont\raggedright\hyphenchar\subchapnamefont=-1  #1}
> %{{\noindent\subchapnamefont\hyphenchar\subchapnamefont=-1\rightskip=0pt
> plus1fil {#1}}
> \bigskip
> }

That's easy then. The paragraph ends with \bigskip, outside the group where
assignments are made to produce raggedright. Hence it retains the values set
before the group. Just move \bigskip inside the group.

By the way, setting \pretolerance=10000 is the right way to avoid linebreaks; an
\hyphenchar assignment is always global, so it escapes the group, although you
probably don't mind (and haven't noticed) since it affects \subchapnamefont

Finally, there's a difference between \raggedright and setting \rightskip=0pt
plus 1fil: the latter creates a hard rag (no minimum width of line) whereas
\raggedright (at least in the plain TeX definition) sets \rightskip=0pt plus
2em, i.e. with a minimum line of (\hsize-2em). (For the record, \raggedright
also makes interword space unelastic, but you don't need to do so if \rightskip
has an infinite stretch, since finite interword stretch won't be used.)


More information about the texhax mailing list