Far beyond my tex and context skills, but nice :)
regards
Jan
Dne Wed, 06 Jun 2012 14:46:29 +0200 Wolfgang Schuster
Am 05.06.2012 um 10:34 schrieb Jan Pohanka:
Hello,
is it possible to have some "conditional format"? I mean I'd like to have different vertical spacing for \section and \subsection when they follows immediately each other and when there is some text between them.
% SectionBlank
\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:}}}}
\let\LastSectionBlankSignal\zeropoint
\EveryPar{\let\LastSectionBlankSignal\zeropoint}
\def\SectionBlankSignal {\setevalue{LastSectionBlankSignal}{\the\dimexpr\csname\CurrentSection Signal\endcsname\relax}}
% Heading
\newsignal\PartSignal
\DefineSectionBlank [Part] [before] {\blank[force,48pt]} \DefineSectionBlank [Part] [after] {\blank[15pt]\SectionBlankSignal}
\setuphead [Part] [before=\SectionBlank{Part}{before}, after=\SectionBlank{Part}{after}]
\newsignal\ChapterSignal
\DefineSectionBlank [Chapter] [before] [\PartSignal] {\blank[\the\dimexpr 12pt*200/100-6pt\relax]} \DefineSectionBlank [Chapter] [before] {\blank[\the\dimexpr 12pt*200/100\relax]} \DefineSectionBlank [Chapter] [after] {\blank[\the\dimexpr 12pt*150/100\relax]\SectionBlankSignal}
\setuphead [chapter] [before=\SectionBlank{Chapter}{before}, after=\SectionBlank{Chapter}{after}]
\newsignal\SectionSignal
\DefineSectionBlank [Section] [before] [\PartSignal] {\blank[\the\dimexpr 12pt*175/100\relax]} %\DefineSectionBlank [Section] [before] [\ChapterSignal] {\blank[\the\dimexpr 12pt*175/100-3pt\relax]} \DefineSectionBlank [Section] [before] [\ChapterSignal] {\blank[\the\dimexpr 12pt*175/100+2cm\relax]} \DefineSectionBlank [Section] [before] {\blank[\the\dimexpr 12pt*175/100\relax]} \DefineSectionBlank [Section] [after] {\blank[\the\dimexpr 12pt*133/100\relax]\SectionBlankSignal}
\setuphead [section] [before=\SectionBlank{Section}{before}, after=\SectionBlank{Section}{after}]
\starttext
\chapter{Chapter 1}
\section{Section 1.1}
\chapter{Chapter 2}
text
\section{Section 2.1}
\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 ___________________________________________________________________________________