Re: [NTG-context] solutions and problems

2014-02-23 Thread Xan
> > Can you help me?
> 
> Your counter settings are useless because context stores only the environment 
> plus content for the answers, nothing is done with them at this point. When 
> you flush the answer blocks context sees them for the first time and the 
> counter for the questions is 3 at this point and this is why you get always 
> the same value.

Is there any way of first evaluate \getnumber[exercici] and then store the 
content, and not inversely (as context does now)?

> 
> \defineenumeration[exercici][text=Exercici]
> \defineenumeration[resposta][text=Solucions]
> 
> \defineblock[resposta]
> \hideblocks[resposta]
> 
> \starttext
> 
> \startexercici Question 1
> \beginresposta
> \resposta Answer 1 \par
> \endresposta
> \stopexercici
> 
> \startexercici Question 2
> \beginresposta
> \incrementcounter[resposta]
> \endresposta
> \stopexercici
> 
> \startexercici Question 3
> \beginresposta
> \resposta Answer 3 \par
> \endresposta
> \stopexercici
> 
> \subject{Answers}
> 
> \selectblocks[resposta]
> 
> \stoptext
> 
> Wolfgang

Increment counter *every* time is possible option, but in fact very annoying: 
if I have 100 exercises (now I have more than this) and I have only 20 
exercises, then I have to put "\incrementcounter" in 80 exercises. It's a 
tedious thing.

Is there any more "relaxing" thing: assuming that I have 'resposta' nested in 
'exercici' like

\startexercici
\beginresposta
\resposta Answer X
\endresposta
\stopexercici

?


Thanks another time,
Xan
___
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
___


Re: [NTG-context] solutions and problems

2014-02-23 Thread Wolfgang Schuster

Am 23.02.2014 um 20:09 schrieb Xan :

>> Am 22.02.2014 um 18:45 schrieb Xan :
>> 
>>> No, it does not work.
>>> 
>>> I have this:
>>> 
>>> % Questions
>>> \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[resposta]}]
>>> 
>>> % Answers
>>> \defineenumeration[resposta][headstyle=\ss,text={Solucions de l'exercici 
>>> \getnumber[exercici]},width=fit,alternative=serried,before={\decrementcounter[resposta]},number=no]
>>> 
>>> \defineblock[resposta]
>>> \hideblocks[resposta]
>>> 
>>> 
>>> % Exercises
>>> 
>>> \startexercici Bla...
>>> \beginresposta
>>> \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, 
>>> \item No té relació, \item D, \item D, \item No té relació, \item No té 
>>> relació, \item D.\stopitemize) \par
>>> \endresposta
>>> \stopexercici
>>> 
>>> \startexercici Bla 2
>>> \stopexercici
>>> 
>>> \startexercici Bla 3
>>> \beginresposta
>>> \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, 
>>> \item No té relació, \item D, \item D, \item No té relació, \item No té 
>>> relació, \item D.\stopitemize) \par
>>> \endresposta
>>> \stopexercici
>>> 
>>> \subject{Answers}
>>> 
>>> \selectblocks[resposta][criterium=section]
>>> 
>>> 
>>> I get \getnumber[exercici] as the last, not the counter of 'exercici' in 
>>> which I have the answer. How can I do thaT?
>> 
>> Make a complete minimal example.
>> 
>> Wolfgang
> 
> 
> Simply put starttext and stoptext. Here it’s:

For a minimal example you don’t need so many setups for the enumerations and 
also text should be kept to a minimum.

> Can you help me?

Your counter settings are useless because context stores only the environment 
plus content for the answers, nothing is done with them at this point. When you 
flush the answer blocks context sees them for the first time and the counter 
for the questions is 3 at this point and this is why you get always the same 
value.

\defineenumeration[exercici][text=Exercici]
\defineenumeration[resposta][text=Solucions]

\defineblock[resposta]
\hideblocks[resposta]

\starttext

\startexercici Question 1
\beginresposta
\resposta Answer 1 \par
\endresposta
\stopexercici

\startexercici Question 2
\beginresposta
\incrementcounter[resposta]
\endresposta
\stopexercici

\startexercici Question 3
\beginresposta
\resposta Answer 3 \par
\endresposta
\stopexercici

\subject{Answers}

\selectblocks[resposta]

\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
___

Re: [NTG-context] solutions and problems

