ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: Length range control of the last line of paragraph
Date: Tue, 22 Mar 2016 21:44:12 +0100	[thread overview]
Message-ID: <56F1AE9C.7040907@wxs.nl> (raw)
In-Reply-To: <01b001d18479$93c9f310$bb5dd930$@tosovsky@email.cz>

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
___________________________________________________________________________________

  parent reply	other threads:[~2016-03-22 20:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <016501d183a5$d3c48810$7b4d9830$@tosovsky@email.cz>
2016-03-21 23:51 ` Rogers, Michael K
2016-03-22 20:29   ` Jan Tosovsky
     [not found]   ` <01b001d18479$93c9f310$bb5dd930$@tosovsky@email.cz>
2016-03-22 20:44     ` Hans Hagen [this message]
2016-03-22 10:16 ` Hans Hagen
2016-03-22 20:57   ` Jan Tosovsky
     [not found]   ` <01b401d1847d$798a9a00$6c9fce00$@tosovsky@email.cz>
2016-03-22 21:46     ` Hans Hagen
2016-03-23 19:14       ` Jan Tosovsky
     [not found]       ` <018a01d18538$3f17eb50$bd47c1f0$@tosovsky@email.cz>
2016-03-23 23:21         ` Hans Hagen
2016-03-24 19:36           ` Jan Tosovsky
     [not found]           ` <02cd01d18604$82a81620$87f84260$@tosovsky@email.cz>
2016-03-24 20:54             ` Hans Hagen
2016-03-25 13:40               ` Jan Tosovsky
     [not found]               ` <008a01d1869b$e0b90610$a22b1230$@tosovsky@email.cz>
2016-03-25 14:09                 ` Hans Hagen
2016-03-25 21:57                   ` Jan Tosovsky
     [not found]                   ` <00dd01d186e1$656dbff0$30493fd0$@tosovsky@email.cz>
2016-03-26 10:48                     ` Hans Hagen
2016-03-26 13:31                       ` Jan Tosovsky
     [not found]                       ` <003f01d18763$c77c4fe0$5674efa0$@tosovsky@email.cz>
2016-03-26 22:05                         ` Hans Hagen
2016-03-30 19:23                       ` Jan Tosovsky
     [not found]                       ` <017b01d18ab9$99df34e0$cd9d9ea0$@tosovsky@email.cz>
2016-03-30 22:11                         ` Hans Hagen
2016-03-25 16:56                 ` Hans Hagen
2016-03-22 10:54 ` Hans Hagen
2016-03-22 13:31   ` Hans Hagen
2016-03-23 19:47     ` Jan Tosovsky
2016-03-24  2:10     ` Aditya Mahajan
2016-03-24  9:47       ` Hans Hagen
2016-03-23 19:14   ` Jan Tosovsky
     [not found]   ` <018901d18538$3ef34c50$bcd9e4f0$@tosovsky@email.cz>
2016-03-23 23:22     ` Hans Hagen
2016-03-21 19:14 Jan Tosovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F1AE9C.7040907@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).