[NTG-context] too much space because of margin notes

Hans Hagen pragma at wxs.nl
Tue Jul 11 11:43:32 CEST 2006


Mojca Miklavec wrote:
> Hello,
>
> I would like to write a note in the margin next to some framed
> formula, but I guess that the formula starts a new paragraph and
> there's too much space left on the top of the frame. How can I fix
> that?
>
> \starttext
>
> \startframedtext
>
> \inmargin{some text in margin}
> \placeformula
> \startformula
> a+b=c
> \stopformula
> How can I get rid of that space?
>
> \stopframedtext
>
> \stoptext
>   
when using framed texts you run into problems with flushing, struts and the nature of boxes (vbox,vtop)

in such cases one can do several things 

\starttext

\showframe

\def\MyDisplayCorrection {\vskip-\lineheight}

\margintext{some text in margin}

\starttextbackground
    \MyDisplayCorrection
    \placeformula  \startformula  a+b=c \stopformula
\stoptextbackground

\stoptext

use a Correction macro that can be nilled (since some day we may have more control over math spacing and can fix the problem) 

Here is a nice alternative: 

\starttext

\margintext {some text in margin}

\setupframedtexts[background={YourTrick,MyTrick}]

\definelayer[MyTrick]

\startsetups MyTrick
  \setlayer[MyTrick]{\placemargintexts}
\stopsetups

\defineoverlay[YourTrick][\setups{MyTrick}]

\startframedtext

\placeformula
\startformula
a+b=c
\stopformula
\stopframedtext

\stoptext

I'm sure that yuou can explain this on the wiki 

(There is this Best Of Ruby Quiz book, maybe we should make a Best Of Context Quiz one ... ) 

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



More information about the ntg-context mailing list