[NTG-context] How to do this in ConTeXt

Hans Hagen pragma at wxs.nl
Wed Jan 4 22:48:40 CET 2006


FabriceL. wrote:

> Hi,
>
>    Hans, it's so instructive to read yout post... I have learned from 
> this last post 2 new commands !
> However, I think the original poster wish a line who run to the right 
> margin, so I added to your code
> in the "defineenumeration" a "inbetween=\vskip-4pt{\hrule height 
> 1.5pt}\blank". This is not very elegant,
> but this works. By the way, I'm interested to know if there is a 
> better solution.
>
> > Hans wrote:
> > one of you has to wikify this answer ...
>
> I'm not sure how to do this, but I can try how this works.
> The complete code follows.
> FL.
>
> \setupcolors[state=start]
> \setupbackgrounds[text][text][background=color,backgroundcolor=darkred,backgroundoffset=3pt] 
>
>
> \defineenumeration
>  [example]
>  [way=bychapter,
>   separator=\compoundhyphen,
>   chapternumber=yes,
>   color=white,
>   command=\exampleframed,
>   inbetween=\vskip-4pt{\hrule height 1.5pt}\blank]


if you say \showstruts you will notice why you need to skip back; your 
4pt is a gamble, best do something:

\defineenumeration
 [example]
 [way=bychapter,
  separator=\compoundhyphen,
  chapternumber=yes,
  color=white,
  command=\exampleframed,
  inbetween=\setups{example:inbetween}]

\startsetups example:inbetween
    \removedepth     % nils strut depth
    \nointerlineskip
    \blackrule[height=1.5pt,width=\hsize,depth=0pt]
    \blank
    \nobreak
\stopsetups

btw, this makes a nice example for a regression test

> \defineframed
>  [exampleframed]
>  [background=color,
>   backgroundcolor=black,
>   foregroundcolor=white,
>   style=bold,
>   frame=off]
>
> \starttext
>
> \chapter{One}
>
> \input tufte
>
> \startexample
>    \input tufte
> \stopexample
>
> \input tufte
>
> \stoptext
>
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context




More information about the ntg-context mailing list