Re: Decorative frame for enumeration
Willi Egger <[email protected]> Sun, 14 Jun 2026 18:16:51 +0200
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
I think, that it is a good approach. Why there is this misalignment I do not understand. As a temporary fix you can put the toffset of the framedtext of the enumeration to -1.25pt. Willi On Jun 13 2026, at 8:45 pm, Jethro Djan <[email protected]> wrote: > I am going for a design I saw in a high school math text book for > typesetting examples. > > But my implementation leaves a little vertical space at the top above > the enumeration title. Also, I have to manually shift the frame. If I > zoom in, I still see that the frame for the header title and the frame > it is contained in are not aligned. > > Is there a better way to do this? > > MWE: > > \startuseMPgraphic{WEFrame} > numeric w, h ; > w := OverlayWidth ; h := OverlayHeight ; > fill (0,0)--(0,h)--(w,h)--(w,0)--cycle withcolor (.93, .96, 1.0) ; > setbounds currentpicture to unitsquare xyscaled(w,h) ; > \stopuseMPgraphic > > \defineoverlay[WEFrame][\useMPgraphic{WEFrame}] > > \defineenumeration[WorkedEx] > \setupenumeration[WorkedEx][% > alternative=top, > text={Worked Example}, > inbetween={\blank[small]}, > before={\startframedtext[ > frame=off, > background=WEFrame, > offset=0pt, > loffset=8pt, > boffset=4pt, > width=max, > ]}, > after={\stopframedtext}, > headcommand=\WETitleCommand, > ] > > \startuseMPgraphic{WETitleFrame} > numeric w, h ; > w := OverlayWidth ; h := OverlayHeight ; > fill (0,0)--(0,h)--(w,h)--(w,0)--cycle withcolor (.2, .4, .75) ; > setbounds currentpicture to unitsquare xyscaled(w,h) ; > \stopuseMPgraphic > > \defineoverlay[WETitleFrame][\useMPgraphic{WETitleFrame}] > > \define[1]\WETitleCommand{% > \hskip-8pt > \framed[frame=off,% > width=\dimexpr\textwidth-25pt\relax,% > frame=off,% > offset=4pt,% > strut=no, > background=WETitleFrame,% > foregroundcolor=white, > align=flushleft,% > ]{#1} > } > > \starttext > > \startWorkedEx > Take the sequence > \startformula > 2, 8, 14, 20, 26, \ldots > \stopformula > \stopWorkedEx > > \stoptext > > ___________________________________________________________________________________ > > If your question is of interest to others as well, please add an entry > to the Wiki! > > > maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl > > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) > > archive : https://github.com/contextgarden/context > > wiki : https://wiki.contextgarden.net > > ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________