From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/101285 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:52:22 +0200 Message-ID: <5b50fa03.1c69fb81.6fa90.1a11@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> <5b50f3e5.1c69fb81.818e2.0e39@mx.google.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8183868787720707274==" X-Trace: blaine.gmane.org 1532033449 13512 195.159.176.226 (19 Jul 2018 20:50:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Jul 2018 20:50:49 +0000 (UTC) To: Hans Hagen , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Jul 19 22:50:45 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 1fgFsr-0003O1-5e for gctc-ntg-context-518@m.gmane.org; Thu, 19 Jul 2018 22:50:45 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 04A2F44E44; Thu, 19 Jul 2018 22:52:34 +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 mFai7n23B11e; Thu, 19 Jul 2018 22:52:33 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 2519444E46; Thu, 19 Jul 2018 22:52:33 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id DD8C844E46 for ; Thu, 19 Jul 2018 22:52:31 +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 9joeDAgC1kmU for ; Thu, 19 Jul 2018 22:52:31 +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 005C444E44 for ; Thu, 19 Jul 2018 22:52:20 +0200 (CEST) Original-Received: by mail-wm0-f45.google.com with SMTP id 69-v6so7661014wmf.3 for ; Thu, 19 Jul 2018 13:52:20 -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=cR57MAG2NXYuzgaEug0Q6lxd5I9luWLP/gBQa3oW8yM=; b=WUTBUbQVQNwScUNxARaZ3m+iQ/piJ3Pn2NLj4cb0I18m4szIeMd+yv1z0rBgRjgfLk l3eDDsgUELYEBB6fMlFkraXezX17DyRbIUYEuW6Qg/SkMeA7PJWUdIaTQTpvX1AmXOfi ireHxpYDyVRDuq2hHnMOYqZvxoRxOCHFlCm71N6xGepzc+wE7MdCG/Tf6mcErTVpqh7g w8rnM6szJ1J3R3Fza/Gouake6G3RDm47dXp9VzIHcJx6plJuKWHfDgiPmOA1j7QQaVtj GvXhTz2SQzHKFFVD4CF8ncE1srOkpqm5ah9f417ynCKTMlOijT/m9wmlyBo7DXtFoeNW SRrA== 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=cR57MAG2NXYuzgaEug0Q6lxd5I9luWLP/gBQa3oW8yM=; b=qViLclko3oGWiFDhnuBDFgMm+h3TyarNpCILSmBIVTVvdFnddZKISplD1MF+WE5GEf fUWmV0GT6JBs9vgUirYJK1KxGmvHqrZ3AEqUmlz+ctsUXURyffj9ln6zjQ0LHV1dvQpB vdiIazEPH0WoZGA1O9ZQIu0snF9Dd8jWWl/EYIaTeoS+J2phZEy7SiiYay5TmCizgung 7scPqqW3G18osjrYmLPPrEyHLoWgXBUZ0pu8XVGFBfgCDmQA8EvTuTgES9HUGmsSWyaa dfm7sul7mgZKmaVEG2Ea0ttmImkkL83AZ+M0wDKlK0trsbxOsKV+gl6U9aaDu+K+74fT UsAQ== X-Gm-Message-State: AOUpUlG5N9WX09AXp6qqK138FH0cfxzyKQHJcvzwPCDlUZ/mFr2qWypk Ojy7ZhqJmLCw9t5SLYWVM8E= X-Google-Smtp-Source: AAOMgpe0WJi8IDZvpIpP2PAH/UqHz/n0N+HZqPQZGv4EuxsjpOPBdNQi/GvIOT82UIkOBfeYsOZ6qg== X-Received: by 2002:a1c:b406:: with SMTP id d6-v6mr5180994wmf.126.1532033540685; Thu, 19 Jul 2018 13:52:20 -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 w9-v6sm213334wrk.28.2018.07.19.13.52.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 13:52:19 -0700 (PDT) Importance: normal X-Priority: 3 In-Reply-To: <5b50f3e5.1c69fb81.818e2.0e39@mx.google.com> 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:101285 Archived-At: --===============8183868787720707274== Content-Type: multipart/alternative; boundary="_C1E5A07D-305E-4619-AA6E-580428997CAD_" --_C1E5A07D-305E-4619-AA6E-580428997CAD_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Finally I could make a MWE that reproduces the issue. %%%%%%%% %\setuplayout[grid=3Dboth] % uncommenting this makes last line not indented= .=20 %\enabletrackers[vspacing.synchronizepage] \starttext \dorecurse{39}{ % other values like 40 do not show issue A. } Chapitre. \blank[0pt, samepage] \hangindent=3D30pt\hangafter=3D-2Third par.\\ Second line. \blank[0pt, samepage] \hangindent=3D30pt\hangafter=3D-2 Fourth par not indented.\\ Second line no= t indented. \stoptext Thanks De=C2=A0: Joseph Canedo Envoy=C3=A9 le=C2=A0:jeudi 19 juillet 2018 22:26 =C3=80=C2=A0: Hans Hagen; mailing list for ConTeXt users Objet=C2=A0:RE: [NTG-context] Issues with vertical spacing in simple case 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 >=C2=A0 > Thanks Hans. >=20 >=C2=A0 > >=20 >=C2=A0 > Picked up today beta and some code I have relying on value of >=20 >=C2=A0 > tex.prevgraf starts breaking. This is lettrine related code that = sets >=20 >=C2=A0 > hangafter for 1st paragraph and eventually subsequent if lettrine= is >=20 >=C2=A0 > larger than 1st par. >=20 >=C2=A0 > >=20 >=C2=A0 > I see the function vspacing.synchronizepage() sets prevgraf value= I >=20 >=C2=A0 > guess to avoid bleeding also paragraph lines. >=20 >=C2=A0 > >=20 >=C2=A0 > Is there any possibility to get original unchanged tex.prevgraf v= alue, >=20 >=C2=A0 > 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=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=C2=A0 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands >=20 >=C2=A0 =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 >=20 > ----------------------------------------------------------------- >=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 =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 ----------------------------------------------------------------- --_C1E5A07D-305E-4619-AA6E-580428997CAD_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Finally I could make a MWE that reprod= uces the issue.

 

