Hello, I'm preparing a simple template for exam tests. I have following commad. \question{3}{text text text} where firtst parametr stands for points. I'd like to compute the sum of points to be used as "Total points: xx" What is the correct approach to do that if I'm using MKII? greetings Jan -- Tato zpráva byla vytvořena převratným poštovním klientem Opery: http://www.opera.com/mail/
Jan Pohanka wrote:
Hello, I'm preparing a simple template for exam tests. I have following commad.
\question{3}{text text text}
\newcount\totalpoints \def\question#1#2{\global\advance\totalpoints #1\relax ... #2 ...}
where firtst parametr stands for points.
I'd like to compute the sum of points to be used as "Total points: xx"
Total points: \the\totalpoints Best wishes, Taco
Thank you,
I have an additional question. Is it possible to have the sum available
before the \question commands?
I mean
Total points: \the\totalpoints % or something like that
\question{5}{text text}
\question{3}{text text}
\question{1}{text text}
greetings,
Jan
Dne Tue, 11 May 2010 11:23:30 +0200 Taco Hoekwater
Jan Pohanka wrote:
Hello, I'm preparing a simple template for exam tests. I have following commad. \question{3}{text text text}
\newcount\totalpoints
\def\question#1#2{\global\advance\totalpoints #1\relax ... #2 ...}
where firtst parametr stands for points. I'd like to compute the sum of points to be used as "Total points: xx"
Total points: \the\totalpoints
Best wishes, Taco ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Tato zpráva byla vytvořena převratným poštovním klientem Opery: http://www.opera.com/mail/
Jan Pohanka wrote:
Thank you, I have an additional question. Is it possible to have the sum available before the \question commands?
This is what I would do (but I suspect Wolfgang can come up with something cleaner): \def\startquestions {\newcount\totalpoints} \def\stopquestions {\expanded{\reference[totalpoints]{\the\totalpoints}}} \def\question#1#2{\global\advance\totalpoints #1\relax #2\par} \starttext Total points: \in[totalpoints] \startquestions \question{5}{text text} \question{3}{text text} \question{1}{text text} \stopquestions \stoptext
participants (2)
-
Jan Pohanka
-
Taco Hoekwater