From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/101284 Path: news.gmane.org!.POSTED!not-for-mail From: Joseph Canedo Newsgroups: gmane.comp.tex.context Subject: Re: Issues with vertical spacing in simple case Date: Thu, 19 Jul 2018 22:26:15 +0200 Message-ID: <5b50f3e5.1c69fb81.818e2.0e39@mx.google.com> References: <5b4e6111.1c69fb81.e885b.8caf@mx.google.com> <33c6d509-cb3b-eb28-8173-69114558ec95@xs4all.nl> <5b4fa427.1c69fb81.f14db.41eb@mx.google.com> <5b5035f3.1c69fb81.3114a.6c6c@mx.google.com> <59e352b0-e497-9b84-94de-1e1fa2c43164@xs4all.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5146025431732218646==" X-Trace: blaine.gmane.org 1532031872 2237 195.159.176.226 (19 Jul 2018 20:24:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Jul 2018 20:24:32 +0000 (UTC) To: Hans Hagen , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Jul 19 22:24:28 2018 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fgFTN-0000SJ-Kj for gctc-ntg-context-518@m.gmane.org; Thu, 19 Jul 2018 22:24:25 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D53D144EB4; Thu, 19 Jul 2018 22:26:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xYw4zWF-4-1e; Thu, 19 Jul 2018 22:26:26 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 1EE2A44E7E; Thu, 19 Jul 2018 22:26:26 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 40B6744EAE for ; Thu, 19 Jul 2018 22:26:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MY5-EezdzXEZ for ; Thu, 19 Jul 2018 22:26:24 +0200 (CEST) Original-Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 6AB1C44E73 for ; Thu, 19 Jul 2018 22:26:14 +0200 (CEST) Original-Received: by mail-wm0-f45.google.com with SMTP id s9-v6so7424381wmh.3 for ; Thu, 19 Jul 2018 13:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:mime-version:to:from:subject:date:importance:in-reply-to :references; bh=YyI/or9p8DU/F9gTVXlg3uTKvTRJ5qOjI++/MYpiq/I=; b=MnrBXCaUIjEkKrTPaAmuK/E7pgeYfJ9ODFRuvfmTwDnaRx6JgkQ6V42GUA4k80zp1v XNdr9yPEdbGt7k1TMqzpT9ZaLxOvFCb53bSu2t0EXVV/nulhB/ZTTLFMXt7ZJR0EbFbt wgaNSgGETNqqo7GxQVFOnL4AqrV5cSHhk0aKxeCIKu70pZHjGag3soPGHAczIsY68OnI r83vC4dJOfmOGZ+buExeek/7Sz90av2qyUCljfsM0cYcwt65wUhAYu/sqiX7/Sk6US3Y Mqrwrjy6ZT5sUHJh7gXES/t2bzf4VzoWaB8ZxLpLEhFkEN3VDhbseSJN/tbgLZjCU8cv TEJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version:to:from:subject:date :importance:in-reply-to:references; bh=YyI/or9p8DU/F9gTVXlg3uTKvTRJ5qOjI++/MYpiq/I=; b=ddNMz7fEGDf7t3f8199z4stpU45naKfBCP8nVy4+mNdyo5IFVbMnVDesMqp4q6qpnt q+hDPdQXMUBWscT/Kd70LCJaHSit+9cUm8dk5AZRwIGivOfvdn2lxVjYrAW8lFPOmfKa 4TWVLfzWqFRKo80WVNsCxGpsarCfHFPKt5aLeo/Uj2pEohuCYF+zIFZBegpTS+X7sC4Z rOlp/HstFBgNGynfapw29X/4MnUrdLzv5BP9zk/29yVkMB7F7qdNl7uW+ji9JRslUUN5 s3no0MkPJe24O2eBnDKEG08CMPz401fTyB50BYRU8Xhm3mzyZqqX6NI/O5bzMS+hTBw/ j4Aw== X-Gm-Message-State: AOUpUlFx4kyrmRQCaAkW2xgC8KF/kdEbMd240BDCYaQUb8NIeNjvBZAm P6fmvYmYWuCyPWCnxMnKXNg= X-Google-Smtp-Source: AAOMgpduAwYRKzFXGMq/zTdrETfmSGxYSSJqrYfd6QuhmrIom13iUtre1nGL4caHqexKTT36JtJ+4g== X-Received: by 2002:a1c:3e92:: with SMTP id l140-v6mr5033358wma.134.1532031974078; Thu, 19 Jul 2018 13:26:14 -0700 (PDT) Original-Received: from ?IPv6:2a01:cb00:68e:300:f128:5:5235:86c1? (2a01cb00068e0300f1280005523586c1.ipv6.abo.wanadoo.fr. [2a01:cb00:68e:300:f128:5:5235:86c1]) by smtp.gmail.com with ESMTPSA id u14-v6sm119982wrs.57.2018.07.19.13.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 13:26:13 -0700 (PDT) Importance: normal X-Priority: 3 In-Reply-To: <59e352b0-e497-9b84-94de-1e1fa2c43164@xs4all.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:101284 Archived-At: --===============5146025431732218646== Content-Type: multipart/alternative; boundary="_AFD67851-50F4-4DF4-B8E0-E06CC18457F2_" --_AFD67851-50F4-4DF4-B8E0-E06CC18457F2_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Thanks for the extended explanation. I guess I need to figure out how to cr= eate a MWE that reproduces the issue. Provenance=C2=A0: Courrier pour Windows 10 De=C2=A0: Hans Hagen Envoy=C3=A9 le=C2=A0:jeudi 19 juillet 2018 09:35 =C3=80=C2=A0: Joseph Canedo; mailing list for ConTeXt users Objet=C2=A0:Re: [NTG-context] Issues with vertical spacing in simple case On 7/19/2018 8:55 AM, Joseph Canedo wrote: > Thanks. >=20 > The problem happens in a case where there are no paragraph split between= =20 > 2 pages. All pars are entirely either in page 1 or page 2 (these numbers= =20 > are not actual page numbers, but it=E2=80=99s for clarity). >=20 > I am trying to create a MWE but it=E2=80=99s not trivial. The situation a= s far=20 > as I understand it is like the following=C2=A0: >=20 > I=E2=80=99ve added tracers for vspacing.synchronizepage function. >=20 > When page 1 ships, there are 2 paragraphs (1 + 3 lines) still pending=20 > because they do not fit in page 1 so they will be shipped in page 2 (I=20 > think that what is in texlists.page_head variable). Hence tex.prevgraf=20 > which was 0 is set to 4 (see this from traces in output log). what do you mean with pending ... tex doesn't look ahead, only back you probably need to look at the delta of pagegoal - pagetotal and evide=20 that by the line height .. probably good enough for text without whitespace even then, hyphenation penalties can make a page one or more lines=20 shorter so you also need to disable some of that > vspacing=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > page 4, prevdepth 2.= 56577pt =3D> 2.56577pt, prevgraf 0 =3D> 4 >=20 > vspacing=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > list glue:topskip hl= ist:line penalty:userpenalty=20 > penalty:userpenalty glue:baselineskip hlist:line=20 > penalty:linebreakpenalty glue:baselineskip hlist:line=20 > penalty:linebreakpenalty glue:baselineskip hlist:line glue:userskip >=20 > Next paragraph after the 2 pending pars I refer to above has a non zero=20 > \hangindent and \hangafter (set to -1) and when it starts being=20 > processed (in horizontal mode) prevgraf is already 4 so I think this=20 > cancels out that hanging (that=E2=80=99s the effect I see in output, ther= e is no=20 > indent in 1st line of 3rd par), as IIRC TEX considers par has already 4=20 > lines but in actuality it has 0. If I read correctly the TeXBook,=20 > prevgraf value has some impact on \hangafter / \hangindent you never really know what you look at: tex collects stuff and triggers=20 the output routine when it thinks it makes sense in context there is also the rather complex vertical spacing mechanism=20 that needs to look back and forward while looking back can interfere=20 with page breaks (and/or retrying) these mechanisms evolved over time and are still nto perfect > The value of \prevgraf affects line breaking only when TEX > is dealing with nonstandard \parshape or \hangindent. no, it's independent ... just th enumber of lines (hboxes) that make a=20 paragraph after it's broken into lines hangindent/after/parshape don't look at real dimensions, they only count=20 lines this is why a side float mechanism is so complex ... lots of border=20 cases and trickery around page breaks (because not only the size of what=20 goes side is important but also the preceding and following space, the=20 height and depth of lines etc > Joseph >=20 > *De=C2=A0: *Hans Hagen > *Envoy=C3=A9 le=C2=A0:*jeudi 19 juillet 2018 00:00 > *=C3=80=C2=A0: *Joseph Canedo ; mailing li= st for=20 > ConTeXt users > *Objet=C2=A0:*Re: [NTG-context] Issues with vertical spacing in simple ca= se >=20 > On 7/18/2018 10:33 PM, Joseph Canedo wrote: >=20 > > Thanks Hans. >=20 > > >=20 > > Picked up today beta and some code I have relying on value of >=20 > > tex.prevgraf starts breaking. This is lettrine related code that sets >=20 > > hangafter for 1st paragraph and eventually subsequent if lettrine is >=20 > > larger than 1st par. >=20 > > >=20 > > I see the function vspacing.synchronizepage() sets prevgraf value I >=20 > > guess to avoid bleeding also paragraph lines. >=20 > > >=20 > > Is there any possibility to get original unchanged tex.prevgraf value, >=20 > > possibly using some callback or some other tex.=C2=A0? >=20 > you cannot rely on prevgraf crossing pages (so you get e.g. 8 at the top >=20 > of a page with 5 lines >=20 > where/how does it fail >=20 > Hans >=20 > ----------------------------------------------------------------- >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Hans Hagen | PRAGMA ADE >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tel: 038 477 53 69 | www.prag= ma-ade.nl | www.pragma-pod.nl >=20 > ----------------------------------------------------------------- >=20 --=20 ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- --_AFD67851-50F4-4DF4-B8E0-E06CC18457F2_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Thanks for the extended explanation. I= guess I need to figure out how to create a MWE that reproduces the issue.<= /p>

 

