ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Two questions - Cross Referencing (Automated label generation + Random items)
@ 2009-03-03 13:17 Curious Learn
  2009-03-03 23:37 ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Curious Learn @ 2009-03-03 13:17 UTC (permalink / raw)
  To: ntg-context


As I mentioned earlier, I am trying to use Context to make a multiple choice
test. I have two questions.

(1) Suppose I want to get a list of answers to the the multiple choice
questions. One way I can think of doing this is by assigning a label to the
CORRECT answer as done in the following code and then referring to that label.
Is there a way these labels can be generated automatically, instead of
hardcoding them as I have done below? 

defineenumeration[problem][text= ,location=inleft] 
\setupenumerations[problem][stopper=)]

\defineitemgroup[choices][levels=1] 
\setupitemgroup[choices][1][a,packed]
\nextrandom

\starttext 

   \problem This is the first question.
     \startchoices      
             \startitem This is incorrect answer 1. \stopitem   
             \startitem This is a wrong answer too. \stopitem
    	     \startitem[1] This is the CORRECT answer. \stopitem   
             \startitem Yet another wrong answer. \stopitem
     \stopchoices

   	\problem This is the second question.
	     \startchoices        
	           \startitem[2] This is the CORRECT answer. \stopitem   
	           \startitem This is a wrong answer too. \stopitem
	    	   \startitem This is not a correct choice. \stopitem   
	           \startitem Yet another wrong answer. \stopitem
	     \stopchoices


Answers to the questions
  
\in[1]

\in[2]    

\stoptext 

(2) When I add the option "random" to the itemgroup
(\setupitemgroup[choices][1][a,packed,random]) then as expected the choices are
listed in a random order. However, the label does not change with the choice
listing. I want the reference to be attached to the CORRECT answer, which
changes its position with random option. Is there a way to have the reference
reflect the letter corresponding to the correct answer.

Thanks in advance for your help. I really appreciate it.     

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


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

* Re: Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-03 13:17 Two questions - Cross Referencing (Automated label generation + Random items) Curious Learn
@ 2009-03-03 23:37 ` Wolfgang Schuster
  2009-03-04 12:54   ` Curious Learn
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2009-03-03 23:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 03.03.2009 um 14:17 schrieb Curious Learn:

> As I mentioned earlier, I am trying to use Context to make a  
> multiple choice
> test. I have two questions.
>
> (1) Suppose I want to get a list of answers to the the multiple choice
> questions. One way I can think of doing this is by assigning a label  
> to the
> CORRECT answer as done in the following code and then referring to  
> that label.
> Is there a way these labels can be generated automatically, instead of
> hardcoding them as I have done below?
>
> defineenumeration[problem][text= ,location=inleft]
> \setupenumerations[problem][stopper=)]
>
> \defineitemgroup[choices][levels=1]
> \setupitemgroup[choices][1][a,packed]
> \nextrandom

You don't need \nextrandom any longer, it's fixed with the last beta.

\newcounter\choicecounter

