I'm trying to build a table in a project that will be built based on a 
commandline parameter.  Currently, I'd like to use the "--mode=<>" command.  
However, I've run into a number of snags that I have attempted to solve 
without any luck.  I've included some sample code of what I would like to do.

I can do all of what I need using \doifmodeelse, etc.  However, I'm looking 
for a more elegeant solution.  Any hints/solutions are welcomed!

Problems:
1) \currentmode: I cannot use this variable in my file, but it works in the 
source code.  Question: Is the mode option okay, or is there a better way?

2) CellWidth (below) needs to be a floating point dimension, based the size of 
the paper.  So I need to divide the size of the paper (\textwidth) by a number 
and make sure it stays as a dimension.

3) I tried to use \getnumber[Rounds] to span a number of columns ( 
\bTD[nc=\getnumber[Rounds]]) but this would not compile.   Here's the error:
Runaway argument?
Rounds=\plusone \ifnum \tblny =\plusone \ifnum \currentcol >\maximumcol \ETC.
! Paragraph ended before \getnumber was complete.


Sample:
\definenumber[Rounds]
\setnumber[Rounds]{6}
    % desire: \setupnumber[Rounds]{\currentmode}
    % and verify that it's a number between a given range.
    % \currentmode comes back as undefined

\definenumber[TotalCol]
\setnumber[TotalCol]{\getnumber[Rounds] + 2}

\def\CellWidth{0.625in}
    % desire: based on textwidth: \textwidth / \getnumber[TotalCol]
    % Needs to be floating point                        

\starttext
Rounds: \getnumber[Rounds]\crlf
TotalCol: \getnumber[TotalCol]\crlf
CellWidth: \CellWidth\crlf         

\bTABLE[align={middle,lohi},strut=no,width=\CellWidth]
    % Row 1                                           
    \bTR[frame=off]
        \bTD\eTD
        \bTD[nc=6] Title\eTD
        %desire: \bTD[nc=\getnumber[Rounds]] Title\eTD
    \eTR
    %Row 2
    \bTR
        \bTD\eTD
        \dorecurse{\getnumber[Rounds]}{\expanded{\bTD\recurselevel\eTD}}
        \bTD\eTD
    \eTR
    %Row 3
    \bTR
        \dorecurse{\getnumber[TotalCol]}{\expanded{\bTD\recurselevel\eTD}}
    \eTR

\eTABLE
\stoptext

Thanks!
Bart
___________________________________________________________________________________
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 via email to