[NTG-context] referencing the customized enumeration with framed title

Hans Hagen pragma at wxs.nl
Fri Jan 12 15:51:17 CET 2018


On 1/12/2018 3:54 AM, Jeong Dal wrote:
> Hi,
> 
> Some time ago, I am able to use following code(the framed title for Theorems and etc.)
> Thank Wolfgang and Otared again.
> 
> Since it uses the customized style of numbering, there is a problem to reference them.
> As in the following code, \in{Definition}[] shows no number and \in{Theorem}[] shows ?? instead of numbers while \in{Exam}[] shows correctly.
> 
> Is there a way to show the numbers correctly?
% in cont-new.mkiv:

\unprotect

\defineconstructionalternative
   [\v!empty]
   [\c!renderingsetup=\??constructionrenderings:\v!empty]

\startsetups[\??constructionrenderings:\v!empty]
     \noindent
     \useconstructionstyleandcolor\c!style\c!color
     \ignorespaces
\stopsetups

\protect

% till here

\defineenumeration[Theorem]
   [alternative=empty,
    before=\startMyText,
    after=\stopMyText]

\defineframed
   [MyFramed]
   [frame=off,
    loffset=1ex,
    roffset=1ex,
    foregroundstyle=\ssbf]

\startuseMPgraphic{MyFrame}
     picture p ; numeric o ; path a, b ; pair c ;
     p := textext.rt("\MyFramed{\currentconstructiontext}") ;
  %  p := 
textext.rt("\wrappedconstruction{\MyFramed{\currentconstructiontext}}") ;
  %  p := 
textext.rt("\MyFramed{\wrappedconstruction{\currentconstructiontext}}") ;
  %  p := textext.rt("\MyFramed{\wrappedcurrentconstruction}") ;
     o := BodyFontSize ;
     a := OverlayBox ;
     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[MyFrame][\useMPgraphic{MyFrame}]

\defineframedtext
   [MyText]
   [frame=off,
    background=MyFrame,
    offset=\bodyfontsize,
    width=\textwidth]

\starttext

\startTheorem[lem]
     bla bla
\stopTheorem

Bla bla \in {Lemma} [lem] bla bla.

\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list