# [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[Question]
> \setupblock
>
> ]
> \setupblock
>    [question][before={\startQuestion},after={\stopQuestion}]
>
> \makecounter{totalscore}
>
> \definelist[Score]
>             [   pagenumber=no,
>                      width=5em,
>                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}
>
>
>
> \def\generateexam
>    {\title{Exam}
>     \useblocks[question]
>     \title{Scores}
>     \placelist[Score][criterium=all]
>     \title{Criteria}
>
>
> \starttext
> \startquestion
>   In a body with mass=2 kg is applied a force of 2N. Which is the body
>   acceleration?
>     write F = m a \score[5]
>     solve  a = F/m \score[4]
>     find and write correctly a = 1 m/s2 \score[1]
> \stopquestion
> \startquestion
>   In a body with mass=2 kg is applied a force of 2N. Which is the body
>   acceleration?
>     write F = m a \score[5]
>     solve  a = F/m \score[14]
>     find and write correctly a = 1 m/s2 \score[10.5]
> \stopquestion
>
> \generateexam
>
> \stoptext

this code generate a little error:

title           : - Scores
(./preparaexame2.tuo)
[2.2]
title           : - Criteria
textblocks      : reading blocks from preparaexame2.tub
(./preparaexame2.tub
Runaway argument?
! Paragraph ended before \dodowritetolist was complete.
<to be read again>
\par
\@@expanded ->\dowritetolist {Score} \par
{1}{10}{Question}
\par \egroup
\setblocklevel -

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