[NTG-context] Split numbers in natural tables

Xan xancorreu at gmail.com
Sun Aug 23 19:45:02 CEST 2015


Thanks.

On Fri, 21 Aug 2015 16:52:11 +0200
Xan <xancorreu at gmail.com> ha escrit:

> Hi,
> 
> I have a simple script in mako templates which generate this table:
> 
> 
> \starttext
> \bTABLE[align={lohi,middle}]
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 1 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 2 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 4 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 8 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 16 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 32 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 64 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 128 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 256 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 512 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 1024 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 2048 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 4096 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 8192 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 16384 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 32768 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 65536 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 131072 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 262144 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 524288 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 1048576 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 2097152 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 4194304 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 8388608 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 16777216 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 33554432 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 67108864 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 134217728 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 268435456 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 536870912 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 1073741824 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 2147483648 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 4294967296 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 8589934592 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 17179869184 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 34359738368 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 68719476736 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 137438953472 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 274877906944 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 549755813888 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 1099511627776 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 2199023255552 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 4398046511104 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 8796093022208 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 17592186044416 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 35184372088832 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 70368744177664 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 140737488355328 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 281474976710656 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 562949953421312 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 1125899906842624 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 2251799813685248 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 4503599627370496 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 9007199254740992 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 18014398509481984 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 36028797018963968 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 72057594037927936 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 144115188075855872 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 288230376151711744 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 576460752303423488 \eTD 
> 
>  \bTR
>    \bTD[width=2.8cm, height=2.8cm] 1152921504606846976 \eTD 
>  \eTR
> 
>    \bTD[width=2.8cm, height=2.8cm] 2305843009213693952 \eTD 
> 
>    \bTD[width=2.8cm, height=2.8cm] 4611686018427387904 \eTD 
> 
> 
> \eTABLE
> \stoptext
> 
> 
> 
> How can I do for, automatically, split the number in the cells? That is, I want the numbers to fit all the cell size, not matter what return carriages it needs.
> 
> So some thing like   \bTD[width=2.8cm, height=2.8cm] 4611686018427387904 \eTD  would be transformed into:
> 
>    \bTD[width=2.8cm, height=2.8cm] 4611
> 
> 686018427
> 
> 387904 \eTD 
> 
> or something similar.
> 
> 
> Thanks,
> Xan


More information about the ntg-context mailing list