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

Jeong Dal haksan at me.com
Fri Jan 12 03:54:40 CET 2018


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?

Thank you for reading.

Best regards,

Dalyoung

%%%%%%%%%%%
\setupcolors[state=start]
\definecolor[dGreen] [r=0,g=.375,b=.0]
%%% define the background of Theorems:
\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]},
%    before={\blank[line]},
    after={\blank[line]},
   offset=\bodyfontsize,
   width=\textwidth]

\defineenumeration[Theorem]
  [title=yes,
  text={\translate[en=Theorem, kr=정리]},
   prefix=yes,
   prefixsegments=chapter,
   way=bychapter,
   alternative=command,
   headcommand=\gobbleoneargument,
   before=\startFunnyText,
   after=\stopFunnyText]

%%%% Definition style
\definenumber[DefNumber][way=bychapter,sectionumber=yes]
\setuptextrules[rulecolor=dBlue]

\define\DefCommand{\incrementnumber[DefNumber]
	\textrule[top]{\translate[en=Definition, kr=정 의] \getnumber[DefNumber]}
	}	
\defineenumeration[Definition]
	[alternative=hanging,
	width=fit,
	alternative=serried,
	text={}, 
	number=no,
	before={\DefCommand}, 
	after=\vskip3pt\hrule\blank] 

%%% Examples with or without solutions
\defineenumeration[Exam]
   [text={\white\translate[en=Example, kr=예제]},
   numbercommand={\inframed[corner=round, framecolor=dYellow,toffset=-1pt,boffset=-1pt, loffset=1ex,roffset=1ex, background=color,backgroundcolor=dGreen]},	%height=1.3em,
%    title=no,
    prefix=yes,
    prefixsegments=chapter,
    way=bychapter,
    before={\blank[big]},
    after=\blank]
	 
\starttext

\chapter{Spaces}
    
\section{Space 1}

\startDefinition[def:first]
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}.
\stopDefinition

\startTheorem[lem:first]
    Fort's space is a compact and Hausdorff topological space.\par
\stopTheorem

\startTheorem[thm:second]
    Fort's space is a compact and Hausdorff topological space.
\stopTheorem

\startExam[Ex:first]
Example Example Example Example Example Example Example Example Example 
Example Example Example Example Example Example Example Example Example 
Example Example Example Example Example Example Example Example Example 
\stopExam

In this example, we defined \in{Definition}[def:first]. After that, we proved \in{Lemma}[lem:first] and \in{정리}[thm:second]. Finally, \in{Example}[Ex:first], we saw an example of it.

\stoptext


More information about the ntg-context mailing list