ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* moving the first line of a page to the previous page
@ 2018-10-09 11:32 mf
  2018-10-09 12:03 ` Hans Hagen
  2018-10-09 12:42 ` luigi scarso
  0 siblings, 2 replies; 3+ messages in thread
From: mf @ 2018-10-09 11:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]

Hello list,
sometimes ConTeXt moves the (would-be) last line of a page to the next 
page, even when there's room for it at the bottom of a page, before the 
footnotes.

Sometimes i understand why it does so: when the line contains a footnote 
that would increase the footnotes' height, for example; or when you have 
widows or orphans.

But sometimes it happens in an inexplicable way: in some pages there's 
room at the bottom and it keeps the last line, in some other pages 
there's more room (than in the previous case), but it moves the last 
line to the next page anyway.
Even looking at hyphenations, i can't find an explanation fot that 
behaviour.

So i'm looking for a way to prevent ConTeXt from moving the last line to 
the next page.

A solution i found is to insert a \vadjust{\kern -0.5pt} in the 
second-last line of the page. It works -- see the attachments -- but it 
modifies the interline, so it's feasible only for corrections under 1pt.

Another way would be locally shrinking the space before footnotes, but i 
don't know how and when to do it.

Some words about the attachments:

- there are some footnotes and line height setups to resemble the real 
configuration i'm working with

- keep-line-in-page-0.tex is the reference case

- keep-line-in-page-1.tex is the solution with \vadjust{\kern -0.5pt}

Best wishes,
Massimiliano

