ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <hraban@fiee.net>
Subject: Re: serial definition
Date: Tue, 3 Jan 2006 15:11:47 +0100	[thread overview]
Message-ID: <A04E0ACA-6D1D-40E8-BA9B-5420F2D9F5EF@fiee.net> (raw)

(This mail was rejected as spam in my first try, and the reject  
message was catched by my spam filter...)

Am 2006-01-03 um 11:51 schrieb Taco Hoekwater:
> You need to expand the \Set commands in that first loop,
> otherwise you store the literal token \recursevelel inside
> the definitions of the Key and Val macros (\setvalue{}{}
> autoexpands its first argument, but not its second argument).
>
> When not inside a recursion, \recurselevel expands to the number
> 0  (zero) in the "manual bit", and you are actually re-evaluating
> the macro using the then current \recurselevel definition
> when inside the  "looping" bit.

The magic expansion hit me again, I should've known it.

> So you need:
>
>   \dostepwiserecurse{1}{9}{1}{
>     \expanded{\Set{\recurselevel}{K\recurselevel}{V\recurselevel}}
>   }
>
> I hope this is clear enough?

Thank you very much!
Actually, in the real environment I needed the \expanded at another  
place:

\def\Sender#1#2#3{\setvalue{SenderKey#1}{#2}\setvalue{SenderVal#1}{#3}}
\def\GetSenderLine#1{\bTR\bTD\doiftextelse{\getvalue{SenderKey#1}}	 
{\getvalue{SenderKey#1}:}{}\eTD\bTD\getvalue{SenderVal#1}\eTD\eTR}
% initialize values (not even needed)
\dostepwiserecurse{1}{9}{1}{
     \Sender{\recurselevel}{}{}
}

\startsetups sendertablesetup
	\setupTABLE[frame=off]
	\setupTABLE[x][1][width=\senderkeywidth, align=left, style={\keystyle 
\strut}]
	\setupTABLE[x][2][width=\sendervalwidth, align=right, style= 
{\valstyle\strut}]
	\bTABLE
\dostepwiserecurse{1}{9}{1}{% count from 1 to 9, step 1
	\expanded{\GetSenderLine{\recurselevel}}
}
	\eTABLE
\stopsetups

I collect this (and more) at http://wiki.contextgarden.net/ 
Talk:Letter_style



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-03 14:11 UTC|newest]

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

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=A04E0ACA-6D1D-40E8-BA9B-5420F2D9F5EF@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).