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

Jeong Dal haksan at me.com
Sat Dec 5 01:14:30 CET 2015


Dear all,

I found a partial solution for my former question which still have problems.

1. I set a new counter “ThmNumber” and use it in the FrameTitle. Its output is similar to what I want. 
2. insert “after={\doglobal\increment\ThmNumber}” in the enumeration environment.
3. But the Initial value of ThmNumber is 0 even though \setcounter\ThmNumber1.

Please enhance the sample code which works nicer way.
Also, where can I find good explanation on “counter”?

Thank you for reading.

Best regards,

Dalyoung


%%%%%
\newcounter\ThmNumber
\setcounter\ThmNumber1
\increment\ThmNumber

\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 ; 
draw b ; 
b := (boundingbox p) superellipsed .95 ; 
fill b withcolor .85white ; 
draw b ; 
draw p withcolor black ;
setbounds currentpicture to a ; 
\stopuseMPgraphic 

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 

\defineframedtext[Thm]
[frame=off,
background=FunnyFrame,
offset=\bodyfontsize, 
increment=yes,
width=\textwidth,
after={\doglobal\increment\ThmNumber}]%\overlaywidth]%

\def\FrameTitle#1% 
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut\ss\bf #1\hss}}} 

\starttext
This is a test for Framed Theorem.

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 \ThmNumber} 
\startThm
	First theorem\par
	\input knuth
\stopThm}

{\FrameTitle{Theorem \ThmNumber} 
\startThm
	First theorem\par
	\input knuth
\stopThm}

\stoptext


More information about the ntg-context mailing list