ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* The whole (sub)section on a single page
@ 2005-11-12 23:55 Mojca Miklavec
  2005-11-13 13:58 ` Taco Hoekwater
  0 siblings, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2005-11-12 23:55 UTC (permalink / raw)


Hello,

I would like to have the whole (sub)section on a single page unless it
doesn't fit on one page (in this case I don't mind if it starts on a
new page or simply continues on the old one, but it should break
somewhere, that's why putting the content into a \vbox doesn't solve
the problem).


This is perhaps already described somewhere in the documentation, but
I don't know where to look for it (well, I could start reading the
source code for split=yes; perhaps \vsplit could help, but don't know
how exactly to apply it). I can solve the problem temporary by
manually placing page breaks, but I guess that there exists some
really short, simple & elegant solutions for it.

It doesn't need to automatically determine the subsection boundaries
automatically (although this would be great), so I can write something
like this:

\startmaterialforonepage
\subsection{split only if too long for one page}
\dorecurse{10}{whatever comes here \dots }
\stopmaterialforonepage

Thank you,
    Mojca

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

* Re: The whole (sub)section on a single page
  2005-11-12 23:55 The whole (sub)section on a single page Mojca Miklavec
@ 2005-11-13 13:58 ` Taco Hoekwater
  2005-11-14 18:11   ` Mojca Miklavec
  0 siblings, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2005-11-13 13:58 UTC (permalink / raw)


Mojca Miklavec wrote:
> It doesn't need to automatically determine the subsection boundaries
> automatically (although this would be great), so I can write something
> like this:
> 
> \startmaterialforonepage
> \subsection{split only if too long for one page}
> \dorecurse{10}{whatever comes here \dots }
> \stopmaterialforonepage

Do you want something like this?

   \long\def\startmaterialforonepage#1\stopmaterialforonepage%
     {\setbox0\vbox{#1}\ifdim\ht0<\textheight \page\fi #1}

Taco

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

* Re: The whole (sub)section on a single page
  2005-11-13 13:58 ` Taco Hoekwater
@ 2005-11-14 18:11   ` Mojca Miklavec
  2005-11-14 19:39     ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2005-11-14 18:11 UTC (permalink / raw)


Taco Hoekwater wrote:
> Mojca Miklavec wrote:
> > It doesn't need to automatically determine the subsection boundaries
> > automatically (although this would be great), so I can write something
> > like this:
> >
> > \startmaterialforonepage
> > \subsection{split only if too long for one page}
> > \dorecurse{10}{whatever comes here \dots }
> > \stopmaterialforonepage
>
> Do you want something like this?
>
>    \long\def\startmaterialforonepage#1\stopmaterialforonepage%
>      {\setbox0\vbox{#1}\ifdim\ht0<\textheight \page\fi #1}

Thak you, Taco. Yes, this is almost exactly what I wanted to do,
except that I would substitute
    \ifdim\ht0<\textheight
with
    \ifdim\ht0<\theremainingpageheight

How/where can I get \theremainingpageheight? I saw some strange
"keywords" like \pagegoal, \pagetotal spread through the source, ...
but I have no clue what they are for and if they have anyting to do
with what I'm looking for.

Thans a lot,
    Mojca

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

* Re: The whole (sub)section on a single page
  2005-11-14 18:11   ` Mojca Miklavec
@ 2005-11-14 19:39     ` Hans Hagen
  2005-11-15  8:15       ` Mojca Miklavec
  2005-12-01  8:35       ` Christopher Creutzig
  0 siblings, 2 replies; 9+ messages in thread
From: Hans Hagen @ 2005-11-14 19:39 UTC (permalink / raw)


Mojca Miklavec wrote:

>Taco Hoekwater wrote:
>  
>
>>Mojca Miklavec wrote:
>>    
>>
>>>It doesn't need to automatically determine the subsection boundaries
>>>automatically (although this would be great), so I can write something
>>>like this:
>>>
>>>\startmaterialforonepage
>>>\subsection{split only if too long for one page}
>>>\dorecurse{10}{whatever comes here \dots }
>>>\stopmaterialforonepage
>>>      
>>>
>>Do you want something like this?
>>
>>   \long\def\startmaterialforonepage#1\stopmaterialforonepage%
>>     {\setbox0\vbox{#1}\ifdim\ht0<\textheight \page\fi #1}
>>    
>>
>
>Thak you, Taco. Yes, this is almost exactly what I wanted to do,
>except that I would substitute
>    \ifdim\ht0<\textheight
>with
>    \ifdim\ht0<\theremainingpageheight
>
>How/where can I get \theremainingpageheight? I saw some strange
>"keywords" like \pagegoal, \pagetotal spread through the source, ...
>but I have no clue what they are for and if they have anyting to do
>with what I'm looking for.
>  
>
that's always tricky, because it's not really possible to determine the 
rest of the available space without entering the output routing, which 
then spoils spacing

(there is \testpage[n] with n being a minimal number of lines, so, 
\testpage[10] will move to the next page if there are less than 10 lines)

Hans

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

* Re: The whole (sub)section on a single page
  2005-11-14 19:39     ` Hans Hagen
