I'm trying to define fancy frames with ConTeXt, but I get some difficulties. Since I found many examples of this, I mainly used Metapost, but since I'm more of a TiKz adept, I don't really understand what is going on.
First I tried to use a framedtext environment, but it misbehaves when embedding a figure (which is something I often need). This is the frame as I'd like it.
\usesymbols[mvs]
\definesymbol[info][{\symbol[martinvogel 2][Info]}]
\startuseMPgraphic{mp:axiomframe}
draw (OverlayWidth,OverlayHeight) -- (0,OverlayHeight) -- (0,0);
draw (0.5pt,0) -- (OverlayWidth,0) -- (OverlayWidth,OverlayHeight-
0.5pt) withpen pencircle scaled 1.2bp;
fill OverlayBox withcolor 0.95 white;
fill bbox textext.top("\tfd\symbol[info]") shifted
(0.5EmWidth,OverlayHeight-3ExHeight) withcolor white;
draw textext.top("\tfd\symbol[info]") shifted
(0.5EmWidth,OverlayHeight-3ExHeight) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
\defineoverlay[axiomframe][\useMPgraphic{mp:axiomframe}]
\defineframedtext[theoremFrame]
[frame=off,
rulethickness=1pt,
offset=5pt,
background=axiomframe,
width=fit,
location=middle]
\def\starttheorem{\dosingleempty\doStarttheorem}
\def\doStarttheorem[#1]{
\starttheoremFrame
\iffirstargument \hskip2em {\bfa #1} \\ \fi
}
\def\stoptheorem{\stoptheoremFrame}
\useexternalfigure[ctanlion]
[http://www.ctan.org/lion/ctan_lion_350x350.png][width=5cm]
\starttext
\starttheorem[Hello]
\placefigure[here,right,none]{}{\externalfigure[ctanlion]}
\input knuth
\stoptheorem
Then I tried with a textbackground ; I changed the overlay and framedtext definitions with
\definetextbackground[theoremFrame]
[mp=mp:axiomframe,
leftoffset=2\bodyfontsize,rightoffset=.5\bodyfontsize,
topoffset=.5\bodyfontsize,bottomoffset=.5\bodyfontsize,
before={\testpage[3]\blank},
after={\blank[2*medium]},
width=local]
This resolves the float problem, but leads to the following problem : the frame takes all the page instead of the required space, and I couldn't manage to get spaces on the edges :
Finally, I tried to modify the MP part using a document from Aditya :
\startuseMPgraphic{mp:axiomframe}
path p;
for i = 1 upto nofmultipars :
p = (multipars[i] topenlarged 0pt bottomenlarged 0pt);
fill p withcolor 0.95white ;
draw p withcolor black withpen pencircle scaled
\MPvar{linewidth};
endfor;
fill bbox textext.top("\tfd\symbol[info]") shifted
(0.5EmWidth,OverlayHeight-3ExHeight) withcolor white;
draw textext.top("\tfd\symbol[info]") shifted
(0.5EmWidth,OverlayHeight-3ExHeight) ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
But it doesn't behave well, and it doesn't seem to permit variable line thickness (and I couldn't find any documentation on the multipars array...)




multiparsis. I just copied from Wolfgang's answer. You might want to ask this question on the mailing list. – Henri Menke Jun 29 '17 at 23:49