ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* solutions and problems
@ 2014-02-20  9:15 Xan
  2014-02-20 10:50 ` Otared Kavian
  2014-02-20 12:22 ` Xan
  0 siblings, 2 replies; 13+ messages in thread
From: Xan @ 2014-02-20  9:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20  9:15 solutions and problems Xan
@ 2014-02-20 10:50 ` Otared Kavian
  2014-02-20 12:22 ` Xan
  1 sibling, 0 replies; 13+ messages in thread
From: Otared Kavian @ 2014-02-20 10:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 <dxpublica@telefonica.net> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20  9:15 solutions and problems Xan
  2014-02-20 10:50 ` Otared Kavian
@ 2014-02-20 12:22 ` Xan
  2014-02-20 12:57   ` Thomas A. Schmitz
                     ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: Xan @ 2014-02-20 12:22 UTC (permalink / raw)
  To: otared; +Cc: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20 12:22 ` Xan
@ 2014-02-20 12:57   ` Thomas A. Schmitz
  2014-02-20 19:29     ` Jaroslav Hajtmar
  2014-02-20 13:13   ` Wolfgang Schuster
  2014-02-21  9:28   ` Xan
  2 siblings, 1 reply; 13+ messages in thread
From: Thomas A. Schmitz @ 2014-02-20 12:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20 12:22 ` Xan
  2014-02-20 12:57   ` Thomas A. Schmitz
@ 2014-02-20 13:13   ` Wolfgang Schuster
  2014-02-20 19:31     ` Jaroslav Hajtmar
  2014-02-21  9:28   ` Xan
  2 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Schuster @ 2014-02-20 13:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 20.02.2014 um 13:22 schrieb Xan <dxpublica@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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20 12:57   ` Thomas A. Schmitz
@ 2014-02-20 19:29     ` Jaroslav Hajtmar
  0 siblings, 0 replies; 13+ messages in thread
From: Jaroslav Hajtmar @ 2014-02-20 19:29 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20 13:13   ` Wolfgang Schuster
@ 2014-02-20 19:31     ` Jaroslav Hajtmar
  0 siblings, 0 replies; 13+ messages in thread
From: Jaroslav Hajtmar @ 2014-02-20 19:31 UTC (permalink / raw)
  To: ntg-context

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 <dxpublica@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
> ___________________________________________________________________________________
>

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-20 12:22 ` Xan
  2014-02-20 12:57   ` Thomas A. Schmitz
  2014-02-20 13:13   ` Wolfgang Schuster
@ 2014-02-21  9:28   ` Xan
  2014-02-22 17:45     ` Xan
  2 siblings, 1 reply; 13+ messages in thread
From: Xan @ 2014-02-21  9:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-21  9:28   ` Xan
@ 2014-02-22 17:45     ` Xan
  2014-02-22 18:57       ` Wolfgang Schuster
  2014-02-23 19:09       ` Xan
  0 siblings, 2 replies; 13+ messages in thread
From: Xan @ 2014-02-22 17:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-22 17:45     ` Xan
@ 2014-02-22 18:57       ` Wolfgang Schuster
  2014-02-23 19:09       ` Xan
  1 sibling, 0 replies; 13+ messages in thread
From: Wolfgang Schuster @ 2014-02-22 18:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 22.02.2014 um 18:45 schrieb Xan <dxpublica@telefonica.net>:

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-22 17:45     ` Xan
  2014-02-22 18:57       ` Wolfgang Schuster
@ 2014-02-23 19:09       ` Xan
  2014-02-23 19:51         ` Wolfgang Schuster
  2014-02-23 20:12         ` Xan
  1 sibling, 2 replies; 13+ messages in thread
From: Xan @ 2014-02-23 19:09 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

> Am 22.02.2014 um 18:45 schrieb Xan <dxpublica at telefonica.net>:
> 
> > 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-23 19:09       ` Xan
@ 2014-02-23 19:51         ` Wolfgang Schuster
  2014-02-23 20:12         ` Xan
  1 sibling, 0 replies; 13+ messages in thread
From: Wolfgang Schuster @ 2014-02-23 19:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2683 bytes --]


Am 23.02.2014 um 20:09 schrieb Xan <dxpublica@telefonica.net>:

>> Am 22.02.2014 um 18:45 schrieb Xan <dxpublica at telefonica.net>:
>> 
>>> 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


[-- Attachment #1.2: Type: text/html, Size: 4158 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: solutions and problems
  2014-02-23 19:09       ` Xan
  2014-02-23 19:51         ` Wolfgang Schuster
@ 2014-02-23 20:12         ` Xan
  1 sibling, 0 replies; 13+ messages in thread
From: Xan @ 2014-02-23 20:12 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-02-23 20:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20  9:15 solutions and problems Xan
2014-02-20 10:50 ` Otared Kavian
2014-02-20 12:22 ` Xan
2014-02-20 12:57   ` Thomas A. Schmitz
2014-02-20 19:29     ` Jaroslav Hajtmar
2014-02-20 13:13   ` Wolfgang Schuster
2014-02-20 19:31     ` Jaroslav Hajtmar
2014-02-21  9:28   ` Xan
2014-02-22 17:45     ` Xan
2014-02-22 18:57       ` Wolfgang Schuster
2014-02-23 19:09       ` Xan
2014-02-23 19:51         ` Wolfgang Schuster
2014-02-23 20:12         ` Xan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).