ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Joseph Canedo <josephcanedo@gmail.com>
To: Hans Hagen <j.hagen@xs4all.nl>,
	 mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Issues with vertical spacing in simple case
Date: Thu, 19 Jul 2018 22:26:15 +0200	[thread overview]
Message-ID: <5b50f3e5.1c69fb81.818e2.0e39@mx.google.com> (raw)
In-Reply-To: <59e352b0-e497-9b84-94de-1e1fa2c43164@xs4all.nl>


[-- 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
___________________________________________________________________________________

  reply	other threads:[~2018-07-19 20:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17 21:35 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 [this message]
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

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=5b50f3e5.1c69fb81.818e2.0e39@mx.google.com \
    --to=josephcanedo@gmail.com \
    --cc=j.hagen@xs4all.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).