@ 2005-11-15  8:15       ` Mojca Miklavec
  2005-11-15  9:38         ` Hans Hagen
  2005-12-01  8:35       ` Christopher Creutzig
  1 sibling, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2005-11-15  8:15 UTC (permalink / raw)


Hans Hagen wrote:
> Mojca Miklavec wrote:
> >Taco Hoekwater wrote:
> >>Mojca Miklavec wrote:
> >>
> >>
> >>>It doesn't need to automatically determine the subsection boundaries
> >>>automatically (although this would be great), so I can write something
> >>>like this:
> >>>
> >>>\startmaterialforonepage
> >>>\subsection{split only if too long for one page}
> >>>\dorecurse{10}{whatever comes here \dots }
> >>>\stopmaterialforonepage
> >>>
> >>>
> >>Do you want something like this?
> >>
> >>   \long\def\startmaterialforonepage#1\stopmaterialforonepage%
> >>     {\setbox0\vbox{#1}\ifdim\ht0<\textheight \page\fi #1}
> >>
> >>
> >
> >Thak you, Taco. Yes, this is almost exactly what I wanted to do,
> >except that I would substitute
> >    \ifdim\ht0<\textheight
> >with
> >    \ifdim\ht0<\theremainingpageheight
> >
> >How/where can I get \theremainingpageheight? I saw some strange
> >"keywords" like \pagegoal, \pagetotal spread through the source, ...
> >but I have no clue what they are for and if they have anyting to do
> >with what I'm looking for.
> >
> >
> that's always tricky, because it's not really possible to determine the
> rest of the available space without entering the output routing, which
> then spoils spacing
>
> (there is \testpage[n] with n being a minimal number of lines, so,
> \testpage[10] will move to the next page if there are less than 10 lines)

Thank you, Hans. I have to refresh my knowledge about the syntax and
I'll try it out. Making
    \setbox0\vbox{#1}
and then executing the \testpage with "ceil(ht0 / lineheight)" should
then work OK, I hope.


I understand the problem of the approach that I asked for: as soon as
someone enters a \vfill(l) or \vss, it's approximately impossible to
determine where the text on the page ends. But in the first
approximation I would be satisfied with the empty space that would
remain if the document ended at that specific place.

That information is also very valuable when trying to put pictures on
slides, where picture has to be as big as possible, but still has to
fit on the space under the title (I tuned them manually, which was OK
for just a couple of slides).

Thank you,
    Mojca

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

* Re: The whole (sub)section on a single page
  2005-11-15  8:15       ` Mojca Miklavec
@ 2005-11-15  9:38         ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2005-11-15  9:38 UTC (permalink / raw)


Mojca Miklavec wrote:

