ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Xan <xancorreu@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Split numbers in natural tables
Date: Fri, 21 Aug 2015 16:52:11 +0200	[thread overview]
Message-ID: <20150821165211.2ea80017582c91b08790bee7@gmail.com> (raw)

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
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2015-08-21 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 14:52 Xan [this message]
2015-08-21 16:43 ` Hans Hagen
2015-08-23 17:45 ` Xan

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=20150821165211.2ea80017582c91b08790bee7@gmail.com \
    --to=xancorreu@gmail.com \
    --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).