\define[1]\Rightitem
   {\doglobal\increment\choicecounter
    \startitem[\choicecounter]#1\stopitem}

\define[1]\Wrongitem
   {\startitem#1\stopitem}

\processbetween{rightitem}\Rightitem
\processbetween{wrongitem}\Wrongitem

> \starttext
>
>   \problem This is the first question.
>     \startchoices
>             \startitem This is incorrect answer 1. \stopitem
>             \startitem This is a wrong answer too. \stopitem
>    	     \startitem[1] This is the CORRECT answer. \stopitem
>             \startitem Yet another wrong answer. \stopitem

             \startrightitem This is the CORRECT answer. \stoprightitem
             \startwrongitem Yet another wrong answer.   \stopwrongitem

>     \stopchoices
>
>   	\problem This is the second question.
> 	     \startchoices
> 	           \startitem[2] This is the CORRECT answer. \stopitem
> 	           \startitem This is a wrong answer too. \stopitem
> 	    	   \startitem This is not a correct choice. \stopitem
> 	           \startitem Yet another wrong answer. \stopitem
> 	     \stopchoices
>
>
> Answers to the questions
>
> \in[1]
>
> \in[2]
>
> \stoptext
>
> (2) When I add the option "random" to the itemgroup
> (\setupitemgroup[choices][1][a,packed,random]) then as expected the  
> choices are
> listed in a random order. However, the label does not change with  
> the choice
> listing. I want the reference to be attached to the CORRECT answer,  
> which
> changes its position with random option. Is there a way to have the  
> reference
> reflect the letter corresponding to the correct answer.

The labels change but they're always one run behind the current order.

You can use a fixed random order for the items (the don't change after
each new run) with '\setupsystem[random=3456]', you can change the order
when you user another number.

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


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

* Re:  Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-03 23:37 ` Wolfgang Schuster
@ 2009-03-04 12:54   ` Curious Learn
  2009-03-04 13:26     ` Wolfgang Schuster
  2009-03-04 14:01     ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Curious Learn @ 2009-03-04 12:54 UTC (permalink / raw)
  To: ntg-context

Wolfgang Schuster <schuster.wolfgang <at> googlemail.com> writes:


> You don't need \nextrandom any longer, it's fixed with the last beta.
> 
> \newcounter\choicecounter
> 
> \define[1]\Rightitem
>    {\doglobal\increment\choicecounter
>     \startitem[\choicecounter]#1\stopitem}
> 
> \define[1]\Wrongitem
>    {\startitem#1\stopitem}
> 
> \processbetween{rightitem}\Rightitem
> \processbetween{wrongitem}\Wrongitem
> 

>              \startrightitem This is the CORRECT answer. \stoprightitem
>              \startwrongitem Yet another wrong answer.   \stopwrongitem

> You can use a fixed random order for the items (the don't change after
> each new run) with '\setupsystem[random=3456]', you can change the order
> when you user another number.
> 
> Wolfgang
> 

Awesome solution. Works great. Thanks very much Wolfgang. I can now use your
solution. If it is not too difficult to explain, I would appreciate if someone
could explain why the following does not work. It is not necessary because
Wolfgang's solution is great but will help me understand it better.

\def\AnsT
   {\doglobal\increment\choicecounter
     \startitem[\choicecounter]#1\stopitem}
\def\eAns{\stopitem}

With these commands if I use

\AnsT This is the CORRECT answer. \eAns
\startwrongitem Yet another wrong answer.   \stopwrongitem

I get the error "File ended while scanning use of \startitem"






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


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

* Re: Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-04 12:54   ` Curious Learn
@ 2009-03-04 13:26     ` Wolfgang Schuster
  2009-03-04 15:53       ` Curious Learn
  2009-03-04 14:01     ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2009-03-04 13:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.03.2009 um 13:54 schrieb Curious Learn:

> Awesome solution. Works great. Thanks very much Wolfgang. I can now  
> use your
> solution. If it is not too difficult to explain, I would appreciate  
> if someone
> could explain why the following does not work. It is not necessary  
> because
> Wolfgang's solution is great but will help me understand it better.
>
> \def\AnsT
>   {\doglobal\increment\choicecounter
>     \startitem[\choicecounter]#1\stopitem}
> \def\eAns{\stopitem}
>
> With these commands if I use
>
> \AnsT This is the CORRECT answer. \eAns
> \startwrongitem Yet another wrong answer.   \stopwrongitem
>
> I get the error "File ended while scanning use of \startitem"

It has to do with the that for randomized items ConTeXt has to know
the text for each item, to do this the normal \item ... is not enough
and \startitem ... \stopitem is needed.

Each \startitem ... \stopitem pair collects the text between it and
add it to a list. The collecting works in the way that \startitem grab
everything untill it sees a \stopitem command.

If you want to write your own command you need a similiar mechanism
where your \AnsT grab everything till \eAns but this did not work in
the way you defined the command yourself.

The low level way to do this is:

\def\AnsT#1\eAns
   {\doglobal\increment\choicecounter
    \startitem[\choicecounter]#1\stopitem}


Another way to do this with a few ConTeXt commands is:

\define[1]\Rightitem
   {\doglobal\increment\choicecounter
    \startitem[\choicecounter]#1\stopitem}

\define\AnsT
   {\grabuntil{eAns}\Rightitem}

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


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

* Re: Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-04 12:54   ` Curious Learn
  2009-03-04 13:26     ` Wolfgang Schuster
@ 2009-03-04 14:01     ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2009-03-04 14:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Curious Learn wrote:
> Wolfgang Schuster <schuster.wolfgang <at> googlemail.com> writes:
> 
> 
>> You don't need \nextrandom any longer, it's fixed with the last beta.
>>
>> \newcounter\choicecounter
>>
>> \define[1]\Rightitem
>>    {\doglobal\increment\choicecounter
>>     \startitem[\choicecounter]#1\stopitem}
>>
>> \define[1]\Wrongitem
>>    {\startitem#1\stopitem}
>>
>> \processbetween{rightitem}\Rightitem
>> \processbetween{wrongitem}\Wrongitem
>>
> 
>>              \startrightitem This is the CORRECT answer. \stoprightitem
>>              \startwrongitem Yet another wrong answer.   \stopwrongitem
> 
>> You can use a fixed random order for the items (the don't change after
>> each new run) with '\setupsystem[random=3456]', you can change the order
>> when you user another number.
>>
>> Wolfgang
>>
> 
> Awesome solution. Works great. Thanks very much Wolfgang. I can now use your
> solution. If it is not too difficult to explain, I would appreciate if someone
> could explain why the following does not work. It is not necessary because
> Wolfgang's solution is great but will help me understand it better.

long ago we made interactive tests and such; some of the code was split 
of in m-educat.tex ; i'm not even sure if it works any longer

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re:  Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-04 13:26     ` Wolfgang Schuster
@ 2009-03-04 15:53       ` Curious Learn
  2009-03-04 16:04         ` Mikael Persson
  0 siblings, 1 reply; 10+ messages in thread
From: Curious Learn @ 2009-03-04 15:53 UTC (permalink / raw)
  To: ntg-context


> The low level way to do this is:
> 
> \def\AnsT#1\eAns
>    {\doglobal\increment\choicecounter
>     \startitem[\choicecounter]#1\stopitem}
> 

> Wolfgang


Beautiful! Thanks again Wolfgang. I tried the low level command and it works
great. I will try the Context way later.

Hans, thanks very much for bringing to my attention the file m-educat.tex. Can
you please tell me where I can find it?

Even if I do not use it as it is, I am sure I can learn something and it can
give me some ideas. 


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


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

* Re: Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-04 15:53       ` Curious Learn
@ 2009-03-04 16:04         ` Mikael Persson
  2009-03-04 16:23           ` pst-labo a pstricks module batela
  2009-03-04 17:10           ` Two questions - Cross Referencing (Automated label generation + Random items) Curious Learn
  0 siblings, 2 replies; 10+ messages in thread
From: Mikael Persson @ 2009-03-04 16:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Mar 4, 2009 at 4:53 PM, Curious Learn <curiouslearn@gmail.com> wrote:
>
>> The low level way to do this is:
>>
>> \def\AnsT#1\eAns
>>    {\doglobal\increment\choicecounter
>>     \startitem[\choicecounter]#1\stopitem}
>>
>
>> Wolfgang
>
>
> Beautiful! Thanks again Wolfgang. I tried the low level command and it works
> great. I will try the Context way later.
>
> Hans, thanks very much for bringing to my attention the file m-educat.tex. Can
> you please tell me where I can find it?
>
> Even if I do not use it as it is, I am sure I can learn something and it can
> give me some ideas.
>

Dear Curious Learn (strange name, it can be considered rude not to use
the real one)

You can find m-educat.tex at
tex/texmf-context/tex/context/base/m-educat.tex
if you use the minimals
It is also listed at
http://wiki.contextgarden.net/Modules
if you dont have that installation.

Best regards, Mikael Persson
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* pst-labo a pstricks module
  2009-03-04 16:04         ` Mikael Persson
@ 2009-03-04 16:23           ` batela
  2009-03-07  9:44             ` Wolfgang Schuster
  2009-03-04 17:10           ` Two questions - Cross Referencing (Automated label generation + Random items) Curious Learn
  1 sibling, 1 reply; 10+ messages in thread
From: batela @ 2009-03-04 16:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear Sirs

Is there a way to include  in Context documents some chemistry  
equipment  pictures generated by the pst-labo package.


http://www.tug.org/texlive/Contents/live/texmf-dist/doc/generic/pst- 
labo/pst-labo-docEN.pdf


thanks for your support


Jorge

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


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

* Re:  Two questions - Cross Referencing (Automated label generation + Random items)
  2009-03-04 16:04         ` Mikael Persson
  2009-03-04 16:23           ` pst-labo a pstricks module batela
@ 2009-03-04 17:10           ` Curious Learn
  1 sibling, 0 replies; 10+ messages in thread
From: Curious Learn @ 2009-03-04 17:10 UTC (permalink / raw)
  To: ntg-context

Mikael Persson <mickep <at> gmail.com> writes:


> 
> Dear Curious Learn (strange name, it can be considered rude not to use
> the real one)
> 
> You can find m-educat.tex at
> tex/texmf-context/tex/context/base/m-educat.tex
> if you use the minimals
> It is also listed at
> http://wiki.contextgarden.net/Modules
> if you dont have that installation.
> 
> Best regards, Mikael Persson

Thanks for the information Mikael. I am sorry if my use of a non real name
offended anyone. It seems to be the standard practice on many forums (I agree
not on this one) and I stuck to it. Feel just more comfortable this way. Again,
I apologize if it offended anyone.



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


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

* Re: pst-labo a pstricks module
  2009-03-04 16:23           ` pst-labo a pstricks module batela
@ 2009-03-07  9:44             ` Wolfgang Schuster
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2009-03-07  9:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.03.2009 um 17:23 schrieb batela:

> Dear Sirs
>
> Is there a way to include  in Context documents some chemistry  
> equipment  pictures generated by the pst-labo package.
>
> http://www.tug.org/texlive/Contents/live/texmf-dist/doc/generic/pst-labo/pst-labo-docEN.pdf
>
> thanks for your support
>
> Jorge

Yes it is, you can use the 'pstric' module to create pictures with  
pstricks
but it needs a few modifications.

Give us a complete example from a picture you want to create, it's also
important which TeX distribution you use, TeX Live or minimals.

PS. Don't start a new thread with a reply to a older one, it will get  
lost
in the old one and is hard to find and reduce your chances to get a  
answer.

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


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

end of thread, other threads:[~2009-03-07  9:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-03 13:17 Two questions - Cross Referencing (Automated label generation + Random items) Curious Learn
2009-03-03 23:37 ` Wolfgang Schuster
2009-03-04 12:54   ` Curious Learn
2009-03-04 13:26     ` Wolfgang Schuster
2009-03-04 15:53       ` Curious Learn
2009-03-04 16:04         ` Mikael Persson
2009-03-04 16:23           ` pst-labo a pstricks module batela
2009-03-07  9:44             ` Wolfgang Schuster
2009-03-04 17:10           ` Two questions - Cross Referencing (Automated label generation + Random items) Curious Learn
2009-03-04 14:01     ` Hans Hagen

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