ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Issues with vertical spacing in simple case
@ 2018-07-17 21:35 Joseph Canedo
  2018-07-17 22:03 ` Hans Hagen
  2018-07-18  9:10 ` Hans Hagen
  0 siblings, 2 replies; 12+ messages in thread
From: Joseph Canedo @ 2018-07-17 21:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 620 bytes --]

Dear list,

Trying to build a MWE for a problem with unexpected page break (near a \blank[line, samepage]) I could not yet reproduce yet, I came up with strange output.
With latest beta

mtx-context     | current version: 2018.07.17 17:25

MWE :

\starttext
\dorecurse{5}{
\input knuth
\blank[line, samepage]Second.

\input zapf
\blank[line, samepage]Second maybe vertically wrong align?

}
\stoptext

Please see in page 2, the line printing : Second maybe vertically wrong align? (topskip related?)
Seems very close to next line for an unknown reason to me.

Thanks
Best regards

Joseph


[-- Attachment #1.2: Type: text/html, Size: 2602 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-17 21:35 Issues with vertical spacing in simple case Joseph Canedo
@ 2018-07-17 22:03 ` Hans Hagen
  2018-07-18  9:10 ` Hans Hagen
  1 sibling, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2018-07-17 22:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Joseph Canedo

On 7/17/2018 11:35 PM, Joseph Canedo wrote:
> Dear list,
> 
> Trying to build a MWE for a problem with unexpected page break (near a 
> \blank[line, samepage]) I could not yet reproduce yet, I came up with 
> strange output.

weird indeed (i know where / why it happens so i'll look into it)

> With latest beta
> 
> mtx-context     | current version: 2018.07.17 17:25
> 
> MWE :
> 
> \starttext
> 
> \dorecurse{5}{
> 
> \input knuth
> 
> \blank[line, samepage]Second.
> 
> \input zapf
> 
> \blank[line, samepage]Second maybe vertically wrong align?
> 
> }
> 
> \stoptext
> 
> Please see in page 2, the line printing : Second maybe vertically wrong 
> align? (topskip related?)
> 
> Seems very close to next line for an unknown reason to me.
> 
> Thanks
> 
> Best regards
> 
> Joseph
> 
> 
> 
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-17 21:35 Issues with vertical spacing in simple case Joseph Canedo
  2018-07-17 22:03 ` Hans Hagen
@ 2018-07-18  9:10 ` Hans Hagen
  2018-07-18 20:33   ` Joseph Canedo
  1 sibling, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2018-07-18  9:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Joseph Canedo

On 7/17/2018 11:35 PM, Joseph Canedo wrote:
> Dear list,
> 
> Trying to build a MWE for a problem with unexpected page break (near a 
> \blank[line, samepage]) I could not yet reproduce yet, I came up with 
> strange output.
> 
> With latest beta
> 
> mtx-context     | current version: 2018.07.17 17:25
> 
> MWE :
> 
> \starttext
> 
> \dorecurse{5}{
> 
> \input knuth
> 
> \blank[line, samepage]Second.
> 
> \input zapf
> 
> \blank[line, samepage]Second maybe vertically wrong align?
> 
> }
> 
> \stoptext
> 
> Please see in page 2, the line printing : Second maybe vertically wrong 
> align? (topskip related?)
> 
> Seems very close to next line for an unknown reason to me.

The next beta will have a fix. The problem is that tex's prevdepth 
bleeds over into a next page so i try to deal with that ... it's 
sometimes hard to take all into accoutn that needs to (esp when there is 
interferences).

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-18  9:10 ` Hans Hagen
@ 2018-07-18 20:33   ` Joseph Canedo
  2018-07-18 22:00     ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Canedo @ 2018-07-18 20:33 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2001 bytes --]

Thanks Hans.

Picked up today beta and some code I have relying on value of tex.prevgraf starts breaking. This is lettrine related code that sets hangafter for 1st paragraph and eventually subsequent if lettrine is larger than 1st par.
I see the function vspacing.synchronizepage() sets prevgraf value I guess to avoid bleeding also paragraph lines.

Is there any possibility to get original unchanged tex.prevgraf value, possibly using some callback or some other tex.<Something> ? 

Thanks

Joseph

De : Hans Hagen
Envoyé le :mercredi 18 juillet 2018 11:11
À : mailing list for ConTeXt users; Joseph Canedo
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/17/2018 11:35 PM, Joseph Canedo wrote:
> Dear list,
> 
> Trying to build a MWE for a problem with unexpected page break (near a 
> \blank[line, samepage]) I could not yet reproduce yet, I came up with 
> strange output.
> 
> With latest beta
> 
> mtx-context     | current version: 2018.07.17 17:25
> 
> MWE :
> 
> \starttext
> 
> \dorecurse{5}{
> 
> \input knuth
> 
> \blank[line, samepage]Second.
> 
> \input zapf
> 
> \blank[line, samepage]Second maybe vertically wrong align?
> 
> }
> 
> \stoptext
> 
> Please see in page 2, the line printing : Second maybe vertically wrong 
> align? (topskip related?)
> 
> Seems very close to next line for an unknown reason to me.

The next beta will have a fix. The problem is that tex's prevdepth 
bleeds over into a next page so i try to deal with that ... it's 
sometimes hard to take all into accoutn that needs to (esp when there is 
interferences).

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


[-- Attachment #1.2: Type: text/html, Size: 5162 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-18 20:33   ` Joseph Canedo
@ 2018-07-18 22:00     ` Hans Hagen
  2018-07-19  6:55       ` Joseph Canedo
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2018-07-18 22:00 UTC (permalink / raw)
  To: Joseph Canedo, mailing list for ConTeXt users

On 7/18/2018 10:33 PM, Joseph Canedo wrote:
> Thanks Hans.
> 
> Picked up today beta and some code I have relying on value of 
> tex.prevgraf starts breaking. This is lettrine related code that sets 
> hangafter for 1st paragraph and eventually subsequent if lettrine is 
> larger than 1st par.
> 
> I see the function vspacing.synchronizepage() sets prevgraf value I 
> guess to avoid bleeding also paragraph lines.
> 
> Is there any possibility to get original unchanged tex.prevgraf value, 
> 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 page with 5 lines

where/how does it fail

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-18 22:00     ` Hans Hagen
@ 2018-07-19  6:55       ` Joseph Canedo
  2018-07-19  7:35         ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Canedo @ 2018-07-19  6:55 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2828 bytes --]

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 page numbers, but it’s for clarity). 