Provenanc= e : Courr= ier pour Windows 10

 

De : Hans Hagen=
Envoy=C3=A9 le :jeudi 19 juillet 2018 09:35
=C3= =80 : Joseph Canedo;= mailing list for ConTeXt usersObjet :Re: [NTG-context] Issues with vertical spacing in simp= le case

 

On 7/19/2018 8:55 AM, Joseph Canedo wrote:

>= ; Thanks.

>

> The pr= oblem happens in a case where there are no paragraph split between

> 2 pages. All pars are entirely either in page 1 or pa= ge 2 (these numbers

> are not actual page numbe= rs, but it=E2=80=99s for clarity).

>

> I am trying to create a MWE but it=E2=80=99s not trivial= . The situation as far

> as I understand it is = like the following :

>

> I=E2=80=99ve added tracers for vspacing.synchronizepage function.=

>

> When page 1 shi= ps, there are 2 paragraphs (1 + 3 lines) still pending

> because they do not fit in page 1 so they will be shipped in page= 2 (I

> think that what is in texlists.page_hea= d variable). Hence tex.prevgraf

> which was 0 i= s set to 4 (see this from traces in output log).

 

what do you mean with pending ... t= ex doesn't look ahead, only back

 <= /p>

you probably need to look at the delta of pagegoal = - pagetotal and evide