2014-02-23 Thread Xan
> Am 22.02.2014 um 18:45 schrieb Xan :
> 
> > No, it does not work.
> > 
> > I have this:
> > 
> > % Questions
> > \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[resposta]}]
> > 
> > % Answers
> > \defineenumeration[resposta][headstyle=\ss,text={Solucions de l'exercici 
> > \getnumber[exercici]},width=fit,alternative=serried,before={\decrementcounter[resposta]},number=no]
> > 
> > \defineblock[resposta]
> > \hideblocks[resposta]
> > 
> > 
> > % Exercises
> > 
> > \startexercici Bla...
> > \beginresposta
> > \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, 
> > \item No té relació, \item D, \item D, \item No té relació, \item No té 
> > relació, \item D.\stopitemize) \par
> > \endresposta
> > \stopexercici
> > 
> > \startexercici Bla 2
> > \stopexercici
> > 
> > \startexercici Bla 3
> > \beginresposta
> > \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, 
> > \item No té relació, \item D, \item D, \item No té relació, \item No té 
> > relació, \item D.\stopitemize) \par
> > \endresposta
> > \stopexercici
> > 
> > \subject{Answers}
> > 
> > \selectblocks[resposta][criterium=section]
> > 
> > 
> > I get \getnumber[exercici] as the last, not the counter of 'exercici' in 
> > which I have the answer. How can I do thaT?
> 
> Make a complete minimal example.
> 
> Wolfgang


Simply put starttext and stoptext. Here it's:

% Questions
\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[resposta]}]

% Answers
\defineenumeration[resposta][headstyle=\ss,text={Solucions de l'exercici 
\getnumber[exercici]},width=fit,alternative=serried,before={\decrementcounter[resposta]},number=no]

\defineblock[resposta]
\hideblocks[resposta]


% Exercises

\starttext
\startexercici Bla...
\beginresposta
\resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item No 
té relació, \item D, \item D, \item No té relació, \item No té relació, \item 
D.\stopitemize) \par
\endresposta
\stopexercici

\startexercici Bla 2
\stopexercici

\startexercici Bla 3
\beginresposta
\resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item No 
té relació, \item D, \item D, \item No té relació, \item No té relació, \item 
D.\stopitemize) \par
\endresposta
\stopexercici

\subject{Answers}

\selectblocks[resposta][criterium=section]
\stoptext


Can you help me?
Thanks,
___
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
___


Re: [NTG-context] solutions and problems

2014-02-22 Thread Wolfgang Schuster

Am 22.02.2014 um 18:45 schrieb Xan :

> No, it does not work.
> 
> I have this:
> 
> % Questions
> \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[resposta]}]
> 
> % Answers
> \defineenumeration[resposta][headstyle=\ss,text={Solucions de l'exercici 
> \getnumber[exercici]},width=fit,alternative=serried,before={\decrementcounter[resposta]},number=no]
> 
> \defineblock[resposta]
> \hideblocks[resposta]
> 
> 
> % Exercises
> 
> \startexercici Bla...
> \beginresposta
> \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item 
> No té relació, \item D, \item D, \item No té relació, \item No té relació, 
> \item D.\stopitemize) \par
> \endresposta
> \stopexercici
> 
> \startexercici Bla 2
> \stopexercici
> 
> \startexercici Bla 3
> \beginresposta
> \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item 
> No té relació, \item D, \item D, \item No té relació, \item No té relació, 
> \item D.\stopitemize) \par
> \endresposta
> \stopexercici
> 
> \subject{Answers}
> 
> \selectblocks[resposta][criterium=section]
> 
> 
> I get \getnumber[exercici] as the last, not the counter of 'exercici' in 
> which I have the answer. How can I do thaT?

Make a complete minimal example.

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
___


Re: [NTG-context] solutions and problems

2014-02-22 Thread Xan
No, it does not work.

I have this:

% Questions
\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[resposta]}]

% Answers
\defineenumeration[resposta][headstyle=\ss,text={Solucions de l'exercici 
\getnumber[exercici]},width=fit,alternative=serried,before={\decrementcounter[resposta]},number=no]

\defineblock[resposta]
\hideblocks[resposta]


% Exercises

\startexercici Bla...
\beginresposta
\resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item No 
té relació, \item D, \item D, \item No té relació, \item No té relació, \item 
D.\stopitemize) \par
\endresposta
\stopexercici

\startexercici Bla 2
\stopexercici

\startexercici Bla 3
\beginresposta
\resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item No 
té relació, \item D, \item D, \item No té relació, \item No té relació, \item 
D.\stopitemize) \par
\endresposta
\stopexercici

