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

Jan Tosovsky j.tosovsky at email.cz
Thu Mar 24 20:36:48 CET 2016


On 2016-03-24 Hans Hagen wrote:
> On 3/23/2016 8:14 PM, Jan Tosovsky wrote:
> > On 2016-03-22 Hans Hagen wrote:
> >> On 3/22/2016 9:57 PM, Jan Tosovsky wrote:
> >>> On 2016-03-22 Hans Hagen wrote:
> >>>> On 3/21/2016 8:14 PM, Jan Tosovsky wrote:
> >>>>>
> >>>>> when paragraphs are separated by indenting the first line
> >>>>> (instead of an empty line), these rules should be followed:
> >>>>>
> >>>>> (2) the last line is shorter than block width
> >>>>>        xxxxxxxxxxxxxxxx
> >>>>>        xxxxxxxxxxxxxx
> >>>>>          xxxxxxxxxxxxxx
> >>>>>        xxxxxxxxxxxxxxxx
> >>>>>
> >>>>> (ad 2) This can be done using \parfillskip XXpt plus 1fil
> >>>>> (where XX is required gap)
> >>>>
> >>>> setting the XXpt is tricky as it might lead to underful or
> >>>> overful cases when that amount start interfering with an optimal
> >>>> solution (as it's seen as acceptable overflow in some direction)
> >>>
> >>> underful or overful where? in previous lines? I am quite lost here
> >>
> >> \starttext
> >>
> >> \setupalign[tolerant,stretch]
> >> \dorecurse{100}{
> >>       \hsize\dimexpr\textwidth-#1pt\relax
> >>       \parfillskip -4em plus 1 fill
> >>       \input tufte
> >>       \page
> >> }
> >>
> >> \stoptext
> >>
> >> page 43
> >
> > In my output I can see overful of the last line on pages 38-46.
> >
> > How can this happen? Isn't it a clear bug?
> >
> > What exactly mean 'that amount start interfering with an optimal
> > solution'? Isn't parfillskip settings taken already into an 
> > account when composing the paragraph?
> 
> it's just a skip added at the end of the line ... so like any skip 
> and if you give it a fill that will be taken into account in 
> linebreaks (just like other fill)
> 
> \starttext
> 
> \dorecurse{100}{testtesttesttesttest #1 \hskip0ptplus1fill\relax}
> 
> \stoptext
> 

To be honest, I can't still decipher the reason why the line is not broken...

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)

Or is it impossible in TeX to achieve such rule?

Are there other ways? I can think of:
<text><space width='XX'><glue min-width='0' max-width='hsize-3*indent-XX'>

But in this case that space at the end can be completely swallowed (by negative glue). I've tried it in the following example, but there is another problem from page 58 - blank line. But my TeX interpretation of the above pseudo code may be inappropriate...

\showmakeup

\starttext

\setupindenting[yes, 30pt]

\edef\ward{\cldloadfile{ward}}

%\setupalign[verytolerant,stretch]

\dorecurse{100}{
     \hsize\dimexpr\textwidth-#1mm\relax
     \dimen0=\dimexpr\availablehsize-3\parindent
     \advance\dimen0 by -\parindent

     \parfillskip \zeropoint plus \dimen0
     \ward\hbox to 10pt{}

     \ward\hbox to 10pt{}

     \startnarrower[left]
        \parfillskip \zeropoint plus \dimen0
        \ward\hbox to 10pt{}

        \parfillskip \zeropoint plus \dimen0
        \ward\hbox to 10pt{}

     \stopnarrower

     \page
}

\stoptext

Any idea?



More information about the ntg-context mailing list