* enumeration and countproblem
@ 2003-11-05 8:02 Bernd Militzer
0 siblings, 0 replies; only message in thread
From: Bernd Militzer @ 2003-11-05 8:02 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
Hi all,
Writing examinations I want to tell my students the points of each
question and the max points they can reach.
I wrote a macro which prints the points at the right side of the
question and count the points.
%
%
% ad the points of each question
\def\getPunkte[#1]{\advance\summeP by \number#1}
%
% show the points on the right side
\def\showP[#1]{\inright{\hfill(#1 P.)}}
%
% handle the points
\def\pkt[#1]%
{%
\ifnum\ZeigeP=1
\showP[#1]%
\ifnum\addP=1
\getPunkte[#1]
\fi
\fi%
}
%
Using this macro in normal text like
TestQuestion \pkt[5]
it works without problems!
But when I use this macro in combination with enumeration I run in a
problem
example:
%
\defineenumeration[question][location=inmargin,text=,width=fit]
%
\question\pkt[5]
TestQuestion\par
nothing ist count in this case!
How can I fix this problem?
Thanks in advance.
Bernd
[-- Attachment #2: test.tex --]
[-- Type: text/plain, Size: 1990 bytes --]
\starttext
%
% Zähler für die Punkte [summeP] = 0
%
\global\newcount\summeP \summeP=0
%
%
% Schalter [ZeigeP] (intern) zur Steuerung der Anzeige der Punkte
% Ausgangswert 0, d.h. die Punkte werden nicht angezeigt
%
\chardef\ZeigeP=0
%
% Schalter [addP] (intern) zur Steuerung der Berechnung der Gesamtpunkte
% Ausgangswert 0, d.h. die Gesamtpunkte werden nicht berechnet
\chardef\addP=0
%
% Die Schalter für den Anwender
% direkt nach \starttext setzen
% [1]
% die Punkte der Aufgaben anzeigen
\def\zeigePunkte{\chardef\ZeigeP=1}
%
% [2]
% die Gesamtpunktzahl berechnen
\def\SummePunkte{\chardef\addP=1}
%
% Berechnung der GesamtPunkte [getPunkte] durchführen
%
\def\getPunkte[#1]{\advance\summeP by \number#1}
%
%
% Punkte im rechten Rand ausgeben
%
\def\showP[#1]{\inright{\hfill(#1 P.)}}
%
%
% Die Behandlung der Punktangaben
%
\def\pkt[#1]%
{%
\ifnum\ZeigeP=1
\showP[#1]%
\ifnum\addP=1
\getPunkte[#1]
\fi
\fi%
}
%
%
\defineenumeration[question][location=inmargin,text=,width=fit]
%
\zeigePunkte % Punkte anzeigen
\SummePunkte % Summe der Punkte berechnen
%
%
\textrule[top]{first test}
max. points (start): \number\summeP\blank
%
First TestQuestion \pkt[5]
\dorecurse{10}{just a test text }
\blank[medium]
Second TestQuestion \pkt[15]
\dorecurse{10}{just a test text }
\blank[medium]
%
max. points (end): \number\summeP.\blank[2*big]
%
%
\textrule[top]{second test}
%
\summeP=0
max. points (start): \number\summeP\blank
%
\question\pkt[5]
\dorecurse{10}{just a test text }\par
%
\question\pkt[15]
\dorecurse{10}{just a test text }\par
%
max. points (end): \number\summeP.\blank[2*big]
%
%
\textrule[top]{third test}
%
\summeP=0
max. points (start): \number\summeP\blank
%
\question
\dorecurse{10}{just a test text }\par\pkt[5]
%
\question
\dorecurse{10}{just a test text }\par\pkt[15]
%
max. points (end): \number\summeP.\blank[2*big]
%
\stoptext
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-11-05 8:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05 8:02 enumeration and countproblem Bernd Militzer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).