Hi,
Some days ago, I asked a method to put theorem numbers in a framed title.
Recently, Wolfgang gave me a solution which worked very well.
Although the first one is much simpler than the second, I’d like to show two samples made by his suggestion.
I hope that it may help someone who has the similar problem.
Thanks Wolfgang again.
Best regards,
Dalyoung
%%%%%%%%%% first method
%1. use \enumerationparameter{text} and add “text=Theorem” in \defineenumeration.
%%%%%%%%%%%
\defineframed
[FunnyFramed]
[frame=off,
loffset=1ex,
roffset=1ex,
foregroundstyle=\ssbf]
\startuseMPgraphic{FunnyFrame}
picture p ; numeric o ; path a, b ; pair c ;
p := textext.rt("\FunnyFramed{\enumerationparameter{text} \convertedcounter[Theorem]}") ;
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
[FunnyText]
[frame=off,
background=FunnyFrame,
before={\blank[line,halfline]},
after={\blank[line]},
offset=\bodyfontsize,
width=\textwidth]
\defineenumeration[Theorem]
[title=no,
text=Theorem,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
alternative=command,
headcommand=\gobbleoneargument,
before=\startFunnyText,
after=\stopFunnyText]
\defineenumeration[Lemma]
[title=no,
text=Lemma,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
alternative=command,
counter=Theorem,
headcommand=\gobbleoneargument,
before=\startFunnyText,
after=\stopFunnyText]
\defineenumeration[Coro]
[title=no,
text=Corollary,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
alternative=command,
counter=Theorem,
headcommand=\gobbleoneargument,
before=\startFunnyText,
after=\stopFunnyText]
\starttext
\dorecurse{3}
{\chapter{Chapter Title}
\startLemma
Fort's space is a compact and Hausdorff topological space.
\stopLemma
\startTheorem
Fort's space is a compact and Hausdorff topological space.
\stopTheorem
\startTheorem
Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space $(X, {\mathcal T} )$ is called {\bf Fort's space}.
\stopTheorem
\startLemma
Fort's space is a compact and Hausdorff topological space.
\stopLemma
\startCoro
Fort's space is a compact and Hausdorff topological space.
\stopCoro
}
\stoptext
%%%%% 2nd method
%2. use \MPvar{} and define 3 different backgrounds, 3 different framedtexts like
% \defineoverlay[FunnyFrameT][\useMPgraphic{FunnyFrame}{what=Theorem}]
%%%%%
\defineframed
[FunnyFramed]
[frame=off,
loffset=1ex,
roffset=1ex,
foregroundstyle=\ssbf]
\startuseMPgraphic{FunnyFrame}
picture p ; numeric o ; path a, b ; pair c ;
p := textext.rt("\FunnyFramed{\MPvar{what} \convertedcounter[Theorem]}") ;
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[FunnyFrameT][\useMPgraphic{FunnyFrame}{what=Theorem}]
\defineoverlay[FunnyFrameL][\useMPgraphic{FunnyFrame}{what=Lemma}]
\defineoverlay[FunnyFrameC][\useMPgraphic{FunnyFrame}{what=Corollary}]
\defineframedtext
[FunnyTheorem]
[frame=off,
background=FunnyFrameT,
before={\blank[line,halfline]},
after={\blank[line]},
offset=\bodyfontsize,
width=\textwidth]
\defineframedtext
[FunnyLemma]
[frame=off,
background=FunnyFrameL,
before={\blank[line,halfline]},
after={\blank[line]},
offset=\bodyfontsize,
width=\textwidth]
\defineframedtext
[FunnyCoro]
[frame=off,
background=FunnyFrameC,
before={\blank[line,halfline]},
after={\blank[line]},
offset=\bodyfontsize,
width=\textwidth]
\defineenumeration[Theorem]
[title=no,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
alternative=command,
headcommand=\gobbleoneargument,
before=\startFunnyTheorem,
after=\stopFunnyTheorem]
\defineenumeration[Lemma]
[title=no,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
alternative=command,
counter=Theorem,
headcommand=\gobbleoneargument,
before=\startFunnyLemma,
after=\stopFunnyLemma]
\defineenumeration[Coro]
[title=no,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
alternative=command,
counter=Theorem,
headcommand=\gobbleoneargument,
before=\startFunnyCoro,
after=\stopFunnyCoro]
\starttext
\dorecurse{3}
{\chapter{Chapter Title}
\startLemma
Fort's space is a compact and Hausdorff topological space.
\stopLemma
\startTheorem
Fort's space is a compact and Hausdorff topological space.
\stopTheorem
\startTheorem
Let $X$ be a uncountable set. Let $\infty$ is a fixed point of $X$. Let $\mathcal T$ be the family of subsets $G$ such that either (i) $\infty \notin G$ or (ii) $\infty \in G \text{ and } G^c$ is finite. The space $(X, {\mathcal T} )$ is called {\bf Fort's space}.
\stopTheorem
\startLemma
Fort's space is a compact and Hausdorff topological space.
\stopLemma
\startCoro
Fort's space is a compact and Hausdorff topological space.
\stopCoro
}
\stoptext