[NTG-context] Building tables at runtime via --mode= option

Bart C. Wise bntgcontext at wiseguysweb.com
Tue Dec 9 15:08:09 CET 2008

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!

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.

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

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

    % desire: based on textwidth: \textwidth / \getnumber[TotalCol]
    % Needs to be floating point                        

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

    % Row 1                                           
        \bTD[nc=6] Title\eTD
        %desire: \bTD[nc=\getnumber[Rounds]] Title\eTD
    %Row 2
    %Row 3


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20081209/31ad9ed8/attachment.html>

More information about the ntg-context mailing list