[...]

>
> this code generate a little error:


this is because there are some spurious spaces in Aditya's code. It
works fine if you remove them:


\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


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