that by the line height .. p= robably good enough for text without whitespace

 

even then, hyphenation penalties can= make a page one or more lines

shorter so you also= need to disable some of that

 

=

> vspacing       = ; > page 4, prevdepth 2.56577pt =3D> 2.56577pt, prevgraf 0 =3D> 4<= /p>

>

> vspacing &n= bsp;      > list glue:topskip hlist:line penalt= y:userpenalty

> penalty:userpenalty glue:baseli= neskip hlist:line

> penalty:linebreakpenalty gl= ue:baselineskip hlist:line

> penalty:linebreakp= enalty glue:baselineskip hlist:line glue:userskip

&= gt;

> Next paragraph after the 2 pending pars I= refer to above has a non zero

> \hangindent an= d \hangafter (set to -1) and when it starts being

= > processed (in horizontal mode) prevgraf is already 4 so I think this <= /p>

> cancels out that hanging (that=E2=80=99s the e= ffect I see in output, there is no

> indent in = 1st line of 3rd par), as IIRC TEX considers par has already 4

> lines but in actuality it has 0. If I read correctly the = TeXBook,

> prevgraf value has some impact on \h= angafter / \hangindent

 

you never really know what you look at: tex collects stuff an= d triggers

the output routine when it thinks it ma= kes sense

 

in context there is also the rather complex vertical spacing mechanism

