ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* About testing rest of space on a page
@ 2020-07-29 21:08 Willi Egger
  2020-07-30  7:05 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Willi Egger @ 2020-07-29 21:08 UTC (permalink / raw)
  To: NTG-Context ConTeXt users

Good evening!

I have a bookproject in which sections are ended with a small graphical element. Now as usual this graphic might be moved to a new page which is of course unwanted.

At this moment I have:

\startsetups endsection
  \vfil
  \placefigure[middle,none][]{}{\externalfigure[ornament2][height=2\lineheight]}
  \stopsection
\stopsetups

\def\stopmysection{\setups{endsection}}

I use then instead of \stopsection the \stopmysection. This works except that the ornament is in some cases placed on the next page. — My question is whether it is possible to do a \testpage and evaluate the result hereof and then using either the placement of the ornament and stop the section or just end the section without ornament?

Kind regards

Willi
___________________________________________________________________________________
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] 4+ messages in thread

* Re: About testing rest of space on a page
  2020-07-29 21:08 About testing rest of space on a page Willi Egger
@ 2020-07-30  7:05 ` Taco Hoekwater
  2020-07-30 19:25   ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2020-07-30  7:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 29 Jul 2020, at 23:08, Willi Egger <context@boede.nl> wrote:
> 
> Good evening!
> 
> I have a bookproject in which sections are ended with a small graphical element. Now as usual this graphic might be moved to a new page which is of course unwanted.
> 
> At this moment I have:
> 
> \startsetups endsection
>  \vfil
>  \placefigure[middle,none][]{}{\externalfigure[ornament2][height=2\lineheight]}
>  \stopsection
> \stopsetups
> 
> \def\stopmysection{\setups{endsection}}
> 
> I use then instead of \stopsection the \stopmysection. This works except that the ornament is in some cases placed on the next page. — My question is whether it is possible to do a \testpage and evaluate the result hereof and then using either the placement of the ornament and stop the section or just end the section without ornament?

You can put your setups *inside* the test:

  \definepagechecker
    [willi]
    [method=1,before=,after=,inbetween={\setups{endsection}}]

  \def\stopmysection
    {\checkpage[willi][lines=4]}

The before=/after= pair is used when a page break is forced by the test, inbetween= is used if there is no forced break.

(\testpage is a wrapper around \checkpage: 
 https://source.contextgarden.net/page-brk.mkiv?search=testpage#l564 )

Best wishes,
Taco

___________________________________________________________________________________
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] 4+ messages in thread

* Re: About testing rest of space on a page
  2020-07-30  7:05 ` Taco Hoekwater
@ 2020-07-30 19:25   ` Wolfgang Schuster
  2020-07-30 20:38     ` Willi Egger
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2020-07-30 19:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Taco Hoekwater schrieb am 30.07.2020 um 09:05:
>> On 29 Jul 2020, at 23:08, Willi Egger <context@boede.nl> wrote:
>>
>> Good evening!
>>
>> I have a bookproject in which sections are ended with a small graphical element. Now as usual this graphic might be moved to a new page which is of course unwanted.
>>
>> At this moment I have:
>>
>> \startsetups endsection
>>   \vfil
>>   \placefigure[middle,none][]{}{\externalfigure[ornament2][height=2\lineheight]}
>>   \stopsection
>> \stopsetups
>>
>> \def\stopmysection{\setups{endsection}}
>>
>> I use then instead of \stopsection the \stopmysection. This works except that the ornament is in some cases placed on the next page. — My question is whether it is possible to do a \testpage and evaluate the result hereof and then using either the placement of the ornament and stop the section or just end the section without ornament?
> You can put your setups *inside* the test:
>
>    \definepagechecker
>      [willi]
>      [method=1,before=,after=,inbetween={\setups{endsection}}]
>
>    \def\stopmysection
>      {\checkpage[willi][lines=4]}
>
> The before=/after= pair is used when a page break is forced by the test, inbetween= is used if there is no forced break.
>
> (\testpage is a wrapper around \checkpage:
>   https://source.contextgarden.net/page-brk.mkiv?search=testpage#l564 )

No need for a new \stop command.

\setuphead
   [section]
   [aftersection={\checkpage[willi][lines=4]}]

Wolfgang

___________________________________________________________________________________
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] 4+ messages in thread

* Re: About testing rest of space on a page
  2020-07-30 19:25   ` Wolfgang Schuster
@ 2020-07-30 20:38     ` Willi Egger
  0 siblings, 0 replies; 4+ messages in thread
From: Willi Egger @ 2020-07-30 20:38 UTC (permalink / raw)
  To: NTG-Context ConTeXt users

Hello Taco and Wolfgang!

Thank you both for the reply and input. — I am going to play :-)

Kind regards

Willi

> On 30 Jul 2020, at 21:25, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> Taco Hoekwater schrieb am 30.07.2020 um 09:05:
>>> On 29 Jul 2020, at 23:08, Willi Egger <context@boede.nl> wrote:
>>> 
>>> Good evening!
>>> 
>>> I have a bookproject in which sections are ended with a small graphical element. Now as usual this graphic might be moved to a new page which is of course unwanted.
>>> 
>>> At this moment I have:
>>> 
>>> \startsetups endsection
>>> \vfil
>>> \placefigure[middle,none][]{}{\externalfigure[ornament2][height=2\lineheight]}
>>> \stopsection
>>> \stopsetups
>>> 
>>> \def\stopmysection{\setups{endsection}}
>>> 
>>> I use then instead of \stopsection the \stopmysection. This works except that the ornament is in some cases placed on the next page. — My question is whether it is possible to do a \testpage and evaluate the result hereof and then using either the placement of the ornament and stop the section or just end the section without ornament?
>> You can put your setups *inside* the test:
>> 
>>  \definepagechecker
>>    [willi]
>>    [method=1,before=,after=,inbetween={\setups{endsection}}]
>> 
>>  \def\stopmysection
>>    {\checkpage[willi][lines=4]}
>> 
>> The before=/after= pair is used when a page break is forced by the test, inbetween= is used if there is no forced break.
>> 
>> (\testpage is a wrapper around \checkpage:
>> https://source.contextgarden.net/page-brk.mkiv?search=testpage#l564 )
> 
> No need for a new \stop command.
> 
> \setuphead
>  [section]
>  [aftersection={\checkpage[willi][lines=4]}]
> 
> Wolfgang
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2020-07-30 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 21:08 About testing rest of space on a page Willi Egger
2020-07-30  7:05 ` Taco Hoekwater
2020-07-30 19:25   ` Wolfgang Schuster
2020-07-30 20:38     ` Willi Egger

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