[NTG-context] How to avoid a page break?

Wolfgang Schuster schuster.wolfgang at googlemail.com
Tue Nov 4 23:25:17 CET 2008


Am 04.11.2008 um 22:39 schrieb Marcin Borkowski:

> Dnia Tue, Nov 04, 2008 at 10:17:51PM +0100, Wolfgang Schuster  
> napisał(a):
>>
>> Am 04.11.2008 um 21:21 schrieb Marcin Borkowski:
>>
>>> Hi,
>>>
>>> I have the following in my code:
>>>
>>> \def\doPutTitle#1{%
>>> \startalignment[middle]
>>>   \bfb
>>>   \page[bigpreference]
>>>   \blank[2*big]
>>>   #1%
>>>   \page[no]%
>>>   \blank[big]%
>>>   \page[no]%
>>> \stopalignment
>>> \page[no]%
>>> }%
>>>
>>> Why is it still possible that I have a page break after, say,
>>> \doPutTitle{some title} (in MkII, in MkIV page breaks fall in
>>> different
>>> places).  Which percentage signs and \page[no]'s are unnecessary  
>>> here?
>>
>> \def\doPutTitle#1%
>>   {\page[bigpreference]
>>    \vbox\bgroup
>>    \raggedcenter
>>    #1%
>>    \egroup
>>    \nobreak\blank[big]}
>
> OK, though this looks rather low-level.  I was thinking about  
> something
> more user-friendly;).
>
> This raises a philosophical question: is it the "ConTeXt way" to use
> low-level constructs in environments and high-level in documents?   
> Or is
> it better to avoid low level whenever possible?  Also, your code mixes
> low-level commands (\vbox, which is a TeX prmitive, \raggedcenter,  
> which
> is a ConTeXt low-level command, I guess) and high-level ones (\blank).
> I understand that this ensures a uniform vertical spacing (\blank[big]
> is obviously better than \vskip 10pt;)), but I thought that it is
> against ConTeXt philosophy to use low-level stuff unless something
> really non-standard is needed.

Here is a better method, there is nothing wrong with low level but
you should know what you do.

\defineblankmethod [nobreak] {\nobreak}

\def\doPutTitle#1%
   {\framed[frame=offwidth=\textwidth,align=middle]{#1}%
    \blank[nobreak,line]}

Wolfgang



More information about the ntg-context mailing list