On 9 janv. 2014, at 15:48, Jaroslav Hajtmar <hajt...@gyza.cz> wrote:

> Hello Otared.
> I will throw this one... Thanx.
> 
> Once I was using exercise-answer package for LaTeX.
> Is there anything like this to use in ConTeXt?
> 
> Thanx
> Jaroslav Hajtmar

Hello Jaroslav,

I have something like the following which was given to me by Hans a long time 
ago: unfortunately for some reason this does not work anymore with ConTeXt 
mkiv, but it is quite fine with mkii:

%%% begin question-hint-answer.tex
\defineblock[question]
\defineblock[hint]
\defineblock[answer]

\defineenumeration[question][location=hanging,text={Question},stopper={.}]
\defineenumeration[hint][location=hanging,text={Hint for question},stopper={.}]
\defineenumeration[answer][location=hanging,text={Answer to 
question},stopper={.}]

\hideblocks[hint]
\hideblocks[answer]

\starttext
\section{Questions}

\beginquestion
\question Compute $4\times 5$.

\beginhint
\hint Use the fact that $2\times 5 = 10$.
\endhint

\beginanswer
\answer $20$.
\endanswer

\endquestion

\beginquestion
\question What is the value of $100 / 10$?

\beginhint
\hint Remember that $10\times 10 = 100$.
\endhint

\beginanswer
\answer $10$
\endanswer

\endquestion

\section{Hints}
\useblocks[hint]

\section{Answers}
\useblocks[answer]

\stoptext
%%% end question-hint-answer.tex

Best regards: OK



> 
> 
> Dne 9.1.2014 15:19, Otared Kavian napsal(a):
>> %%% begin example-exercise.tex
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> % defining \startexo, \stopexo as an enumeration:
>> \startsetups style:simple
>> \defineenumeration[exo]
>>      [alternative=hanging,
>>      width=fit,
>>      stopper={.},
>>      text=Exercise,
>> %    between=,
>>      before=,
>>      after=\blank]
>> \stopsetups % style:simple
>> 
>> \startsetups style:textrule
>> \definenumber[MyExoNumber][way=bysection,sectionumber=yes]
>> \setuptextrules[rulecolor=darkred]
>> \define\ExoCommand{\incrementnumber[MyExoNumber]
>>      \textrule[top]{Exercise \getnumber[MyExoNumber]}
>>      \startbackground[frame=off,leftframe=on,backgroundcolor=white,
>>              framecolor=darkred]}
>> 
>> \defineenumeration[exo]
>>      [alternative=hanging,
>>      width=fit,
>>      text={},
>>      number=hide,
>>      number=no,
>>      before={\ExoCommand},
>>      after={\stopbackground\blank}]
>> \stopsetups % style:textrule
>> 
>> % end defining \startexo, \stopexo as an enumeration
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> 
>> %defining  numbered questions
>> \defineconversion[exercise][\numbers]
>> %\setupitemize[packed]
>> \def\StartQuestions{%
>>      \startitemize[exercise][width=2em,packed,style=bold,stopper=,right=)]}
>> \def\StopQuestions{\stopitemize}
>> \def\q{\item}
>> 
>> % trye each of the following
>> \setups[style:simple]
>> %\setups[style:textrule]
>> 
>> \starttext
>> \startexo
>> Prove that for all $a,b\in {\Bbb K}$, a field of characteristic 2, one has 
>> $(a+b)^2  = a^2  + b^2$.
>> \stopexo
>> 
>> 
>> \startexo
>> Prove that for all $a,b\in {\Bbb K}$, a field of characteristic 2, one has 
>> $(a+b)^4  = a^4  + b^4$.
>> \stopexo
>> 
>> \startexo
>> \StartQuestions
>> \q Prove that
>> \startformula
>> \sum_{n=1}^\infty{1 \over n^2} = {\pi^2  \over 6}.
>> \stopformula
>> 
>> \q Prove that for any $n \geq 1$ integer one has
>> \startformula
>> \sum_{k=1}^n k^3  = \left({n(n+1) \over 2}\right)^2.
>> \stopformula
>> \StopQuestions
>> \stopexo
>> 
>> \stoptext
>> %%% end example-exercise.tex
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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