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.ha...@xs4all.nl>
*Envoyé le :*jeudi 19 juillet 2018 00:00
*À : *Joseph Canedo <mailto:josephcan...@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
___________________________________________________________________________________

Reply via email to