Hi Dalyoung,

would it be possible that you add both samples to the wiki?

This is the best way to have a reference for future needs.

Pablo


On 12/03/2017 12:11 AM, Jeong Dal wrote:
> 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
>     
>     
>     
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 


-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to