ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \dorecurse and \recurselevel in Natural Tables
Date: Fri, 6 Mar 2009 11:33:40 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.00.0903061124310.29793@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <AB25E1B2-56A1-459D-9888-293CD4933D36@gmail.com>

On Fri, 6 Mar 2009, Wolfgang Schuster wrote:

>
> Am 06.03.2009 um 04:05 schrieb Aditya Mahajan:
>
>> My summary of this thread:
>> http://randomdeterminism.wordpress.com/2009/03/05/tex-programming-the-past-the-present-and-the-future/
>
> Nice article but I have a few corrections for you.
>
>
> Table setup:
>
> To achieve horizontal and vertical centered content in the table cell
> you need 'align={middle,lohi}'.

Hmm... align={middle,middle} also works. I haven't checked the code to see 
why.

>
> Pure table code:
>
> You forgot the \bTR and \eTR before and after each row.

Thanks.

>
> Expandafter solution:
>
> You don't need as many \expandafter as you did in your example,
> one before \bTD in each loop is enough.
>
> \bTABLE
> \bTR
>  \bTD $(+)$ \eTD
>  \dorecurse{6}
>   {\expandafter \bTD \recurselevel \eTD}
>  \eTR
> \dorecurse{6}
> {\bTR
>     \edef\firstrecurselevel{\recurselevel}
>     \expandafter\bTD \recurselevel \eTD
>  \dorecurse{6}
>    {\expandafter
>     \bTD
>      \the\numexpr\firstrecurselevel+\recurselevel\relax
>     \eTD}
>  \eTR}
> \eTABLE

Ah. I was experimenting without the \the\numexpr (replacing both by 
\relax) so that I could see the output. I did not realize that \numexpr 
expands its arguments anyways.
>
> \for loop:
>
> If you really want to show this loop you also the correct
> commands to access the counters. #1 did also work but only
> because the command is wrapped around \dostepwiserecurse.
>
> \bTABLE
>  \bTR
>    \bTD $(+)$ \eTD
>    \for \y=1 \to 6 \step 1 \do
>      {\bTD \y \eTD}
>  \eTR
>  \for \x=1 \to 6 \step 1 \do
>  {\bTR
>     \bTD \x \eTD
>    \for \y=1 \to 6 \step 1 \do
>    {\bTD \the\numexpr\x+\y \eTD}
>  \eTR}
> \eTABLE

This does not work, for the same reason that the \dorecurse solution does 
not work. You need to exapnad \x and \y in the first row and first column.

> Thank you for the article and I'm looking forward for the next.

Thanks for the feedback.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2009-03-06 16:33 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 19:35 Curious Learn
2009-03-04 19:53 ` luigi scarso
2009-03-04 20:04   ` luigi scarso
2009-03-05  0:17   ` luigi scarso
2009-03-05 11:09     ` Wolfgang Schuster
2009-03-05 11:27       ` luigi scarso
2009-03-05 12:00         ` Wolfgang Schuster
2009-03-05 13:23           ` luigi scarso
2009-03-05 13:52             ` Wolfgang Schuster
2009-03-05 14:23               ` luigi scarso
2009-03-05 14:53                 ` Wolfgang Schuster
2009-03-05 15:08                   ` luigi scarso
2009-03-06  3:05         ` Aditya Mahajan
2009-03-06  6:41           ` luigi scarso
2009-03-06 10:47             ` Wolfgang Schuster
2009-03-06 11:20           ` Willi Egger
2009-03-06 13:01           ` Curious Learn
2009-03-06 13:32             ` Arthur Reutenauer
2009-03-06 16:15               ` Curious Learn
2009-03-06 13:35             ` luigi scarso
2009-03-06 14:49           ` Wolfgang Schuster
2009-03-06 16:33             ` Aditya Mahajan [this message]
2009-03-06 17:07               ` Wolfgang Schuster
2009-03-06 16:38           ` Aditya Mahajan
2009-03-04 20:35 ` Wolfgang Schuster
2009-03-04 20:57   ` Curious Learn
2009-03-04 21:11     ` Wolfgang Schuster
2009-03-04 21:43       ` Aditya Mahajan
2009-03-04 21:51         ` Wolfgang Schuster
2009-03-04 22:17       ` Curious Learn
2009-03-04 22:35         ` Wolfgang Schuster

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=alpine.LNX.2.00.0903061124310.29793@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --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).