ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <hraban@fiee.net>
Subject: Re: serial definition
Date: Mon, 2 Jan 2006 22:46:14 +0100	[thread overview]
Message-ID: <A233421A-20D5-40CA-855E-1AE76C506DA9@fiee.net> (raw)
In-Reply-To: <43B96ED1.8040409@gmx.net>

Am 2006-01-02 um 19:20 schrieb Peter Rolf:
> You can use \newcounter for such stuff or the context recurse  
> functions
> (with \recurselevel).

I tried the following:

<TEX>
\dostepwiserecurse{1}{9}{1}{% count from 1 to 9, step 1
     \def\lettersenderkey\recurselevel{}
     \def\lettersenderval\recurselevel{}
     \def\Sender\recurselevel#1#2{%
         \def\lettersenderkey\recurselevel{#1}%
         \def\lettersenderval\recurselevel{#2}}
}
\Sender1{Name}{Hraban}
</TEX>

--> ! Use of Sender doesn't match its definition.


Seems like \def\Something\recurselevel isn't valid.
(Sure, just confirmed in the TeXbook, numbers aren't considered  
command-word characters.)

After some hacking I learned how \setvalue works:

<TEX>
\def\Set#1#2#3{\setvalue{Key#1}{#2}\setvalue{Val#1}{#3}}
\def\Get#1{\getvalue{Key#1}/\getvalue{Val#1}}

\dostepwiserecurse{1}{9}{1}{
     \Set{\recurselevel}{K\recurselevel}{V\recurselevel}
}
\Set{1}{eins}{EINS}
\Set{2}{zwei}{ZWEI}

manually: \Get{1} -- \Get{2} -- \Get{3}

looping:
\dostepwiserecurse{1}{5}{1}{
     \Get{\recurselevel} --
}
</TEX>

results in:

manually: eins/EINS – zwei/ZWEI – K0/V0
looping: eins/EINS – zwei/ZWEI – K3/V3 – K4/V4 – K5/V5 –

Why do I get K0/V0 for \Get{3}? - it works with \recurselevel!


Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

  reply	other threads:[~2006-01-02 21:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-02 14:54 Henning Hraban Ramm
2006-01-02 18:20 ` Peter Rolf
2006-01-02 21:46   ` Henning Hraban Ramm [this message]
2006-01-03 10:33     ` Peter Rolf
2006-01-03 10:51       ` Taco Hoekwater
2006-01-03 17:22         ` Hans Hagen
2006-01-03 14:11 Henning Hraban Ramm
2006-01-06 21:25 ` Willi Egger

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=A233421A-20D5-40CA-855E-1AE76C506DA9@fiee.net \
    --to=hraban@fiee.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).