[NTG-context] Length range control of the last line of paragraph

Jan Tosovsky j.tosovsky at email.cz
Fri Mar 25 14:40:20 CET 2016


On 2016-03-24 Hans Hagen wrote:
> On 3/24/2016 8:36 PM, Jan Tosovsky wrote:
> >
> > We basically need:
> > <text><glue min-width='XX' max-width='hsize-3*indent'>
> >
> > and I thought this is exactly what \parfillskip ensures
> > \parfillskip XX plus (hsize - 3*indent)
> >
> 
> the fil is taken into account when calculating the best break points
> and then the XX is fixed but plus/minus can lead to if being less 
> or more, all relative to other fill (distributed)
> 
> so, XX plus (hsize - 3*indent) is not a fixed value, it's XX or more
> 
> take this:
> 
> \ruledhbox to 10cm {x\hskip0pt plus 1cm x}
> 
> the skip will stretch more than 1cm

I can see. 

But sorry for my ignorance, as far as I understand, \parfillskip is added to the end of the paragraph, so we have rather 
\ruledhbox to 10cm {x\hskip0pt plus 1cm} % without that 'x' at the end, so no 'glue' distribution is performed

If '\parfillskip 2em plus (hsize - 3*(2em) - 2em)' is specified, I still think we should get space of width at least 2em '####' which can be extended as indicated by hyphens '-' here:

emememememememememememememememememememem
emememememem------------------------####

So there are two last line lengths extrems:
(shortest)
emememememememememememememememememememem
emememememem

(longest)
emememememememememememememememememememem
emememememememememememememememememem

I slightly modified your example and even with verystrict settings all seems to be fine (except too narrow blocks, which is not my use case).

\showmakeup[glue]

\setupindenting[yes,2em]

\edef\ward{\cldloadfile{ward}}

\setupalign[verystrict,hz]

\starttext
\dorecurse{100}{
     \hsize\dimexpr\textwidth-#1mm\relax
     \dimen0=\hsize
     \advance\dimen0 by -8em % 3*em - 2em
     \parfillskip 2em plus \dimen0\relax
     \ward  \par
     \parfillskip 2em plus \dimen0\relax
     \ward  \par
     \startnarrower[left]
         \parfillskip 2em plus \dimen0\relax
         \ward \par
     \stopnarrower
     \startnarrower[left]
         \parfillskip 2em plus \dimen0\relax
         \ward \par
     \stopnarrower
     \page
}
\stoptext

The problem here this settings cannot be done globally if there are various block widths.

Can I somehow define command globally which takes local block widths?

\parfillskip #1 plus \localhsize-#1-#2, where 
#1 gap width
#2 shortest line width

Jan



More information about the ntg-context mailing list