Thomas Fehige mailto:thomas@fehige.de 6. Juni 2016 um 10:11 I'm trying to put a piece of text in a partial frame that's meant to look like square brackets aligned with the left and right edges of the textblock.
I tried to use two \framed constructions inside each other, the outer one with width=textwidth and negative toffset and boffset, the inner one with a smaller width, a fat rulethickness and the color of the background, expecting it to erase the outer frame where it's not needed:
\color[zier]{%
\framed[%
align=middle,
width=\textwidth,
toffset=-4mm,
boffset=-4mm,
strut=no,
]{%
\color[paper]{\framed[%
align=middle,
width=222mm, % i.e. \textwidth-4mm
toffset=6mm,
boffset=5mm,
rulethickness=5mm
]{%
\color[zier]{\tfd \strut Here's the text that is menat to look important; its length/number of lines is undetermined.\strut}
}}%
}%
}%
... but it doesn't work. Apparently the inner frame is drawn before the outer one. Putting the wider frame inside the narrower results in alignment problems -- due to the overfull hbox, I presume. Your example is of not much use because it can’t be converted to a PDF (missing \starttext and empty lines). Is there a simple solution in ConTeXt that I haven't found yet, or will I have to try some plain TeX box magic myself? You can use MetaPost to draw the frame/lines for the left and right borders.
\startuseMPgraphic{leftbracket} z[0] = (EmWidth,OverlayHeight) ; z[1] = (0,OverlayHeight) ; z[2] = (0,0) ; z[3] = (EmWidth,0) ; draw z[0]--z[1]--z[2]--z[3] withcolor \MPcolor{\overlaylinecolor} ; \stopuseMPgraphic \startuseMPgraphic{rightbracket} z[0] = (-EmWidth,OverlayHeight) ; z[1] = (0,OverlayHeight) ; z[2] = (0,0) ; z[3] = (-EmWidth,0) ; draw z[0]--z[1]--z[2]--z[3] withcolor \MPcolor{\overlaylinecolor} ; \stopuseMPgraphic \installleftframerenderer {bracket}{\useMPgraphic {leftbracket}} \installrightframerenderer{bracket}{\useMPgraphic{rightbracket}} \defineframed [bracketframed] [frame=off, offset=1ex, leftframe=bracket, rightframe=bracket, framecolor=red, foregroundstyle=\ssx, foregroundcolor=darkgray, align=normal, width=max] \starttext \bracketframed{\input knuth } \stoptext Wolfgang