Re: [NTG-context] How to put title and counter of the enumeration env. in the FrameTitle?
Dear all, After searching ConTeXt wiki and googling, I got what I want using the attached code. It can be modified in nicer way which I don’t know. There are so many hidden commands in ConTeXt for me. It is absolutely convenient to use the “\defineenumeration” if I don’t use FunnyFrame. Thanks Hans and other developers of ConTeXt. Best regards, Dalyoung %%%%%%%%% \definenumber[ThmNumber][way=bychapter, prefix=no] \setnumber[ThmNumber][1] \startuseMPgraphic{FunnyFrame} picture p ; numeric o ; path a, b ; pair c ; p := textext.rt(\MPstring{ThmTitle}) ; 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, before={\blank[big]}, after={\incrementnumber[ThmNumber]\blank}] \def\FrameTitle#1% {\setMPtext{ThmTitle}{\hbox spread 1em{\hss\strut\ss\bf #1 \namedheadnumber{chapter}.\getnumber[ThmNumber]\hss}}} \starttext \startchapter[title={First Chapter}] \setnumber[ThmNumber][1] {\FrameTitle{Proposition} \startThm First theorem in chapter 1.\par \stopThm} \input Zapf {\FrameTitle{Lemma} \startThm Second theorem in chapter 1.\par \stopThm} \blank {\FrameTitle{Theorem} \startThm $3^{\text{rd}}$ theorem in chapter 1.\par \stopThm} \stopchapter \startchapter[title={Second Chapter}] \setnumber[ThmNumber][1] {\FrameTitle{Theorem} \startThm $1^{\text{st}}$ theorem in chapter 2.\par \stopThm} \input knuth {\FrameTitle{Corollary} \startThm Second theorem in chapter 2.\par \stopThm} {\FrameTitle{Proposition} \startThm Third theorem in chapter 2.\par \stopThm} \stopchapter \stoptext
participants (1)
-
Jeong Dal