Re: [NTG-context] Length range control of the last line of paragraph
On 2016-03-26 Hans Hagen wrote: > > I added final|2*final|3*final|4*final > > where final is a hspace of one em by default > > the only purpose of this feature is to ensure a gap at the end (handy > when there is no indentation) > Does this settings just set \parfillskip XX plus 1fil or there is more complex magic in the background? I'd like to extend a description here: http://wiki.contextgarden.net/Paragraph_last_line_control Anyway, this related issue could be closed now: http://tracker.luatex.org/view.php?id=885 Thanks, Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/26/2016 2:31 PM, Jan Tosovsky wrote: On 2016-03-26 Hans Hagen wrote: On 3/25/2016 10:57 PM, Jan Tosovsky wrote: On 2016-03-25 Hans Hagen wrote: On 3/25/2016 2:40 PM, Jan Tosovsky wrote: On 2016-03-24 Hans Hagen wrote: On 3/24/2016 8:36 PM, Jan Tosovsky wrote: We basically need: 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 So the following \parfillskip specification finally seems to be what I was looking for ... \parfillskip \lastlinemingap plus \dimexpr\availablehsize-\lastlineminlength-\lastlinemingap\relax \parfillskip \lastlinemingap plus 1fill works just as well I am getting slightly different results on several pages. The number of problematic cases is lower in my variant so I hope it makes still sense. try \ward{}okay i.e. a short word at the end Hmm, I indeed tested my approach with bad example. Now your previous examples make more sense to me :-) for your case i see no solution apart from heuristic lua magic Bad news. But I hope my parfillskip will work for majority cases and these problematic with words shorter than parindent+tolerance can be fixed afterwards by joining them with previous words using non-breaking space. that is what previously posted alternative hyphenater code does: making sure that there are some reasonable amount of characters / words I'll look into your 'crap' paragraph builder lua code if this exception could be handled programmatically without touching the source file (i.e. test for short last line and treat leading whitespace as it was '~' if necessary). Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 2016-03-26 Hans Hagen wrote: > On 3/25/2016 10:57 PM, Jan Tosovsky wrote: > > On 2016-03-25 Hans Hagen wrote: > >> On 3/25/2016 2:40 PM, Jan Tosovsky wrote: > >>> On 2016-03-24 Hans Hagen wrote: > On 3/24/2016 8:36 PM, Jan Tosovsky wrote: > > > > We basically need: > > > > > > 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 > > > > So the following \parfillskip specification finally seems to be > > what I was looking for ... > > > > \parfillskip \lastlinemingap plus > > \dimexpr\availablehsize-\lastlineminlength-\lastlinemingap\relax > > > > \parfillskip \lastlinemingap plus 1fill > > works just as well > I am getting slightly different results on several pages. The number of problematic cases is lower in my variant so I hope it makes still sense. > try \ward{}okay i.e. a short word at the end Hmm, I indeed tested my approach with bad example. Now your previous examples make more sense to me :-) > for your case i see no solution apart from heuristic lua magic Bad news. But I hope my parfillskip will work for majority cases and these problematic with words shorter than parindent+tolerance can be fixed afterwards by joining them with previous words using non-breaking space. I'll look into your 'crap' paragraph builder lua code if this exception could be handled programmatically without touching the source file (i.e. test for short last line and treat leading whitespace as it was '~' if necessary). Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/25/2016 10:57 PM, Jan Tosovsky wrote: On 2016-03-25 Hans Hagen wrote: On 3/25/2016 2:40 PM, Jan Tosovsky wrote: On 2016-03-24 Hans Hagen wrote: On 3/24/2016 8:36 PM, Jan Tosovsky wrote: We basically need: 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 there is but not enough stretch so there will be a warning ... you can see it from \ruledhbox to 10cm {x} \ruledhbox to 10cm {x\hskip0pt plus 1cm} \ruledhbox to 10cm {x\hskip0pt plus 1fill} I get it, thanks. 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 you always add a 2em skip so there will never be a word touching the right margin in the last line; yes, but this is my goal (!) See https://mailman.ntg.nl/pipermail/ntg-context/2016/084858.html - case (2) I am afraid I hasn't been clear enough yet. 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 \availablehsize So the following \parfillskip specification finally seems to be what I was looking for as it covers both cases in my original question: \setupindenting[yes,2em] \newdimen\lastlineminlength \newdimen\lastlinemingap \lastlineminlength=3em \lastlinemingap=1em \parfillskip \lastlinemingap plus \dimexpr\availablehsize-\lastlineminlength-\lastlinemingap\relax \edef\ward{\cldloadfile{ward}} \starttext \dorecurse{100}{ \hsize\dimexpr\textwidth-#1mm\relax \ward \par \ward \par \startnarrower[left] \ward \par \ward \par \stopnarrower \page } \stoptext try \ward{}okay i.e. a short word at the end and you'll see theh \parfillskip \lastlinemingap plus 1fill works just as well As it can be done in one place globally and in almost single line, no special new command is necessary (as requested originally). i've removed the one|two|three and added final|2*final|3*final|4*final where final is a hspace of one em by default the only purpose of this feature is to ensure a gap at the end (handy when there is no indentation) for your case i see no solution apart from heuristic lua magic Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 2016-03-25 Hans Hagen wrote: > On 3/25/2016 2:40 PM, Jan Tosovsky wrote: > > On 2016-03-24 Hans Hagen wrote: > >> On 3/24/2016 8:36 PM, Jan Tosovsky wrote: > >>> > >>> We basically need: > >>> > >>> > >>> 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 > > there is but not enough stretch so there will be a warning ... you > can see it from > > \ruledhbox to 10cm {x} > \ruledhbox to 10cm {x\hskip0pt plus 1cm} > \ruledhbox to 10cm {x\hskip0pt plus 1fill} > I get it, thanks. > > 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 > > you always add a 2em skip so there will never be a word touching the > right margin in the last line; yes, but this is my goal (!) See https://mailman.ntg.nl/pipermail/ntg-context/2016/084858.html - case (2) I am afraid I hasn't been clear enough yet. > > 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 > > \availablehsize > So the following \parfillskip specification finally seems to be what I was looking for as it covers both cases in my original question: \setupindenting[yes,2em] \newdimen\lastlineminlength \newdimen\lastlinemingap \lastlineminlength=3em \lastlinemingap=1em \parfillskip \lastlinemingap plus \dimexpr\availablehsize-\lastlineminlength-\lastlinemingap\relax \edef\ward{\cldloadfile{ward}} \starttext \dorecurse{100}{ \hsize\dimexpr\textwidth-#1mm\relax \ward \par \ward \par \startnarrower[left] \ward \par \ward \par \stopnarrower \page } \stoptext As it can be done in one place globally and in almost single line, no special new command is necessary (as requested originally). Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/25/2016 2:40 PM, Jan Tosovsky wrote: On 2016-03-24 Hans Hagen wrote: On 3/24/2016 8:36 PM, Jan Tosovsky wrote: We basically need: 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 As expected, results are on the average worse than an occasional relatively short last line. One cannot expect to find good solutions when the solutionspace is too small. \startluacode function builders.paragraphs.constructors.methods.crap(head) local needed = 2 * tex.parindent if needed > 0 then local maximum = tex.hsize local cycles = 500 local step= 65536 local done= 0 local tail= node.tail(head) while true and done < cycles do local h = nodes.copy_list(head) local t = nodes.tail(h) local d, r = tex.linebreak(h) local l = node.tail(d) if d ~= l and l.subtype == nodes.listcodes.line then local natural = nodes.dimensions(l.list,t.prev) node.flush_list(d) if natural >= needed then break elseif natural >= maximum then break else local maybe = maximum - needed - done*step if maybe > 0 then tail.width = maybe tail.stretch = 0 tail.shrink = 0 done = done + 1 else break end end else node.flush_list(d) end end if done > 0 then logs.report("crap","last line enforced in %i steps",done) end end end \stopluacode \edef\ward {\cldloadfile{ward}} \defineparbuilder[crap] \starttext \dorecurse{20} { \dostepwiserecurse{0}{80}{2} { \indenting[##1mm,yes] \dontcomplain \setupalign[tolerant,stretch] \blackrule[width=\textwidth] \hsize=\dimexpr\textwidth-#1pt\relax \ward \par \startparbuilder[crap]% \ward \par \ward \par \stopparbuilder \page } } \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage :
Re: [NTG-context] Length range control of the last line of paragraph
On 3/25/2016 2:40 PM, Jan Tosovsky wrote: On 2016-03-24 Hans Hagen wrote: On 3/24/2016 8:36 PM, Jan Tosovsky wrote: We basically need: 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 there is but not enough stretch so there will be a warning ... you can see it from \ruledhbox to 10cm {x} \ruledhbox to 10cm {x\hskip0pt plus 1cm} \ruledhbox to 10cm {x\hskip0pt plus 1fill} 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. you always add a 2em skip so there will never be a word touching the right margin in the last line; furthermore you permit some stretch, but as said before this stretch is not frozen, it's a ratio relative to other stretch \ruledhbox to 10cm {x\hskip2em plus 1cm x\hskip2em plus 1cm x} so, the plus 1cm can become more than that depending on needs (onlky the warning is influenced 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 \availablehsize i think that the #1 gap is irrelevant and actually makes it worse as it add space while you actually want it to move the other direction anyway, this is why using a couple of non-hyphenated words or a minimum amount of characters makes more sense - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 2016-03-24 Hans Hagen wrote: > On 3/24/2016 8:36 PM, Jan Tosovsky wrote: > > > > We basically need: > > > > > > 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 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/24/2016 8:36 PM, Jan Tosovsky wrote: 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 xx xx (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: 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? 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 \ruledhbox to 10cm {x\hskip0pt plus 1cm\relax x% x\hskip0pt plus 2cm\relax x} now the glue gets distributed 1:2, so now you can guess \ruledhbox to 10cm {x\hskip1mm plus 1cm\relax x% x\hskip8mm plus 2cm\relax x} Are there other ways? I can think of: 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... you can see what glue eventually is used with: \showmakeup[glue] \start \parfillskip 123pt \relax \input tufte \par \parfillskip 123pt plus 1fil \relax \input tufte \par \parfillskip 123pt \relax \input tufte \par \parfillskip -123pt plus 1fil \relax \input tufte \par \stop - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
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 > > > >xx > > xx > > > > > > (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: 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: 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? ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/24/2016 3:10 AM, Aditya Mahajan wrote: On Tue, 22 Mar 2016, Hans Hagen wrote: a next beta will provide three new keywords (related to n times parindent filling, fwiw) \startnarrower[left] \setupalign[four] 4>\the\parfillskip \ward \par \stopnarrower \startnarrower[left] \setupalign[three] 3>\the\parfillskip \ward \par \stopnarrower \startnarrower[left] \setupalign[two] 2>\the\parfillskip \ward \par \stopnarrower I think that two, three, four are not very descriptive. An easier to remember interface could be \setupalign[3*parindent], etc. - i don't wanted new keywords - we don't scan for n* in setupalign (and "3*parindent" could be a keyword of course but messes the interface) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On Tue, 22 Mar 2016, Hans Hagen wrote: a next beta will provide three new keywords (related to n times parindent filling, fwiw) \startnarrower[left] \setupalign[four] 4>\the\parfillskip \ward \par \stopnarrower \startnarrower[left] \setupalign[three] 3>\the\parfillskip \ward \par \stopnarrower \startnarrower[left] \setupalign[two] 2>\the\parfillskip \ward \par \stopnarrower I think that two, three, four are not very descriptive. An easier to remember interface could be \setupalign[3*parindent], etc. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/23/2016 8:14 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: a next beta will provide a bit more control over last words \usemodule[art-01] \setupbodyfont[10pt] \definehyphenationfeatures [words-1] [rightwords=3, lefthyphenmin=4, righthyphenmin=4]> ... not uploaded yet I am impressed by your passion. Thanks for your continuous tweaking and inventing various approaches to fulfil my needs! i added only a few lines ... the rightwords is already there for a while (but the rightchars is new) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
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 xx xx (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? Huh. I am puzzled. 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 -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 2016-03-22 Hans Hagen wrote: > On 3/22/2016 11:54 AM, 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: > > a next beta will provide three new keywords (related to n times > parindent filling, fwiw) > > \setupalign[four] > \setupalign[three] > \setupalign[two] > > ... Thanks for this! I'd personally prefer more self-decriptive keywords. After several months I usually forgot the original meaning. But I understand this is unacceptable: last-line-length-greater-than-four-parindents :-) ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
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: > > a next beta will provide a bit more control over last words > > \usemodule[art-01] \setupbodyfont[10pt] > > \definehyphenationfeatures >[words-1] >[rightwords=3, > lefthyphenmin=4, > righthyphenmin=4]> > > ... > > not uploaded yet I am impressed by your passion. Thanks for your continuous tweaking and inventing various approaches to fulfil my needs! Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
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: Dear All, when paragraphs are separated by indenting the first line (instead of an empty line), these rules should be followed: (1) the last line lenght is greater than the left indent xx (2) the last line is shorter than block width xx xx you need to keep in mind that what would work out well for one specific case will not look nice in general as the last line filling is just one of the aspects ... so, your last line + following first line might look okay (according to whatever rules and criteria) but then, as you also need to increase the tolerance and enable stretch to permit that solution to be found, the rest might look like crap I (naively) thought the last line can be somehow isolated in the engine so the parfillskip settings doesn't influence the rest (too much). well, in order to determine what the last line is tex has to construct the paragraph so x x becoming x x would be real bad I understand your point. (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 it's hard to envision an interface, maybe some extra key in setupalign \setupindenting[big] \indenting[yes] \edef\ward{\cldloadfile{ward}} \setupalign[verytolerant,stretch] \dorecurse{100}{ \hsize\dimexpr\textwidth-#1mm\relax \parfillskip \zeropoint plus 1fil\relax \ward \par \parfillskip \zeropoint plus \dimexpr\availablehsize- 3\parindent\relax \ward \par \startnarrower[left] \parfillskip \zeropoint plus 1fil\relax \ward \par \stopnarrower \startnarrower[left] \parfillskip \zeropoint plus \dimexpr\availablehsize-3\parindent\relax \ward \par \stopnarrower \page } Wow, this is cool visualization! When \zeropoint is replaced by e.g. 2em, I have what wanted originally. Could anybody explain drawbacks of such approach? I mean especially that overful magic above. I'd like to summarize this topic on Wiki. Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 2016-03-22 Hans Hagen wrote: > On 3/21/2016 8:14 PM, Jan Tosovsky wrote: > > Dear All, > > > > when paragraphs are separated by indenting the first line (instead of > an > > empty line), these rules should be followed: > > > > (1) the last line lenght is greater than the left indent > > > > > >xx > > > > > > (2) the last line is shorter than block width > > > > xx > >xx > > > > > > you need to keep in mind that what would work out well for one specific > case will not look nice in general as the last line filling is just one > of the aspects ... so, your last line + following first line might look > okay (according to whatever rules and criteria) but then, as you also > need to increase the tolerance and enable stretch to permit that > solution to be found, the rest might look like crap I (naively) thought the last line can be somehow isolated in the engine so the parfillskip settings doesn't influence the rest (too much). I understand your point. > > (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 :-) > it's hard to envision an interface, maybe some extra key in setupalign > > \setupindenting[big] \indenting[yes] > > \edef\ward{\cldloadfile{ward}} > > \setupalign[verytolerant,stretch] > > \dorecurse{100}{ > \hsize\dimexpr\textwidth-#1mm\relax > \parfillskip \zeropoint plus 1fil\relax > \ward \par > \parfillskip \zeropoint plus \dimexpr\availablehsize- > 3\parindent\relax > \ward \par > \startnarrower[left] > \parfillskip \zeropoint plus 1fil\relax > \ward \par > \stopnarrower > \startnarrower[left] > \parfillskip \zeropoint plus > \dimexpr\availablehsize-3\parindent\relax > \ward \par > \stopnarrower > \page > } Wow, this is cool visualization! When \zeropoint is replaced by e.g. 2em, I have what wanted originally. Could anybody explain drawbacks of such approach? I mean especially that overful magic above. I'd like to summarize this topic on Wiki. Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/22/2016 9:29 PM, Jan Tosovsky wrote: Hi Michael, On 2016-03-22 Rogers, Michael K wrote: Perhaps this? (I'm still better at Plain TeX than ConTeXt.) \starttext \setupindenting[yes,40pt] \dimen0=\hsize \advance\dimen0 by -\parindent \advance\dimen0 by -2em \parfillskip=2em plus \dimen0 \tolerance=0 % strictly enforces glue dimensions/stretching - may have unwanted side effects \dorecurse{41}{wxyz }\par \dorecurse{42}{wxyz }\par \dorecurse{26}{wxyz } thanks, if I understand correctly, this follows my original idea to dynamically get the actual block width, simply substract indentation and use the variable for defining \parfillskip i just added some variant to an existing setting, nothing too fancy, just a delta of local width and some indent I modified it slightly, but it doesn't seem to have desired effect. The last line of third paragraph is still too short: because there is more involved, like hyphenation, badness of other lines, etc ... after all it is stretch, not absolute i'm not going to waste time too much on figuring out some heuristic that works in one case but not in the other \starttext \hsize 15.37cm \input tufte \parfillskip30pt plus 1fil \input tufte \dimen0\hsize \advance\dimen0 by -60pt \parfillskip=30pt plus \dimen0 %\tolerance=0 % strictly enforces glue dimensions/stretching - may have unwanted side effects well, no stretch or tolerance means that the solution space becomes pretty small (so you might get your desired last line but a terrible n lines before that) and hsize is not always the best choice (normally all these par values also depends on the global body font, spacing, margins, etc. so it's more dynamic) \input tufte \parfillskip0pt plus 1fil \input tufte hsize is \the\hsize{}\par dimen0 is \the\dimen0{} \stoptext I disabled that tolerance as it caused overflowing the text to the margin. Was that the key for the functionality? what key? try to add a minus or negative plus ... the outcome differes per case Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
Hi Michael, On 2016-03-22 Rogers, Michael K wrote: > > Perhaps this? (I'm still better at Plain TeX than ConTeXt.) > > > \starttext > \setupindenting[yes,40pt] > \dimen0=\hsize > \advance\dimen0 by -\parindent > \advance\dimen0 by -2em > \parfillskip=2em plus \dimen0 > \tolerance=0 % strictly enforces glue dimensions/stretching - may > have unwanted side effects > > \dorecurse{41}{wxyz }\par > \dorecurse{42}{wxyz }\par > \dorecurse{26}{wxyz } > thanks, if I understand correctly, this follows my original idea to dynamically get the actual block width, simply substract indentation and use the variable for defining \parfillskip I modified it slightly, but it doesn't seem to have desired effect. The last line of third paragraph is still too short: \starttext \hsize 15.37cm \input tufte \parfillskip30pt plus 1fil \input tufte \dimen0\hsize \advance\dimen0 by -60pt \parfillskip=30pt plus \dimen0 %\tolerance=0 % strictly enforces glue dimensions/stretching - may have unwanted side effects \input tufte \parfillskip0pt plus 1fil \input tufte hsize is \the\hsize{}\par dimen0 is \the\dimen0{} \stoptext I disabled that tolerance as it caused overflowing the text to the margin. Was that the key for the functionality? Jan ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/22/2016 11:54 AM, Hans Hagen wrote: On 3/21/2016 8:14 PM, Jan Tosovsky wrote: Dear All, when paragraphs are separated by indenting the first line (instead of an empty line), these rules should be followed: a next beta will provide three new keywords (related to n times parindent filling, fwiw) \starttext \dontcomplain \setupindenting[big] \indenting[yes] \edef\ward{\cldloadfile{ward}} \setupalign[verytolerant,stretch] \dorecurse{100}{ \startnarrower[left] \setupalign[four] 4>\the\parfillskip \ward \par \stopnarrower \startnarrower[left] \setupalign[three] 3>\the\parfillskip \ward \par \stopnarrower \startnarrower[left] \setupalign[two] 2>\the\parfillskip \ward \par \stopnarrower \page } \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/21/2016 8:14 PM, Jan Tosovsky wrote: Dear All, when paragraphs are separated by indenting the first line (instead of an empty line), these rules should be followed: a next beta will provide a bit more control over last words \usemodule[art-01] \setupbodyfont[10pt] \definehyphenationfeatures [words-1] [rightwords=3, lefthyphenmin=4, righthyphenmin=4] \definehyphenationfeatures [words-2] [rightwords=3, rightchars=word, lefthyphenmin=4, righthyphenmin=4] \definehyphenationfeatures [words-3] [rightwords=3, rightchars=8, lefthyphenmin=4, righthyphenmin=4] \enabletrackers[hyphenator.visualize] \setupalign[verytolerant,stretch] \dontcomplain \setuphyphenation [method=traditional] \edef\tufte{\cldloadfile{tufte}} \starttext \dorecurse{100}{ \hsize\dimexpr\textwidth-#1mm\relax \start \sethyphenationfeatures[words-1] \tufte \par \hsize\dimexpr\textwidth-#1mm\relax \start \sethyphenationfeatures[words-2] \tufte \par \hsize\dimexpr\textwidth-#1mm\relax \start \sethyphenationfeatures[words-3] \tufte \par \page } \stoptext not uploaded yet - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Length range control of the last line of paragraph
On 3/21/2016 8:14 PM, Jan Tosovsky wrote: Dear All, when paragraphs are separated by indenting the first line (instead of an empty line), these rules should be followed: (1) the last line lenght is greater than the left indent xx (2) the last line is shorter than block width xx xx you need to keep in mind that what would work out well for one specific case will not look nice in general as the last line filling is just one of the aspects ... so, your last line + following first line might look okay (according to whatever rules and criteria) but then, as you also need to increase the tolerance and enable stretch to permit that solution to be found, the rest might look like crap it's the same for successive hyphenation and club/widow: any whole document setting that is done to get rid of one or two odd cases will often make the rest of the text look bad this is a side effect of focusing on a specific typographical aspect whereby ignoring the rest combined with fully automated typesetting of course one can have extensive discussions about how things should look right but one cannot ignore the text itself then: adding a few words or rephrasing is often a better way out (the same applies to fonts: one can stress the virtues of some advanced kerning between two glyphs but at the same time be blind for the cases where it doesn't happen) (ad 1) Some suggestions can be found in http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-l ine - but to be honest, it is not very clear to me how to apply it and even combine with (2) (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) I'd be grateful for any command which would set this globally for all paragraphs. Partly requested here http://tracker.luatex.org/view.php?id=885 One could set (a) minimum length - default=2*indent (b) minimum gap - default=indent (c) minimum block width where (a) and (b) are still to be applied - default=2*a+b any heuristic that works for one case will make another worse (when applied to a whole document) (ad c) if there are narrower blocks within the document (e.g. blockquotes), we should still have some room for typesetting the last line content. If the area width is insufficient, the last line would be typeset without these (a+b) restrictions. In meantime, any suggestion how to combine a+b manually are welcome. it's hard to envision an interface, maybe some extra key in setupalign \setupindenting[big] \indenting[yes] \edef\ward{\cldloadfile{ward}} \setupalign[verytolerant,stretch] \dorecurse{100}{ \hsize\dimexpr\textwidth-#1mm\relax \parfillskip \zeropoint plus 1fil\relax \ward \par \parfillskip \zeropoint plus \dimexpr\availablehsize-3\parindent\relax \ward \par \startnarrower[left] \parfillskip \zeropoint plus 1fil\relax \ward \par \stopnarrower \startnarrower[left] \parfillskip \zeropoint plus \dimexpr\availablehsize-3\parindent\relax \ward \par \stopnarrower \page } The 2*indent is not enough in most cases. Actually, in context another mechanism can help: \definehyphenationfeatures [words] [rightwords=3, lefthyphenmin=4, righthyphenmin=4] \enabletrackers[hyphenator.visualize] \setupalign[verytolerant,stretch] \dontcomplain \sethyphenationfeatures [words] \setuphyphenation [method=traditional] \dorecurse{100}{\hsize\dimexpr\textwidth-#1mm\relax \input tufte \page} \stoptext currently this doesn't discourage breaks between the last words but i'll add an option for that (chars or words in that case, that is the question) ... the reason for this mechanism is not so much the length but more the fact that one doesn't want an (even long) last word hyphenated. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___