* blank line and signals
@ 2010-03-14 14:07 Andreas Harder
2010-03-14 16:19 ` Hans Hagen
2010-03-16 0:32 ` Wolfgang Schuster
0 siblings, 2 replies; 9+ messages in thread
From: Andreas Harder @ 2010-03-14 14:07 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi all,
please have a look at the following example:
\newsignal\SectionSignal
\def\TestSpace%
{\relax\ifdim\lastskip=\SectionSignal \blank[nowhite]
\else \blank \fi}
\setuphead[section] [after=\blank\vskip\SectionSignal]
\setuphead[subsection][before=\TestSpace]
\starttext
\startcolumns
\section{Section}
\subsection{Subsection}
\dorecurse{50}{some text, }
\stopcolumns
\stoptext
If one removes the blank line after \section{Section} the output is correct, otherwise \TestSpace is ignored …
I'm quite sure it worked a couple of weeks before.
Best regards
Andreas
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-14 14:07 blank line and signals Andreas Harder
@ 2010-03-14 16:19 ` Hans Hagen
2010-03-14 16:27 ` Wolfgang Schuster
2010-03-16 0:32 ` Wolfgang Schuster
1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2010-03-14 16:19 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 14-3-2010 15:07, Andreas Harder wrote:
> Hi all,
>
> please have a look at the following example:
>
> \newsignal\SectionSignal
>
> \def\TestSpace%
> {\relax\ifdim\lastskip=\SectionSignal \blank[nowhite]
> \else \blank \fi}
>
> \setuphead[section] [after=\blank\vskip\SectionSignal]
> \setuphead[subsection][before=\TestSpace]
>
> \starttext
> \startcolumns
> \section{Section}
>
> \subsection{Subsection}
>
> \dorecurse{50}{some text, }
> \stopcolumns
> \stoptext
>
> If one removes the blank line after \section{Section} the output is correct, otherwise \TestSpace is ignored …
>
> I'm quite sure it worked a couple of weeks before.
in mkiv? probbably not ... for what do you need that kind of trickery?
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-14 16:19 ` Hans Hagen
@ 2010-03-14 16:27 ` Wolfgang Schuster
2010-03-14 16:45 ` Hans Hagen
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2010-03-14 16:27 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 14.03.10 17:19, schrieb Hans Hagen:
>> I'm quite sure it worked a couple of weeks before.
> in mkiv? probbably not ... for what do you need that kind of trickery?
It worked before you enabled the new spacing mechanism in MKIV.
The code was meant to change the distance between consecutive headers.
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-14 16:27 ` Wolfgang Schuster
@ 2010-03-14 16:45 ` Hans Hagen
2010-03-14 17:00 ` Wolfgang Schuster
0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2010-03-14 16:45 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 14-3-2010 17:27, Wolfgang Schuster wrote:
> Am 14.03.10 17:19, schrieb Hans Hagen:
>>> I'm quite sure it worked a couple of weeks before.
>> in mkiv? probbably not ... for what do you need that kind of trickery?
> It worked before you enabled the new spacing mechanism in MKIV.
>
> The code was meant to change the distance between consecutive headers.
using a kern instead of a vskip might work
(an alternative is to look into skips with higher/lower priority)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-14 16:45 ` Hans Hagen
@ 2010-03-14 17:00 ` Wolfgang Schuster
2010-03-14 17:50 ` Hans Hagen
0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2010-03-14 17:00 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
Am 14.03.10 17:45, schrieb Hans Hagen:
> using a kern instead of a vskip might work
the problem is not the skip of the section but the information whether
the current
header follows another header immediately or there is normal text before.
In MKII lastskip result in 1pt after both vertical skips while in MKIV
the first
lastskip is the sum of the blank and the vskip.
\starttext
\the\lastskip
\vskip1pt
\the\lastskip
\blank[small]\vskip1pt
\the\lastskip
\stoptext
Since i have a solution for this which doesn't require lastskip i don't care
about this difference but it would be interesting why this happens.
\starttext
\vskip1pt\vskip1pt
\the\lastskip
\stoptext
MKII: 1.0pt
MKIV: 2.0pt
> (an alternative is to look into skips with higher/lower priority)
I guess this requires Lua code.
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-14 17:00 ` Wolfgang Schuster
@ 2010-03-14 17:50 ` Hans Hagen
0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2010-03-14 17:50 UTC (permalink / raw)
To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users
On 14-3-2010 18:00, Wolfgang Schuster wrote:
> \starttext
>
> \vskip1pt\vskip1pt
>
> \the\lastskip
>
> \stoptext
>
> MKII: 1.0pt
> MKIV: 2.0pt
In mkii we only see the last skip, i.e. we get 1pt. In mkiv the skips
are collapsed so we get 2pt reported.
>> (an alternative is to look into skips with higher/lower priority)
> I guess this requires Lua code.
\starttext
test
\blank[line]
test
\blank[4*line]
\blank[1*line,strong]
test
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-14 14:07 blank line and signals Andreas Harder
2010-03-14 16:19 ` Hans Hagen
@ 2010-03-16 0:32 ` Wolfgang Schuster
2010-03-16 9:32 ` Andreas Harder
1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2010-03-16 0:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 14.03.10 15:07, schrieb Andreas Harder:
> If one removes the blank line after \section{Section} the output is correct, otherwise \TestSpace is ignored …
>
\def\DefineSectionBlank
{\dotripleempty\doDefineSectionBlank}
\def\doDefineSectionBlank[#1][#2][#3]#4%
{\edef\CurrentSection{#1}%
\setvalue{#1:#2:\ifthirdargument\the\dimexpr#3\relax\fi}{#4}}
\def\SectionBlank#1#2%
{\edef\CurrentSection{#1}%
\executeifdefined{#1:#2:\LastSectionBlankSignal}{\executeifdefined{#1:#2:\the\dimexpr\zeropoint\relax}{\getvalue{#1:#2:}}}%
\doif{#2}{after}{\SectionBlankSignal}}
\let\LastSectionBlankSignal\zeropoint
\EveryPar{\let\LastSectionBlankSignal\zeropoint}
\def\SectionBlankSignal
{\setevalue{LastSectionBlankSignal}{\the\dimexpr\csname\CurrentSection
Signal\endcsname\relax}}
% chapter
\DefineSectionBlank [Chapter] [before] {\blank[force,48pt]}
\DefineSectionBlank [Chapter] [after] {\blank[20pt]}
\newsignal\ChapterSignal
\setuphead
[chapter]
[before=\SectionBlank{Chapter}{before},
after=\SectionBlank{Chapter}{after}]
% section
\newsignal\SectionSignal
\DefineSectionBlank [Section] [before] [\ChapterSignal] {\blank[18pt]}
\DefineSectionBlank [Section] [before] {\blank[24pt]}
\DefineSectionBlank [Section] [after] {\blank[18pt]}
\setuphead
[section]
[before=\SectionBlank{Section}{before},
after=\SectionBlank{Section}{after}]
\showgrid
\starttext
\chapter{Chapter}
\section{Section}
\chapter{Chapter}\edef\CurrentSection{Section}\SectionBlankSignal % tell
\section the last header was \section too!
\section{Section}
\chapter{Chapter}
text
\section{Section}
\stoptext
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-16 0:32 ` Wolfgang Schuster
@ 2010-03-16 9:32 ` Andreas Harder
2010-03-16 9:59 ` Steffen Wolfrum
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Harder @ 2010-03-16 9:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 2242 bytes --]
Am 16.03.2010 um 01:32 schrieb Wolfgang Schuster:
> Am 14.03.10 15:07, schrieb Andreas Harder:
>> If one removes the blank line after \section{Section} the output is correct, otherwise \TestSpace is ignored …
>>
> \def\DefineSectionBlank
> {\dotripleempty\doDefineSectionBlank}
>
> \def\doDefineSectionBlank[#1][#2][#3]#4%
> {\edef\CurrentSection{#1}%
> \setvalue{#1:#2:\ifthirdargument\the\dimexpr#3\relax\fi}{#4}}
>
> \def\SectionBlank#1#2%
> {\edef\CurrentSection{#1}%
> \executeifdefined{#1:#2:\LastSectionBlankSignal}{\executeifdefined{#1:#2:\the\dimexpr\zeropoint\relax}{\getvalue{#1:#2:}}}%
> \doif{#2}{after}{\SectionBlankSignal}}
>
> \let\LastSectionBlankSignal\zeropoint
>
> \EveryPar{\let\LastSectionBlankSignal\zeropoint}
>
> \def\SectionBlankSignal
> {\setevalue{LastSectionBlankSignal}{\the\dimexpr\csname\CurrentSection Signal\endcsname\relax}}
>
> % chapter
>
> \DefineSectionBlank [Chapter] [before] {\blank[force,48pt]}
> \DefineSectionBlank [Chapter] [after] {\blank[20pt]}
>
> \newsignal\ChapterSignal
>
> \setuphead
> [chapter]
> [before=\SectionBlank{Chapter}{before},
> after=\SectionBlank{Chapter}{after}]
>
> % section
>
> \newsignal\SectionSignal
>
> \DefineSectionBlank [Section] [before] [\ChapterSignal] {\blank[18pt]}
> \DefineSectionBlank [Section] [before] {\blank[24pt]}
> \DefineSectionBlank [Section] [after] {\blank[18pt]}
>
> \setuphead
> [section]
> [before=\SectionBlank{Section}{before},
> after=\SectionBlank{Section}{after}]
>
> \showgrid
>
> \starttext
>
> \chapter{Chapter}
>
> \section{Section}
>
> \chapter{Chapter}\edef\CurrentSection{Section}\SectionBlankSignal % tell \section the last header was \section too!
>
> \section{Section}
>
> \chapter{Chapter}
>
> text
>
> \section{Section}
>
> \stoptext
Hello Wolfgang,
thank you for your elaborate example!
In the meantime I played a little with weak/strong blanks, before I figured out that this already works out of the box. It seams that the blank before a head gets a higher priority and overrides the blank after the previous head, so that there is no need for signals at all …?
[-- Attachment #2: test-consecutive-heads3.tex --]
[-- Type: application/octet-stream, Size: 1650 bytes --]
\setuplayout[grid=yes] \showgrid[lines]
\setupheads[color=blue]
\setuphead
[chapter]
[grid=min,
page=no]
\setuphead
[section]
[grid=min]
% \setuphead
% [subsection]
% [before=\blank]
\starttext
\startcolumns
\chapter{Chapter}
\section{Section}
\dorecurse{25}{some text, }
\chapter{Chapter}
\dorecurse{10}{some text, }
\section{Section}
\dorecurse{10}{some text, }
\stopcolumns
\page
\startcolumns
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsubsection{Subsubsubsubsection}
\dorecurse{60}{some text, }
\chapter{Chapter}
\section{Section}
\dorecurse{10}{some text, }
\subsection{Subsection}
\dorecurse{10}{some text, }
\subsubsection{Subsubsection}
\dorecurse{10}{some text, }
\subsubsubsection{Subsubsubsubsection}
\dorecurse{10}{some text, }
\dorecurse{10}{some text, }
\stopcolumns
\page
\startcolumns
\chapter{Chapter\\Chapter}
\section{Section\\Section}
\subsection{Subsection\\Subsection}
\subsubsection{Subsubsection\\Subsection}
\subsubsubsection{Subsubsubsubsection\\Subsubsubsubsection}
\dorecurse{60}{some text, }
\chapter{Chapter\\Chapter}
\section{Section\\Section}
\dorecurse{10}{some text, }
\subsection{Subsection\\Subsection}
\dorecurse{10}{some text, }
\subsubsection{Subsubsection\\Subsection}
\dorecurse{10}{some text, }
\subsubsubsection{Subsubsubsubsection\\Subsubsubsubsection}
\dorecurse{20}{some text, }
\stopcolumns
\stoptext
%%% Local Variables:
%%% mode: context
%%% TeX-master: t
%%% End:
[-- Attachment #3: Type: text/plain, Size: 21 bytes --]
Greeting
Andreas
[-- Attachment #4: Type: text/plain, Size: 486 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: blank line and signals
2010-03-16 9:32 ` Andreas Harder
@ 2010-03-16 9:59 ` Steffen Wolfrum
0 siblings, 0 replies; 9+ messages in thread
From: Steffen Wolfrum @ 2010-03-16 9:59 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 16.03.2010 um 10:32 schrieb Andreas Harder:
>
> Am 16.03.2010 um 01:32 schrieb Wolfgang Schuster:
>
>> Am 14.03.10 15:07, schrieb Andreas Harder:
>>> If one removes the blank line after \section{Section} the output is correct, otherwise \TestSpace is ignored …
>>>
>> \def\DefineSectionBlank
>> {\dotripleempty\doDefineSectionBlank}
>>
>> \def\doDefineSectionBlank[#1][#2][#3]#4%
>> {\edef\CurrentSection{#1}%
>> \setvalue{#1:#2:\ifthirdargument\the\dimexpr#3\relax\fi}{#4}}
>>
>> \def\SectionBlank#1#2%
>> {\edef\CurrentSection{#1}%
>> \executeifdefined{#1:#2:\LastSectionBlankSignal}{\executeifdefined{#1:#2:\the\dimexpr\zeropoint\relax}{\getvalue{#1:#2:}}}%
>> \doif{#2}{after}{\SectionBlankSignal}}
>>
>> \let\LastSectionBlankSignal\zeropoint
>>
>> \EveryPar{\let\LastSectionBlankSignal\zeropoint}
>>
>> \def\SectionBlankSignal
>> {\setevalue{LastSectionBlankSignal}{\the\dimexpr\csname\CurrentSection Signal\endcsname\relax}}
>>
>> % chapter
>>
>> \DefineSectionBlank [Chapter] [before] {\blank[force,48pt]}
>> \DefineSectionBlank [Chapter] [after] {\blank[20pt]}
>>
>> \newsignal\ChapterSignal
>>
>> \setuphead
>> [chapter]
>> [before=\SectionBlank{Chapter}{before},
>> after=\SectionBlank{Chapter}{after}]
>>
>> % section
>>
>> \newsignal\SectionSignal
>>
>> \DefineSectionBlank [Section] [before] [\ChapterSignal] {\blank[18pt]}
>> \DefineSectionBlank [Section] [before] {\blank[24pt]}
>> \DefineSectionBlank [Section] [after] {\blank[18pt]}
>>
>> \setuphead
>> [section]
>> [before=\SectionBlank{Section}{before},
>> after=\SectionBlank{Section}{after}]
>>
>> \showgrid
>>
>> \starttext
>>
>> \chapter{Chapter}
>>
>> \section{Section}
>>
>> \chapter{Chapter}\edef\CurrentSection{Section}\SectionBlankSignal % tell \section the last header was \section too!
>>
>> \section{Section}
>>
>> \chapter{Chapter}
>>
>> text
>>
>> \section{Section}
>>
>> \stoptext
>
> Hello Wolfgang,
>
> thank you for your elaborate example!
>
> In the meantime I played a little with weak/strong blanks, before I figured out that this already works out of the box. It seams that the blank before a head gets a higher priority and overrides the blank after the previous head, so that there is no need for signals at all …?
In some projects it might look better if the space between two consecutive section heads is smaller than the regular space between section head and text.
That's where signals are needed and where Wolfgang's code does a great job.
Steffen
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-03-16 9:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-14 14:07 blank line and signals Andreas Harder
2010-03-14 16:19 ` Hans Hagen
2010-03-14 16:27 ` Wolfgang Schuster
2010-03-14 16:45 ` Hans Hagen
2010-03-14 17:00 ` Wolfgang Schuster
2010-03-14 17:50 ` Hans Hagen
2010-03-16 0:32 ` Wolfgang Schuster
2010-03-16 9:32 ` Andreas Harder
2010-03-16 9:59 ` Steffen Wolfrum
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).