* Building tables at runtime via --mode= option
@ 2008-12-09 14:08 Bart C. Wise
0 siblings, 0 replies; only message in thread
From: Bart C. Wise @ 2008-12-09 14:08 UTC (permalink / raw)
To: Context Mailing List
[-- Attachment #1.1: Type: text/plain, Size: 2154 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 10815 bytes --]
[-- Attachment #2: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-12-09 14:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-09 14:08 Building tables at runtime via --mode= option Bart C. Wise
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).