\subject{Answers}

\selectblocks[resposta][criterium=section]


I get \getnumber[exercici] as the last, not the counter of 'exercici' in which 
I have the answer. How can I do thaT?

Thanks,
___
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
___


Re: [NTG-context] solutions and problems

2014-02-21 Thread Xan
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
___
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
___


Re: [NTG-context] solutions and problems

2014-02-20 Thread Jaroslav Hajtmar

Thanx Wolfgang.
For me this is valuable information
Jaroslav Hajtmar



Dne 20.2.2014 14:13, Wolfgang Schuster napsal(a):

Am 20.02.2014 um 13:22 schrieb Xan :


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
___



___
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
___


Re: [NTG-context] solutions and problems

2014-02-20 Thread Jaroslav Hajtmar

Thanx Thomas
very much for link to PDF file "Using ConTEXt with Databases". I'm sure 
I will use it in the future.

Jaroslav Hajtmar


Dne 20.2.2014 13:57, Thomas A. Schmitz napsal(a):

On 02/20/2014 01:22 PM, Xan wrote:
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;-)


Thanks,


Obviously you will have to give every question|answer|hint some sort 
of unique identifier to which you can later refer. So an enumeration 
is maybe not the best approach for this because these identifiers need 
to be shared between all your blocks.


Just a personal impression: if you want to have many of these blocks, 
I would advise to use some format other than TeX to store them because 
it soon becomes difficult to read for you and unsustainable. I have 
written something in MAPS (http://www.ntg.nl/maps/42/12.pdf) which may 
be useful for you.


Thomas
___ 

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
___


Re: [NTG-context] solutions and problems

2014-02-20 Thread Wolfgang Schuster

Am 20.02.2014 um 13:22 schrieb Xan :

> 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
___


Re: [NTG-context] solutions and problems

2014-02-20 Thread Thomas A. Schmitz

On 02/20/2014 01:22 PM, Xan wrote:

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;-)

Thanks,


Obviously you will have to give every question|answer|hint some sort of 
unique identifier to which you can later refer. So an enumeration is 
maybe not the best approach for this because these identifiers need to 
be shared between all your blocks.


Just a personal impression: if you want to have many of these blocks, I 
would advise to use some format other than TeX to store them because it 
soon becomes difficult to read for you and unsustainable. I have written 
something in MAPS (http://www.ntg.nl/maps/42/12.pdf) which may be useful 
for you.


Thomas
___
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
___


Re: [NTG-context] solutions and problems

2014-02-20 Thread Xan
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 ;-)

Thanks,

> Hi,
> 
> Maybe this is what you looking for:
> 
>  begin question-hint-answer.tex
> \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
>  end question-hint-answer.tex
> 
> Best regards: OK
___
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
___


Re: [NTG-context] solutions and problems

2014-02-20 Thread Otared Kavian
Hi,

Maybe this is what you looking for:

 begin question-hint-answer.tex
\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
 end question-hint-answer.tex

Best regards: OK

On 20 févr. 2014, at 10:15, Xan  wrote:

> Hi,
> 
> Just a question about blocks... I consulted the manual, but I'm in trouble:
> 
> I have this definitions:
> 
> % the exercise
> \defineenumeration
>  [exercici]
>  
> [alternative=serried,text={\startcolor[darkblue]Exercici\stopcolor},stopper={.\space},left={\bgroup},right={\egroup},width=fit,headstyle=\ss,distance=0.25em,width=fit]
> 
> 
> \defineenumeration[resposta][headstyle=\ss,text={Solucions},width=fit,alternative=serried]
> 
> \defineblock[resposta] % the answer
> \hideblocks[resposta]
> 
> And in my text, I have:
> 
> \startexercici
> \beginresposta
> \resposta Exercici 2 (Solucions: \startitemize[a,text] \item D, \item I, 
> \item D, \item No té relació, \item D, \item D, \item No té relació, \item No 
> té relació, \item D.\stopitemize) \par
> \endresposta
> \stopexercici
> ...
> 
> \startmode[solucions]
> \subject{Respostes} %Answers
> 
> \selectblocks[resposta][criterium=section]
> \stopmode
> ...
> 
> 
> Is there any way that the answers (resposta) has the same number as the 
> 'exercici' in which it belongs to? If not, I have to put "Solutions of 
> exercici 2" in my 'resposta'
> 
> Thank you very much
> ___
> 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
___