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

?

Attachment: prepareexam.tex
Description: TeX document


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

Reply via email to