that needs to look back and forward while looking bac= k can interfere

with page breaks (and/or retrying)=

 

these me= chanisms evolved over time and are still nto perfect

 

> The value of \prevgraf aff= ects line breaking only when TEX

> is dealing wi= th nonstandard \parshape or \hangindent.

 = ;

no, it's independent ... just th enumber of= lines (hboxes) that make a

paragraph after it's b= roken into lines

 

hangindent/after/parshape don't look at real dimensions, they only = count

lines

 

this is why a side float mechanism is so comple= x ... lots of border

cases and trickery around pag= e breaks (because not only the size of what

goes s= ide is important but also the preceding and following space, the

height and depth of lines etc

&= nbsp;

> Joseph

>= ;

> *De : *Hans Hagen <mailto:j.hagen@x= s4all.nl>

> *Envoy=C3=A9 le :*jeudi 19 j= uillet 2018 00:00

> *=C3=80 : *Joseph Caned= o <mailto:josephcanedo@gmail.com>; mailing list for

> ConTeXt users <mailto:ntg-context@ntg.nl>

> *Objet :*Re: [NTG-context] Issues with vertical spacing= in simple case

>

> = On 7/18/2018 10:33 PM, Joseph Canedo wrote:

>

>=C2=A0 > Thanks Hans.

>

>=C2=A0 >

>=

>=C2=A0 > Picked up today beta and some cod= e I have relying on value of

>

>=C2=A0 > tex.prevgraf starts breaking. This is lettrine rela= ted code that sets

>

&g= t;=C2=A0 > hangafter for 1st paragraph and eventually subsequent if lett= rine is

>

>=C2=A0 &g= t; larger than 1st par.

>

>=C2=A0 >

>

&g= t;=C2=A0 > I see the function vspacing.synchronizepage() sets prevgraf v= alue I

>

>=C2=A0 >= ; guess to avoid bleeding also paragraph lines.

>= ;

>=C2=A0 >

>

>=C2=A0 > Is there any possibility to get origi= nal unchanged tex.prevgraf value,

>

>=C2=A0 > possibly using some callback or some other tex= .<Something> ?

>

> you cannot rely on prevgraf crossing pages (so you get e.g. 8 at = the top

>

> of a pag= e with 5 lines

>

> w= here/how does it fail

>

> Hans

>

> -----= ------------------------------------------------------------

>

>=C2=A0     =             &nb= sp;            =             &nb= sp; Hans Hagen | PRAGMA ADE

>

>=C2=A0          &nb= sp;     Ridderstraat 27 | 8061 GH Hasselt | The Netherl= ands

>

>=C2=A0  = ;       tel: 038 477 53 69 | www.pragma-ade.n= l | www.pragma-pod.nl

>

> -----------------------------------------------------------------

=

>

 

 

--

 

--------------------= ---------------------------------------------

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 Hans Hagen | PRAGMA ADE

= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tel: 038 477 53 69 = | www.pragma-ade.nl | www.pragma-pod.nl

-----------= ------------------------------------------------------

 

= --_AFD67851-50F4-4DF4-B8E0-E06CC18457F2_-- --===============5146025431732218646== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============5146025431732218646==--