From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/32394 Path: news.gmane.org!not-for-mail From: Thomas Engel Newsgroups: gmane.comp.tex.context Subject: Re: store counter or variable and reread again Date: Sun, 31 Dec 2006 09:21:13 +0100 Message-ID: <459772F9.8070501@gmx.net> References: <45941026$0$4168$ba624c82@nntp02.dk.telia.net> <459670F8.5020106@elvenkind.com> <45968AED.7040904@gmx.net> <4596E9B0.8070705@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1167553302 23373 80.91.229.12 (31 Dec 2006 08:21:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 31 Dec 2006 08:21:42 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 31 09:21:41 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1H0vwl-0006nl-Pj for gctc-ntg-context-518@m.gmane.org; Sun, 31 Dec 2006 09:21:35 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id EEBA22003E; Sun, 31 Dec 2006 09:19:14 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05944-05; Sun, 31 Dec 2006 09:19:04 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 18B451FFD0; Sun, 31 Dec 2006 09:19:04 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 059351FFDC for ; Sun, 31 Dec 2006 09:19:02 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06046-05 for ; Sun, 31 Dec 2006 09:18:57 +0100 (CET) Original-Received: from mx0.vr-web.de (mx0.vr-web.de [195.200.35.198]) by ronja.ntg.nl (Postfix) with SMTP id 29E691FFCF for ; Sun, 31 Dec 2006 09:18:57 +0100 (CET) Original-Received: from mx0.vr-web.de (vrwf203.vrweb.de [::ffff:192.168.27.26]) by mx0.vr-web.de with esmtp; Sun, 31 Dec 2006 09:21:14 +0100 id 00083C7B.459772FA.00006A81 Original-Received: from [192.168.0.2] (p50818514.dip0.t-ipconnect.de [::ffff:80.129.133.20]) (QVVUSDogTE9HSU4gdGhvbWFzLmVuZ2Vs) by mx0.vr-web.de with esmtp; Sun, 31 Dec 2006 09:21:14 +0100 id 0008FC09.459772FA.000028F2 User-Agent: IceDove 1.5.0.7 (X11/20061013) Original-To: mailing list for ConTeXt users In-Reply-To: X-BitDefender-Scanner: Clean, Agent: BitDefender Courier MTA Agent 1.6.2 on vrwebmail X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:32394 Archived-At: Aditya Mahajan wrote: > \unprotect > \def\addtocounter#1#2% #1 name #2 value > {\@EA\xdef\csname#1\endcsname{\the\numexpr\csname#1\endcsname+#2\relax}} > \protect > > % To Hans and Taco: Should the above macro be added to syst-ext? > > % Now lets define everything in terms of ConTeXt's counter macros > > \makecounter{Points} > > % % show the points on the right side > \def\showP[#1]{\inright{\hskip 10mm \framed{#1} }} > > \def\pkt[#1]% > {\showP[#1]% > \addtocounter{Points}{#1}} > % > > \def\nofPoints{0} % Number of points from previous run > > \def\savenofPoints > {\savecurrentvalue\nofPoints{\countervalue{Points}}} > > % It is a bit boring to type \savenofPoints everytime > > \appendtoks \savenofPoints \to \everystoptext > Thanks for your help. It's great! What I recognized is when I put this on layer for better placement of the header it doesn't work. Here is an example: \def\Schulaufgabekopf% {\bf \tfa \setupTABLE[option=stretch] \setupTABLE[frame=off] \setupTABLE[column][1][width=0.7\textwidth] \setupTABLE[column][2][width=0.3\textwidth] \setupTABLE[row][2,3,4][background=color,backgroundcolor=gray,frame=off] \setupTABLE[row][5][height=1cm] \bTABLE \bTR \bTD \strut \eTD \bTD \strut \eTD \eTR \bTR \bTD \AAnr \eTD \bTD Date: \eTD \eTR \bTR \bTD Name: \eTD \bTD Points: \hfill of \nofPoints \eTD\eTR \bTR \bTD Form: \Klnr \eTD \bTD Mark: \eTD \eTR \bTR \bTD [nc=3, align=low] \tfxx Unterschrift eines Erziehungsberechtigten: \thinrule \eTD \eTR \eTABLE} \definelayer[kopf][width=\paperwidth, height=\paperheight] %Klassenarbeiten Kopf \def\AAnr{2. Schulaufgabe Englisch 2006/2007} \def\Klnr{10 \hfill} %\definelogo[SAK] [top][left][command=\Schulaufgabekopf] %\placelogos[SAK] \setlayer[kopf][x=1.9cm, y=1cm]{\Schulaufgabekopf} \setupbackgrounds[page][background=kopf] \starttext % Lets set 10 problems with different points \dorecurse{10} {\pkt[\recurselevel] \input tufte \endgraf} \stoptext What's going wrong? Thomas