[NTG-context] How to put title and counter of the enumeration env. in the FrameTitle?

Jeong Dal haksan at me.com
Thu Dec 3 23:44:12 CET 2015


Hi,

I use the FunnyFrame and FrameTitle in the metafun book to display theorems.
Thanks ConTeXt and MetaFun, it looks nice!
For better output,  I try to put “Theorem + number” in the FrameTitle instead of putting in the main text. But I couldn’t make it.
I found a similar question and answers by Hans in the list (2015. 8.6-7) under the title 
“Some questions about an environment (Metafun)”

It works fine but I want to put number too. I think that I want to much.

Thanks for reading.

Best regards,

Dalyoung

I am using the following code.

%%%%%%%%%%%%
\defineenumeration[Theorem]
   [%text=Theorem ,
    style=,
%    title=yes,
    prefix=yes,
    prefixsegments=chapter,
    way=bychapter,
    number=yes,
    before={\blank[big]},
    after=\blank]

\defineenumeration[Definition]
   [text=Definition,
    style=,
%    title=yes,
    prefix=yes,
    prefixsegments=chapter,
    way=bychapter,
    number=yes,
    before={\blank[big]},
    after=\blank]

\startuseMPgraphic{FunnyFrame} 
picture p ; numeric o ; path a, b ; pair c ; 
p := textext.rt(\MPstring{FunnyFrame}) ; 
o := BodyFontSize ; 
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ; 
p := p shifted (2o,OverlayHeight-ypart center p) ; 
drawoptions (withpen pencircle scaled 1pt withcolor .625red) ; 
b := a superellipsed .95 ; 
%fill b withcolor .85white ; 
draw b ; 
b := (boundingbox p) superellipsed .95 ; 
fill b withcolor .425green;%.85white ; 
draw b ; 
draw p withcolor black ;
setbounds currentpicture to a ; 
\stopuseMPgraphic 

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 
\defineframedtext[FunnyText][frame=off,background=FunnyFrame, offset=\bodyfontsize, width=\textwidth]%\overlaywidth]%
\def\StTheorem{\startFunnyText\startTheorem} 
\def\SpTheorem {\stopTheorem\stopFunnyText } 
\def\FrameTitle#1% 
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut\ss\bf\white #1\hss}}} 

\starttext
This is a test for Framed Theorem.

\StTheorem
This is a theorem in the Funny Frame. 
\SpTheorem


I'd like to put \quote{Theorem \#1(Some Title)} in a small frame and the main text in the big frame.

\blank[big]

{\FrameTitle{Theorem 2(Title of Theorem)} 
\StTheorem
I want to show the main text without \quote{Theorem 2} in this frame.
\SpTheorem

\stoptext

%%%%%%%%%%%%%%%%%%

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20151204/90374053/attachment.html>


More information about the ntg-context mailing list