From: Bernd Militzer <bernd@militzer.net>
Subject: enumeration and countproblem
Date: 05 Nov 2003 09:02:23 +0100 [thread overview]
Message-ID: <1068019343.1803.3.camel@eagle.militzer.net.local> (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
reply other threads:[~2003-11-05 8:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1068019343.1803.3.camel@eagle.militzer.net.local \
--to=bernd@militzer.net \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).