I am trying to create a MWE but it’s not trivial. The situation as far as I understand it is like the following :

I’ve 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 will 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 traces in output log).

vspacing        > page 4, prevdepth 2.56577pt => 2.56577pt, prevgraf 0 => 4
vspacing        > list glue:topskip hlist:line penalty:userpenalty penalty:userpenalty glue:baselineskip hlist:line penalty:linebreakpenalty glue:baselineskip hlist:line penalty: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) and when it starts being processed (in horizontal mode) prevgraf is already 4 so I think this cancels out that hanging (that’s the effect 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 \hangafter / \hangindent

The value of \prevgraf affects line breaking only when TEX
is dealing with nonstandard \parshape or \hangindent.

Joseph

De : Hans Hagen
Envoyé le :jeudi 19 juillet 2018 00:00
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/18/2018 10:33 PM, Joseph Canedo wrote:
> Thanks Hans.
> 
> Picked up today beta and some code I have relying on value of 
> tex.prevgraf starts breaking. This is lettrine related code that sets 
> hangafter for 1st paragraph and eventually subsequent if lettrine is 
> larger than 1st par.
> 
> I see the function vspacing.synchronizepage() sets prevgraf value I 
> guess to avoid bleeding also paragraph lines.
> 
> Is there any possibility to get original unchanged tex.prevgraf value, 
> 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 page with 5 lines

where/how does it fail

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


[-- Attachment #1.2: Type: text/html, Size: 5677 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-19  6:55       ` Joseph Canedo
@ 2018-07-19  7:35         ` Hans Hagen
  2018-07-19 20:26           ` Joseph Canedo
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2018-07-19  7:35 UTC (permalink / raw)
  To: Joseph Canedo, mailing list for ConTeXt users

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 page numbers, but it’s for clarity).
> 
> I am trying to create a MWE but it’s not trivial. The situation as far 
> as I understand it is like the following :
> 
> I’ve 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 will 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 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 
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 => 2.56577pt, prevgraf 0 => 4
> 
> vspacing        > list glue:topskip hlist:line penalty:userpenalty 
> penalty:userpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line 
> penalty: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) and when it starts being 
> processed (in horizontal mode) prevgraf is already 4 so I think this 
> cancels out that hanging (that’s the effect 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 \hangafter / \hangindent

you never really know what you look at: tex collects stuff and triggers 
the output routine when it thinks it makes sense

in context there is also the rather complex vertical spacing mechanism 
that needs to look back and forward while looking back can interfere 
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 
paragraph after it's broken into lines

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

this is why a side float mechanism 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 preceding and following space, the 
height and depth of lines etc

> Joseph
> 
> *De : *Hans Hagen <mailto:j.hagen@xs4all.nl>
> *Envoyé le :*jeudi 19 juillet 2018 00:00
> *À : *Joseph Canedo <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:
> 
>  > Thanks Hans.
> 
>  >
> 
>  > Picked up today beta and some code I have relying on value of
> 
>  > tex.prevgraf starts breaking. This is lettrine related code that sets
> 
>  > hangafter for 1st paragraph and eventually subsequent if lettrine is
> 
>  > larger than 1st par.
> 
>  >
> 
>  > I see the function vspacing.synchronizepage() sets prevgraf value I
> 
>  > guess to avoid bleeding also paragraph lines.
> 
>  >
> 
>  > Is there any possibility to get original unchanged tex.prevgraf value,
> 
>  > 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 page with 5 lines
> 
> where/how does it fail
> 
> Hans
> 
> -----------------------------------------------------------------
> 
>                                             Hans Hagen | PRAGMA ADE
> 
>                 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> 
>          tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> 
> -----------------------------------------------------------------
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-19  7:35         ` Hans Hagen
@ 2018-07-19 20:26           ` Joseph Canedo
  2018-07-19 20:52             ` Joseph Canedo
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Canedo @ 2018-07-19 20:26 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 5152 bytes --]

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

Provenance : Courrier pour Windows 10

De : Hans Hagen
Envoyé le :jeudi 19 juillet 2018 09:35
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

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 page numbers, but it’s for clarity).
> 
> I am trying to create a MWE but it’s not trivial. The situation as far 
> as I understand it is like the following :
> 
> I’ve 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 will 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 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 
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 => 2.56577pt, prevgraf 0 => 4
> 
> vspacing        > list glue:topskip hlist:line penalty:userpenalty 
> penalty:userpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line 
> penalty: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) and when it starts being 
> processed (in horizontal mode) prevgraf is already 4 so I think this 
> cancels out that hanging (that’s the effect 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 \hangafter / \hangindent

you never really know what you look at: tex collects stuff and triggers 
the output routine when it thinks it makes sense

in context there is also the rather complex vertical spacing mechanism 
that needs to look back and forward while looking back can interfere 
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 
paragraph after it's broken into lines

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

this is why a side float mechanism 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 preceding and following space, the 
height and depth of lines etc

> Joseph
> 
> *De : *Hans Hagen <mailto:j.hagen@xs4all.nl>
> *Envoyé le :*jeudi 19 juillet 2018 00:00
> *À : *Joseph Canedo <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:
> 
>  > Thanks Hans.
> 
>  >
> 
>  > Picked up today beta and some code I have relying on value of
> 
>  > tex.prevgraf starts breaking. This is lettrine related code that sets
> 
>  > hangafter for 1st paragraph and eventually subsequent if lettrine is
> 
>  > larger than 1st par.
> 
>  >
> 
>  > I see the function vspacing.synchronizepage() sets prevgraf value I
> 
>  > guess to avoid bleeding also paragraph lines.
> 
>  >
> 
>  > Is there any possibility to get original unchanged tex.prevgraf value,
> 
>  > 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 page with 5 lines
> 
> where/how does it fail
> 
> Hans
> 
> -----------------------------------------------------------------
> 
>                                             Hans Hagen | PRAGMA ADE
> 
>                 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> 
>          tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> 
> -----------------------------------------------------------------
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


[-- Attachment #1.2: Type: text/html, Size: 10518 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-19 20:26           ` Joseph Canedo
@ 2018-07-19 20:52             ` Joseph Canedo
  2018-07-20  8:51               ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Canedo @ 2018-07-19 20:52 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 5914 bytes --]

Finally I could make a MWE that reproduces the issue.

%%%%%%%%
%\setuplayout[grid=both] % uncommenting this makes last line not indented. 
%\enabletrackers[vspacing.synchronizepage]

\starttext

\dorecurse{39}{ % other values like 40 do not show issue
A.

}

Chapitre.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2Third par.\\
Second line.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2 Fourth par not indented.\\ Second line not indented.

\stoptext

Thanks

De : Joseph Canedo
Envoyé le :jeudi 19 juillet 2018 22:26
À : Hans Hagen; mailing list for ConTeXt 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 : Courrier pour Windows 10

De : Hans Hagen
Envoyé le :jeudi 19 juillet 2018 09:35
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

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 page numbers, but it’s for clarity).
> 
> I am trying to create a MWE but it’s not trivial. The situation as far 
> as I understand it is like the following :
> 
> I’ve 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 will 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 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 
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 => 2.56577pt, prevgraf 0 => 4
> 
> vspacing        > list glue:topskip hlist:line penalty:userpenalty 
> penalty:userpenalty glue:baselineskip hlist:line 
> penalty:linebreakpenalty glue:baselineskip hlist:line 
> penalty: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) and when it starts being 
> processed (in horizontal mode) prevgraf is already 4 so I think this 
> cancels out that hanging (that’s the effect 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 \hangafter / \hangindent

you never really know what you look at: tex collects stuff and triggers 
the output routine when it thinks it makes sense

in context there is also the rather complex vertical spacing mechanism 
that needs to look back and forward while looking back can interfere 
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 
paragraph after it's broken into lines

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

this is why a side float mechanism 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 preceding and following space, the 
height and depth of lines etc

> Joseph
> 
> *De : *Hans Hagen <mailto:j.hagen@xs4all.nl>
> *Envoyé le :*jeudi 19 juillet 2018 00:00
> *À : *Joseph Canedo <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:
> 
>  > Thanks Hans.
> 
>  >
> 
>  > Picked up today beta and some code I have relying on value of
> 
>  > tex.prevgraf starts breaking. This is lettrine related code that sets
> 
>  > hangafter for 1st paragraph and eventually subsequent if lettrine is
> 
>  > larger than 1st par.
> 
>  >
> 
>  > I see the function vspacing.synchronizepage() sets prevgraf value I
> 
>  > guess to avoid bleeding also paragraph lines.
> 
>  >
> 
>  > Is there any possibility to get original unchanged tex.prevgraf value,
> 
>  > 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 page with 5 lines
> 
> where/how does it fail
> 
> Hans
> 
> -----------------------------------------------------------------
> 
>                                             Hans Hagen | PRAGMA ADE
> 
>                 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> 
>          tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> 
> -----------------------------------------------------------------
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------



[-- Attachment #1.2: Type: text/html, Size: 13744 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-19 20:52             ` Joseph Canedo
@ 2018-07-20  8:51               ` Hans Hagen
  2018-07-20 22:01                 ` Joseph Canedo
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2018-07-20  8:51 UTC (permalink / raw)
  To: Joseph Canedo, mailing list for ConTeXt users

On 7/19/2018 10:52 PM, Joseph Canedo wrote:
> Finally I could make a MWE that reproduces the issue.
> 
> %%%%%%%%
> 
> %\setuplayout[grid=both] % uncommenting this makes last line not indented.
> 
> %\enabletrackers[vspacing.synchronizepage]
> 
> \starttext
> 
> \dorecurse{39}{ % other values like 40 do not show issue
> 
> A.
> 
> }
> 
> Chapitre.
> 
> \blank[0pt, samepage]
> 
> \hangindent=30pt\hangafter=-2Third par.\\
> 
> Second line.
> 
> \blank[0pt, samepage]
> 
> \hangindent=30pt\hangafter=-2 Fourth par not indented.\\ Second line not 
> indented.
> 
> \stoptext
it's probably more related to the wrong usage of \\ which you normally 
should not use at the end of aparagraoh (i'll make the remover for that 
a bit more clever)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-20  8:51               ` Hans Hagen
@ 2018-07-20 22:01                 ` Joseph Canedo
  2018-07-26 20:57                   ` Joseph Canedo
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Canedo @ 2018-07-20 22:01 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2071 bytes --]

I’ve modified the MWE to avoid the \\ and it shows same problem. I’ve used the \\ to make a par with 2 lines (lazy typing more words :-). In any case \\ or not, the \hang* directives do not seem taken in consideration in this particular case for last par. Other cases seem to work fine.

%\setuplayout[grid=both]
%\enabletrackers[vspacing.synchronizepage]

\starttext

\dorecurse{39}{
A.

}

Chapitre.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2Third par with some lengthy sentence. Second sentence. Third sentence. Fourth sentence. Fifth sentence.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2 Fourth par not indented. Lengthy sentence. Second sentence. Third sentence. Fourth sentence. Fifth sentence.

\stoptext



De : Hans Hagen
Envoyé le :vendredi 20 juillet 2018 10:51
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/19/2018 10:52 PM, Joseph Canedo wrote:
> Finally I could make a MWE that reproduces the issue.
> 
> %%%%%%%%
> 
> %\setuplayout[grid=both] % uncommenting this makes last line not indented.
> 
> %\enabletrackers[vspacing.synchronizepage]
> 
> \starttext
> 
> \dorecurse{39}{ % other values like 40 do not show issue
> 
> A.
> 
> }
> 
> Chapitre.
> 
> \blank[0pt, samepage]
> 
> \hangindent=30pt\hangafter=-2Third par.\\
> 
> Second line.
> 
> \blank[0pt, samepage]
> 
> \hangindent=30pt\hangafter=-2 Fourth par not indented.\\ Second line not 
> indented.
> 
> \stoptext
it's probably more related to the wrong usage of \\ which you normally 
should not use at the end of aparagraoh (i'll make the remover for that 
a bit more clever)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


[-- Attachment #1.2: Type: text/html, Size: 5352 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Issues with vertical spacing in simple case
  2018-07-20 22:01                 ` Joseph Canedo
@ 2018-07-26 20:57                   ` Joseph Canedo
  0 siblings, 0 replies; 12+ messages in thread
From: Joseph Canedo @ 2018-07-26 20:57 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2352 bytes --]

Thanks a lot for the fix.

De : Joseph Canedo
Envoyé le :samedi 21 juillet 2018 00:01
À : Hans Hagen; mailing list for ConTeXt users
Objet :RE: [NTG-context] Issues with vertical spacing in simple case

I’ve modified the MWE to avoid the \\ and it shows same problem. I’ve used the \\ to make a par with 2 lines (lazy typing more words :-). In any case \\ or not, the \hang* directives do not seem taken in consideration in this particular case for last par. Other cases seem to work fine.

%\setuplayout[grid=both]
%\enabletrackers[vspacing.synchronizepage]

\starttext

\dorecurse{39}{
A.

}

Chapitre.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2Third par with some lengthy sentence. Second sentence. Third sentence. Fourth sentence. Fifth sentence.
\blank[0pt, samepage]
\hangindent=30pt\hangafter=-2 Fourth par not indented. Lengthy sentence. Second sentence. Third sentence. Fourth sentence. Fifth sentence.

\stoptext



De : Hans Hagen
Envoyé le :vendredi 20 juillet 2018 10:51
À : Joseph Canedo; mailing list for ConTeXt users
Objet :Re: [NTG-context] Issues with vertical spacing in simple case

On 7/19/2018 10:52 PM, Joseph Canedo wrote:
> Finally I could make a MWE that reproduces the issue.
> 
> %%%%%%%%
> 
> %\setuplayout[grid=both] % uncommenting this makes last line not indented.
> 
> %\enabletrackers[vspacing.synchronizepage]
> 
> \starttext
> 
> \dorecurse{39}{ % other values like 40 do not show issue
> 
> A.
> 
> }
> 
> Chapitre.
> 
> \blank[0pt, samepage]
> 
> \hangindent=30pt\hangafter=-2Third par.\\
> 
> Second line.
> 
> \blank[0pt, samepage]
> 
> \hangindent=30pt\hangafter=-2 Fourth par not indented.\\ Second line not 
> indented.
> 
> \stoptext
it's probably more related to the wrong usage of \\ which you normally 
should not use at the end of aparagraoh (i'll make the remover for that 
a bit more clever)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------



[-- Attachment #1.2: Type: text/html, Size: 6833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-07-26 20:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 21:35 Issues with vertical spacing in simple case Joseph Canedo
2018-07-17 22:03 ` Hans Hagen
2018-07-18  9:10 ` Hans Hagen
2018-07-18 20:33   ` Joseph Canedo
2018-07-18 22:00     ` Hans Hagen
2018-07-19  6:55       ` Joseph Canedo
2018-07-19  7:35         ` Hans Hagen
2018-07-19 20:26           ` Joseph Canedo
2018-07-19 20:52             ` Joseph Canedo
2018-07-20  8:51               ` Hans Hagen
2018-07-20 22:01                 ` Joseph Canedo
2018-07-26 20:57                   ` Joseph Canedo

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).