%%%%%%%%

%\setuplayout[grid=3Dboth] % uncomm= enting this makes last line not indented.

%\enable= trackers[vspacing.synchronizepage]

 

\starttext

 

\dorecurse{39}{ % other values like 40 do not s= how issue

A.

 

}

 

=

Chapitre.

\blank[0pt, samepage= ]

\hangindent=3D30pt\hangafter=3D-2Third par.\\

=

Second line.

\blank[0pt, samep= age]

\hangindent=3D30pt\hangafter=3D-2 Fourth par n= ot indented.\\ Second line not indented.

 = ;

\stoptext

&nbs= p;

Thanks

 =

De : Joseph Canedo
Envoy=C3=A9 le :jeudi 19 juil= let 2018 22:26
=C3=80 : Hans Hagen; mailing list for Con= TeXt users
Objet :RE: [NTG-context] Issues with vertical= spacing in simple case

 

=

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

 

Provenance&nbs= p;: Courrier pour Windows 10

 

=

De : Hans Hagen
Envoy=C3=A9 le :jeudi 19 juillet 201= 8 09:35
=C3=80 : J= oseph Canedo; mailing list for Co= nTeXt users
Objet :Re: [NTG-context] Issues with vertica= l spacing in simple case

&nbs= p;

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

> Thanks.

>

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

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

> are not actual pa= ge numbers, but it=E2=80=99s for clarity).

>

> I am trying to create a MW= E 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 ships, there are 2 paragraphs (1 + 3 lines) still pending

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

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

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

 

<= p class=3DMsoNormal>what do you mean with pending ... tex doesn't look ahea= d, only back

 

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

that by the line height ..= probably 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&g= t; 2.56577pt, prevgraf 0 =3D> 4

> =

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

> penalty:userpenalty glue:baselineskip = hlist:line

> penalty:linebreakpenalt= y glue:baselineskip hlist:line

> pen= alty:linebreakpenalty glue:baselineskip hlist:line glue:userskip=

>

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

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

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

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

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

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

> prevgraf = value has some impact on \hangafter / \hangindent

 

you never really know w= hat you look at: tex collects stuff and triggers

the output routine when it thinks it makes sense

 

in context the= re is also the rather complex vertical spacing mechanism

that needs to look back and forward while looking back ca= n interfere

with page breaks (and/or re= trying)

 

these mechanisms evolved over time and are still nto perfect=

 

&g= t; The value of \prevgraf affects line breaking only when TEX

> is dealing with nonstandard \parshape or \hangin= dent.

 

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

paragraph after it's broken into li= nes

 

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

lines

 

this is why a side float me= chanism is so complex ... lots of border

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

goes side is important but also the pre= ceding and following space, the

height = and depth of lines etc

 =

> Joseph

>= ;

> *De : *Hans Hagen <mailt= o:j.hagen@xs4all.nl>

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

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

> ConTeXt users &l= t;mailto:ntg-context@ntg.nl>

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

>

&= gt; On 7/18/2018 10:33 PM, Joseph Canedo wrote:

>

>  > Thanks Han= s.

>

>  >

>

=

>  > Picked up today beta and some code I h= ave relying on value of

> =

>  > tex.prevgraf starts breaking. This= is lettrine related code that sets

>=

>  > hangafter for 1st para= graph and eventually subsequent if lettrine is

>

>  > larger than= 1st par.

>

>  >

> <= /o:p>

>  > I see the function vspacing.s= ynchronizepage() sets prevgraf value I

&= gt;

>  > guess to avoid blee= ding also paragraph lines.

>

>  >

>

>  > Is there any p= ossibility to get original unchanged tex.prevgraf value,

>

>  > p= ossibly using some callback or some other tex.<Something> ?=

>

>= ; you cannot rely on prevgraf crossing pages (so you get e.g. 8 at the top<= o:p>

>

> of a page with 5 lines

> <= /o:p>

> where/how does it fail

>

> Hans

>

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

>

>&nbs= p;             =             &nb= sp;            =       Hans Hagen | PRAGMA ADE

>

>   &n= bsp;            = ; Ridderstraat 27 | 8061 GH Hasselt | The Netherlands

>

>   &nb= sp;      tel: 038 477 53 69 | www.pragma-ade.nl | = www.pragma-pod.nl

>

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

>

 

 =

--

 =

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

   =             &nb= sp;            =             &nb= sp;  Hans Hagen | PRAGMA ADE

 =             &nb= sp; Ridderstraat 27 | 8061 GH Hasselt | The Netherlands

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

-----------------------------------------------------------------

 

 

= --_C1E5A07D-305E-4619-AA6E-580428997CAD_-- --===============8183868787720707274== 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 --===============8183868787720707274==--