[NTG-context] solutions and problems

Xan dxpublica at telefonica.net
Fri Feb 21 10:28:20 CET 2014


Thanks for that. I use incrementcounter and decrementnumber in 'before', because I use *always* answer nested in question:

\defineenumeration
  [exercici]
  [alternative=serried,text={\startcolor[darkblue]Exercici\stopcolor},stopper={.\space},left={\bgroup},right={\egroup},width=fit,headstyle=\ss,distance=0.25em,width=fit,before={\incrementcounter[answer]}]

\defineenumeration[resposta][headstyle=\ss,text={Solucions},width=fit,alternative=serried,before={\decrementcounter[resposta]}]

\defineblock[resposta]
\hideblocks[resposta]


@Thomas: thank you very much for the link. Eventually I have to migrate all my data to XML, but it's tedious do it that. XML is very verbose and I have to define my DTD structure (at least mentally ;-)).

Thanks all of you,

> You can add a answer block which increments the answer counter.
> 
> \defineblock[question]
> \defineblock[answer]
> 
> \defineenumeration[question][text={Question}]
> \defineenumeration[answer]  [text={Answer}]
> 
> \keepblocks[question]
> \hideblocks[answer]
> 
> \starttext
> 
> \chapter{Question}
> 
> \beginquestion
> 	\startquestion
> 		Question 1.
> 	\stopquestion
> \endquestion
> 
> \beginanswer
> 	\startanswer
> 		Answer 1.
> 	\stopanswer
> \endanswer
> 
> \beginquestion
> 	\startquestion
> 		Question 2.
> 	\stopquestion
> \endquestion
> 
> \beginanswer
> 	\incrementcounter[answer]
> \endanswer
> 
> \beginquestion
> 	\startquestion
> 		Question 3.
> 	\stopquestion
> \endquestion
> 
> \beginanswer
> 	\startanswer
> 		Answer 3.
> 	\stopanswer
> \endanswer
> 
> \chapter{Answers}
> 
> \useblocks[answer]
> 
> \stoptext
> 
> Wolfgang


More information about the ntg-context mailing list