[NTG-context] grid versus whitespace

Hans Hagen pragma at wxs.nl
Thu Jan 18 16:23:11 CET 2007


Steffen Wolfrum wrote:
> Hi,
>
> please have a look at following example:
>
> \starttext
> \setupwhitespace[5pt]
> \setuplayout[grid=no] \showstruts \showgrid \showgridboxes
> \setuphead[section][grid=fit]
>
> \section{Heading One}
>
> \input tufte
>
> \input knuth
> \stoptext
>
>
> For the section is too high, I set grid=yes which gives the desired  
> section distance.
>
> But now the whitespace 5pt between the regular paragraphs gets lost!
>
>
> Is there a way to have both: section grid snapping *and* regular  
> whitespace?
>   
hm, we can permits halflines 

\chardef\baselinegridmode=1 % not the default ! 

\def\dodosetupwhitespace % can go in core (or cont-new) 
  {\ifgridsnapping
     \witruimteflexibelfalse
     \ctxparskip1\ctxparskip
     \ifdim\ctxparskip>\zeropoint
       \ifcase\baselinegridmode
         \ctxparskip\baselineskip % normal ! ! ! ! !!
       \or
         \ifdim\scratchdimen=\baselineskip % maybe range
           \ctxparskip\baselineskip % normal ! ! ! ! !!
         \else
           \ctxparskip\numexpr
\ctxparskip/\dimexpr.5\lineheight\relax\relax\dimexpr.5\lineheight\relax
         \fi
       \else
         \ctxparskip\baselineskip % normal ! ! ! ! !!
       \fi
     \fi
   \else
     \ifwitruimteflexibel \else \ctxparskip1\ctxparskip \fi
   \fi
   \parskip\ctxparskip}

\starttext

\setuplayout[grid=yes] \showstruts \showgrid \showgridboxes

\setupwhitespace[halfline]

\setuphead[section][grid=fit]

\section{Heading One}

\input tufte

\input knuth

\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
-----------------------------------------------------------------



More information about the ntg-context mailing list