[-- Attachment #2: keep-line-in-page-0.tex --]
[-- Type: text/x-tex, Size: 1663 bytes --]

\definevspacingamount[glueOverFootnotes][18pt plus 18pt minus 6pt]

\setupnotation[
  alternative=serried,
  style=\ss,
  numberstopper=,
  way=bypage,
  distance=1pt,
  location=page]

\setupnote[
  alternative=serried,
  paragraph=yes,
  bodyfont=small,
  inbetween=\penalty10000{ }\emdash{}{ }\penalty-100,  % \emdash{}
  location=page,
  before={\blank[glueOverFootnotes]},
  height=10cm]

\definebodyfontenvironment[11pt][interline=12pt]
\setupbodyfont[11pt]

\starttext
\showgrid
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\footnote{a footnote}\par

\blank[12*line,fixed]

Lorem ipsum dolor sit amet, consectetur adipiscing elit.\footnote{another footnote}

\blank[12*line,fixed]

Lorem ipsum dolor sit amet, consectetur adipiscing elit.% \footnote{another
% longer footnote: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
% Ut mattis volutpat elit sit amet fermentum.}

\blank[12*line,fixed]

Quisque vel arcu ut tellus congue vulputate. Praesent nec tortor vitae
nibh elementum semper. Cras sit amet turpis ac quam bibendum interdum.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Maecenas ac mi sed nisl bibendum ultricies.
Nullam ac augue non ex euismod fermentum id quis nulla.
Cras vel lorem aliquet eros maximus interdum nec fermentum ligula.
Cras eu eros nec justo blandit ullamcorper ut et magna.
Curabitur aliquam nunc at pharetra semper.
Pellentesque vel lectus ut diam varius vestibulum. Etiam non varius erat.
Nunc scelerisque, dolor sit amet feugiat vestibulum, nulla erat eleifend
mauris, eget ultricies neque velit non neque. Donec vitae tempus est,
a feugiat magna.

\stoptext

[-- Attachment #3: keep-line-in-page-1.tex --]
[-- Type: text/x-tex, Size: 1684 bytes --]

\definevspacingamount[glueOverFootnotes][18pt plus 18pt minus 6pt]

\setupnotation[
  alternative=serried,
  style=\ss,
  numberstopper=,
  way=bypage,
  distance=1pt,
  location=page]

\setupnote[
  alternative=serried,
  paragraph=yes,
  bodyfont=small,
  inbetween=\penalty10000{ }\emdash{}{ }\penalty-100,  % \emdash{}
  location=page,
  before={\blank[glueOverFootnotes]},
  height=10cm]

\definebodyfontenvironment[11pt][interline=12pt]
\setupbodyfont[11pt]

\starttext
\showgrid
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\footnote{a footnote}\par

\blank[12*line,fixed]

Lorem ipsum dolor sit amet, consectetur adipiscing elit.\footnote{another footnote}

\blank[12*line,fixed]

Lorem ipsum dolor sit amet, consectetur adipiscing elit.% \footnote{another
% longer footnote: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
% Ut mattis volutpat elit sit amet fermentum.}

\blank[12*line,fixed]

Quisque vel arcu ut tellus congue vulputate. Praesent nec tortor vitae
nibh elementum semper. Cras sit amet turpis ac quam bibendum interdum.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. \vadjust{\kern -.5pt}Maecenas ac mi sed nisl bibendum ultricies.
Nullam ac augue non ex euismod fermentum id quis nulla.
Cras vel lorem aliquet eros maximus interdum nec fermentum ligula.
Cras eu eros nec justo blandit ullamcorper ut et magna.
Curabitur aliquam nunc at pharetra semper.
Pellentesque vel lectus ut diam varius vestibulum. Etiam non varius erat.
Nunc scelerisque, dolor sit amet feugiat vestibulum, nulla erat eleifend
mauris, eget ultricies neque velit non neque. Donec vitae tempus est,
a feugiat magna.

\stoptext

[-- Attachment #4: 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] 3+ messages in thread

* Re: moving the first line of a page to the previous page
  2018-10-09 11:32 moving the first line of a page to the previous page mf
@ 2018-10-09 12:03 ` Hans Hagen
  2018-10-09 12:42 ` luigi scarso
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2018-10-09 12:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users, mf

On 10/9/2018 1:32 PM, mf wrote:
> Hello list,
> sometimes ConTeXt moves the (would-be) last line of a page to the next 
> page, even when there's room for it at the bottom of a page, before the 
> footnotes.
> 
> Sometimes i understand why it does so: when the line contains a footnote 
> that would increase the footnotes' height, for example; or when you have 
> widows or orphans.
> 
> But sometimes it happens in an inexplicable way: in some pages there's 
> room at the bottom and it keeps the last line, in some other pages 
> there's more room (than in the previous case), but it moves the last 
> line to the next page anyway.
> Even looking at hyphenations, i can't find an explanation fot that 
> behaviour.

you can mess with penalties but at somepoint tex has to decide ... an 
option is to use \adaptlayout and make the page a line higher, another is

\starttext

\showframe

\dorecurse{22}{line #1\blank}
% \dorecurse{24}{line #1\blank}

\keeplinestogether{100} \input klein

\stoptext

but of course there can be side effects


> So i'm looking for a way to prevent ConTeXt from moving the last line to 
> the next page.
> 
> A solution i found is to insert a \vadjust{\kern -0.5pt} in the 
> second-last line of the page. It works -- see the attachments -- but it 
> modifies the interline, so it's feasible only for corrections under 1pt.
> 
> Another way would be locally shrinking the space before footnotes, but i 
> don't know how and when to do it.
> 
> Some words about the attachments:
> 
> - there are some footnotes and line height setups to resemble the real 
> configuration i'm working with
> 
> - keep-line-in-page-0.tex is the reference case
> 
> - keep-line-in-page-1.tex is the solution with \vadjust{\kern -0.5pt}
> 
> Best wishes,
> Massimiliano
> 
> 
> ___________________________________________________________________________________
> 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] 3+ messages in thread

* Re: moving the first line of a page to the previous page
  2018-10-09 11:32 moving the first line of a page to the previous page mf
  2018-10-09 12:03 ` Hans Hagen
@ 2018-10-09 12:42 ` luigi scarso
  1 sibling, 0 replies; 3+ messages in thread
From: luigi scarso @ 2018-10-09 12:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

On Tue, Oct 9, 2018 at 1:33 PM mf <massifr@fastwebnet.it> wrote:

> Hello list,
> sometimes ConTeXt moves the (would-be) last line of a page to the next
> page, even when there's room for it at the bottom of a page, before the
> footnotes.
>
> Sometimes i understand why it does so: when the line contains a footnote
> that would increase the footnotes' height, for example; or when you have
> widows or orphans.
>
> But sometimes it happens in an inexplicable way: in some pages there's
> room at the bottom and it keeps the last line, in some other pages
> there's more room (than in the previous case), but it moves the last
> line to the next page anyway.
> Even looking at hyphenations, i can't find an explanation fot that
> behaviour.
>
> There is no room for the next object you are inserting.
Isolate the point and try
\tracingpages\plusone
\tracingoutput\plusone
\showboxbreadth\maxdimen
\showboxdepth\maxdimen


--
luigi

[-- Attachment #1.2: Type: text/html, Size: 1427 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] 3+ messages in thread

end of thread, other threads:[~2018-10-09 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 11:32 moving the first line of a page to the previous page mf
2018-10-09 12:03 ` Hans Hagen
2018-10-09 12:42 ` luigi scarso

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