[NTG-context] Prepare exams with ConTeXT

batela batela at tugamail.com
Sun Jun 3 11:57:41 CEST 2007


> \startelements             dutch                     english
>                             german                    czech
>                             italian                   romanian
>                             french
>
>                      begin: beginvan                  start
>                             anfang                    zacatek
>                             inizio                    inceput
>                             debut
>                        end: eindvan                   stop
>                             ende                      konec
>                             fine                      sfarsit
>                             fin
>
> \stopelements
>
> \defineenumeration[Answer][text=Question]
> \defineenumeration[Question]
> \defineblock[answer,question]
> \setupblock
>
> [answer][before={\startAnswer\resetscore},after={\savescore\stopAnswer} 
> ]
> \setupblock
>    [question][before={\startQuestion},after={\stopQuestion}]
>
> \makecounter{totalscore}
>
> \definelist[Score]
>             [   pagenumber=no,
>                      width=5em,
>                     height=broad,
>                textcommand=\showscores,
>              numbercommand=\showquestionnumber,
>             ]
>
> \def\showscores#1{\dotfill\emspace#1~points}
> \def\showquestionnumber#1{Question~#1}
>
> \def\score[#1]%
>    {\incrementcounter{totalscore}{#1}%
>     \dotfill\emspace#1~points\endgraf}
>
> \def\resetscore{\resetcounter{totalscore}}
>
> \def\savescore
>    {\expanded{\dowritetolist{Score}
>
> {\convertednumber[Answer]}{\countervalue{totalscore}}{Question}}}
>
> \hideblocks[answer,question]
>
> \def\generateexam
>    {\title{Exam}
>     \useblocks[question]
>     \title{Scores}
>     \placelist[Score][criterium=all]
>     \title{Criteria}
>     \useblocks[answer]}
>
>
> \starttext
> \startquestion
>   In a body with mass=2 kg is applied a force of 2N. Which is the body
>   acceleration?
>   \startanswer
>     write F = m a \score[5]
>     solve  a = F/m \score[4]
>     find and write correctly a = 1 m/s2 \score[1]
>   \stopanswer
> \stopquestion
> \startquestion
>   In a body with mass=2 kg is applied a force of 2N. Which is the body
>   acceleration?
>   \startanswer
>     write F = m a \score[5]
>     solve  a = F/m \score[14]
>     find and write correctly a = 1 m/s2 \score[10.5]
>   \stopanswer
> \stopquestion
>
> \generateexam
>
> \stoptext


this code generate a little error:

title           : - Scores
(./preparaexame2.tuo)
system          : Score not found/processed
[2.2]
title           : - Criteria
textblocks      : reading blocks from preparaexame2.tub
(./preparaexame2.tub
textblocks      : answer loaded and typeset
Runaway argument?
! Paragraph ended before \dodowritetolist was complete.
<to be read again>
                    \par
\@@expanded ->\dowritetolist {Score} \par
                                           {1}{10}{Question}
\@@tbanswerafter ->\savescore
                               \stopAnswer
\thiswasblockanswer ...lue {\??tb answer\c!after }
                                                   \par \egroup  
\setblocklevel -
l.34 \thiswasblock{answer}

?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3180 bytes
Desc: not available
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20070603/71d5db41/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prepareexam.tex
Type: application/x-tex
Size: 2223 bytes
Desc: not available
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20070603/71d5db41/attachment.tex 
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2 bytes
Desc: not available
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20070603/71d5db41/attachment-0001.bin 


More information about the ntg-context mailing list