Hi Wolfgang,
Many thanks for your attention and insight.
With your code everything works as expected. In case others would be interested, I give here a slight modification of what you sent, which works very well with mkiv: I only added
\setupblock[question][before={\startquestion},after={\stopquestion}]
so that one can just say \beginquestion \endquestion without having to enter each time \startquestion \stopquestion. I don’t know whether this is a good idea or not, as it may have side effects…
I will put this example on the wiki, but before doing so I have another question:
can one add two automatic links at the end of each question so that one can navigate easily to the respective hint or answer corresponding to that question? Indeed if this were possible, one would add also two automatic links to each hint going to its question and the corresponding answer, and two other links to each answer going to its hint and question. One can do this manually by adding a reference to each question, each hint and each answer, but it would be nice to have this done automatically.
Best regards: OK
PS: here is the complete example for question-hint-answer:
%%%% begin question-hint-answer-blocks.tex
\defineblock[question]
\defineblock[hint]
\defineblock[answer]
\defineenumeration[question]
[alternative=hanging,
width=2.5cm,
text={Question},
headstyle={\bi},
stopper={.}]
\defineenumeration[hint]
[alternative=hanging,
width=4cm,
text={Hint for question},
headstyle={\bi},
stopper={.}]
\defineenumeration[answer]
[alternative=hanging,
width=4.5cm,
text={Answer to question},
headstyle={\bi},
stopper={.}]
\setupblock[question][before={\startquestion},after={\stopquestion}]
\setupblock[hint][before={\starthint},after={\stophint}]
\setupblock[answer][before={\startanswer},after={\stopanswer}]
\keepblocks[question]
\hideblocks[hint]
\hideblocks[answer]
\starttext
\section{Questions}
\beginquestion
Compute $4\times 5$.
\endquestion
\beginhint
Use the fact that $2\times 5 = 10$.
\endhint
\beginanswer
$20$.
\endanswer
\beginquestion
What is the value of $100 / 10$?
\endquestion
\beginhint
Remember that $10\times 10 = 100$.
\endhint
\beginanswer
$10$
\endanswer
\section{Hints to all questions}
\useblocks[hint]
\section{Answers to all questions}
\useblocks[answer]
\stoptext
%%%% end question-hint-answer-blocks.tex
On 11 janv. 2014, at 10:12, Wolfgang Schuster
Am 11.01.2014 um 00:36 schrieb Otared Kavian
: Hi Wolfgang,
In mkiv, even using \startanswer, \stopanswer (and the same syntax with questions and hints) the blocks mechanism seems to be broken. The error message is still the following:
\dostopnormalblock ...meter \c!after \par \egroup
<argument> ...fact that $2\times 5 = 10$. \dostopnormalblock \dostartnormalblock {hint}... \dodowithpar ...dler \v!construction \endcsname #1 \csname \??constructionsto...
When I understand a little bit more about that mechanism I’ll do other testings and eventually ask Hans about what has been changed regarding blocks.
You have to convert the question, hint and answer environment.
What the block environment does is to save the content from the begin to the end block and hides it when you use \hideblocks[…]. To output the content of the environments you can use \useblocks[…].
\defineblock[question] \defineblock[hint] \defineblock[answer]
\defineenumeration[question][alternative=hanging,text={Question},stopper={.}] \defineenumeration[hint] [alternative=hanging,text={Hint for question},stopper={.}] \defineenumeration[answer] [alternative=hanging,text={Answer to question},stopper={.}]
\keepblocks[question] \hideblocks[hint] \hideblocks[answer]
\starttext
\section{Questions}
\beginquestion
\startquestion Compute $4\times 5$. \stopquestion
\beginhint \starthint Use the fact that $2\times 5 = 10$. \stophint \endhint
\beginanswer \startanswer $20$. \stopanswer \endanswer
\endquestion
\beginquestion
\startquestion What is the value of $100 / 10$? \stopquestion
\beginhint \starthint Remember that $10\times 10 = 100$. \stophint \endhint
\beginanswer \startanswer $10$ \stopanswer \endanswer
\endquestion
\section{Hints}
\useblocks[hint]
\section{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 ___________________________________________________________________________________