>Hans Hagen wrote:
>  
>
>>Mojca Miklavec wrote:
>>    
>>
>>>Taco Hoekwater wrote:
>>>      
>>>
>>>>Mojca Miklavec wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>It doesn't need to automatically determine the subsection boundaries
>>>>>automatically (although this would be great), so I can write something
>>>>>like this:
>>>>>
>>>>>\startmaterialforonepage
>>>>>\subsection{split only if too long for one page}
>>>>>\dorecurse{10}{whatever comes here \dots }
>>>>>\stopmaterialforonepage
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>Do you want something like this?
>>>>
>>>>  \long\def\startmaterialforonepage#1\stopmaterialforonepage%
>>>>    {\setbox0\vbox{#1}\ifdim\ht0<\textheight \page\fi #1}
>>>>
>>>>
>>>>        
>>>>
>>>Thak you, Taco. Yes, this is almost exactly what I wanted to do,
>>>except that I would substitute
>>>   \ifdim\ht0<\textheight
>>>with
>>>   \ifdim\ht0<\theremainingpageheight
>>>
>>>How/where can I get \theremainingpageheight? I saw some strange
>>>"keywords" like \pagegoal, \pagetotal spread through the source, ...
>>>but I have no clue what they are for and if they have anyting to do
>>>with what I'm looking for.
>>>
>>>
>>>      
>>>
>>that's always tricky, because it's not really possible to determine the
>>rest of the available space without entering the output routing, which
>>then spoils spacing
>>
>>(there is \testpage[n] with n being a minimal number of lines, so,
>>\testpage[10] will move to the next page if there are less than 10 lines)
>>    
>>
>
>Thank you, Hans. I have to refresh my knowledge about the syntax and
>I'll try it out. Making
>    \setbox0\vbox{#1}
>and then executing the \testpage with "ceil(ht0 / lineheight)" should
>then work OK, I hope.
>  
>
even that is tricky, imagine your method (along the lines):

- \setbox0\vbox{\startitemize ... \stopitemize}
- measure and decide if \page is needed 
- \unvbox0

putting something in a box prevents for instance \blank looking back and getting the 
spacing right (context goes to a large extent to get spacing right) 

<text ... > 
<blank or interpar space and if needed depth correction>
<vbox with embedded blanks leading to too much whitespace> 
<text .... preceded by tex's auto skips that can't look into the box> 

even unvboxing does not help since esp the top of box damage has been done and is irreversible unless you do clever trickery 

officially you need something

\startboxed ... \stopboxed 

where the start/stop do some housekeeping

what you can try is to define an instance of framedtext (\startframedtext \stopframedtext) with no offsets and frame since that macro does reasonable job on spacing and still keeps things together 

Hans 




>I understand the problem of the approach that I asked for: as soon as
>someone enters a \vfill(l) or \vss, it's approximately impossible to
>determine where the text on the page ends. But in the first
>approximation I would be satisfied with the empty space that would
>remain if the document ended at that specific place.
>
>That information is also very valuable when trying to put pictures on
>slides, where picture has to be as big as possible, but still has to
>fit on the space under the title (I tuned them manually, which was OK
>for just a couple of slides).
>
>Thank you,
>    Mojca
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>  
>

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

* Re: The whole (sub)section on a single page
  2005-11-14 19:39     ` Hans Hagen
  2005-11-15  8:15       ` Mojca Miklavec
@ 2005-12-01  8:35       ` Christopher Creutzig
  2005-12-01  9:29         ` Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Christopher Creutzig @ 2005-12-01  8:35 UTC (permalink / raw)


Hans Hagen wrote:

>>How/where can I get \theremainingpageheight? I saw some strange
>>"keywords" like \pagegoal, \pagetotal spread through the source, ...
>>but I have no clue what they are for and if they have anyting to do
>>with what I'm looking for.
>> 
>>
> 
> that's always tricky, because it's not really possible to determine the 
> rest of the available space without entering the output routing, which 

 The standard trick would be not to explicitly check some numbers but to
do what in low-level looks like

\!!dimena=\ht0\advance\!!dimena\dp0%
\penalty10000\vskip\!!dimena\penalty10\vskip-\!!dimena

Is there any nice ConTeXt way of doing the above?


regards,
	Christopher

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

* Re: The whole (sub)section on a single page
  2005-12-01  8:35       ` Christopher Creutzig
@ 2005-12-01  9:29         ` Hans Hagen
  2005-12-06 22:00           ` Christopher Creutzig
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2005-12-01  9:29 UTC (permalink / raw)


Christopher Creutzig wrote:

>Hans Hagen wrote:
>
>  
>
>>>How/where can I get \theremainingpageheight? I saw some strange
>>>"keywords" like \pagegoal, \pagetotal spread through the source, ...
>>>but I have no clue what they are for and if they have anyting to do
>>>with what I'm looking for.
>>>
>>>
>>>      
>>>
>>that's always tricky, because it's not really possible to determine the 
>>rest of the available space without entering the output routing, which 
>>    
>>
>
> The standard trick would be not to explicitly check some numbers but to
>do what in low-level looks like
>
>\!!dimena=\ht0\advance\!!dimena\dp0%
>\penalty10000\vskip\!!dimena\penalty10\vskip-\!!dimena
>
>Is there any nice ConTeXt way of doing the above?
>  
>
\testpage[1] % one line, [3] three lines

Hans

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

* Re: The whole (sub)section on a single page
  2005-12-01  9:29         ` Hans Hagen
@ 2005-12-06 22:00           ` Christopher Creutzig
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher Creutzig @ 2005-12-06 22:00 UTC (permalink / raw)


Hans Hagen wrote:
> Christopher Creutzig wrote:

>>The standard trick would be not to explicitly check some numbers but to
>>do what in low-level looks like
>>
>>\!!dimena=\ht0\advance\!!dimena\dp0%
>>\penalty10000\vskip\!!dimena\penalty10\vskip-\!!dimena
>>
>>Is there any nice ConTeXt way of doing the above?
>> 
>>
> 
> \testpage[1] % one line, [3] three lines

 Sure, but I'm not asking for n lines, but for a dimension. Oh, if I
read the source correctly, \testpage[0][\dimexpr\dp0+\ht0\relax] should
work, right?


Regards,
	Christopher

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

end of thread, other threads:[~2005-12-06 22:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-12 23:55 The whole (sub)section on a single page Mojca Miklavec
2005-11-13 13:58 ` Taco Hoekwater
2005-11-14 18:11   ` Mojca Miklavec
2005-11-14 19:39     ` Hans Hagen
2005-11-15  8:15       ` Mojca Miklavec
2005-11-15  9:38         ` Hans Hagen
2005-12-01  8:35       ` Christopher Creutzig
2005-12-01  9:29         ` Hans Hagen
2005-12-06 22:00           ` Christopher Creutzig

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