Am 20.02.2014 um 13:22 schrieb Xan <dxpubl...@telefonica.net>:

> Not exactly. If you don't have the same number of answers that the number of 
> questions, so your counter is not properly set. See that:
> 
> \defineblock[question]
> \defineblock[hint]
> \defineblock[answer]
> 
> \defineenumeration[question][alternative=hanging,width=2.5cm,text={Question},stopper={.}]
> \defineenumeration[hint]    [alternative=hanging,width=4cm,text={Hint for 
> question},stopper={.}]
> \defineenumeration[answer]  [alternative=hanging,width=4.5cm,text={Answer to 
> question},stopper={.}]
> 
> \keepblocks[question]
> \hideblocks[hint]
> \hideblocks[answer]
> 
> \starttext
> 
> \section{Questions}
> 
> \beginquestion
> \startquestion
>  Compute $4\times 5$.
> \stopquestion
> \endquestion
> 
> 
> \beginhint
> \starthint
>  Use the fact that $2\times 5 = 10$.
> \stophint
> \endhint
> 
> %\beginanswer
> %\startanswer
> %  $20$.
> %\stopanswer
> %\endanswer
> 
> \beginquestion
> \startquestion
>  What is the value of $100/10$?
> \stopquestion
> \endquestion
> 
> \beginhint
> \starthint
> Remember that $10\times 10 = 100$.
> \stophint
> \endhint
> 
> \beginanswer
> \startanswer
> $10$
> \stopanswer
> \endanswer
> 
> \section{Hints}
> 
> \useblocks[hint]
> 
> \section{Answers}
> 
> \useblocks[answer]
> 
> \stoptext
> 
> If you comment one solution, then, you get "Answer to question 1", instead of 
> "Answer of question 2", which is really. No always a question has an answer 
> provided by me ;-)


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
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to