ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* sorted data in mkiv
@ 2009-05-21  9:19 Johan Sandblom
  0 siblings, 0 replies; only message in thread
From: Johan Sandblom @ 2009-05-21  9:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I am writing a booklet for use by junior doctors at the hospital where
I work. It will contain random bits of data that is available from
various online sources such as phone numbers, dosages of exotic drugs,
referral routes and assorted things better written down than
remembered. Much of it is in tabular form, and I have so far used
natural tables. It is intended to be extremely compact so I make many
adjustments to save space, such as using multiple columns where
appropriate.

Some of the things listed would benefit from being sorted such as
phone numbers, but I would still like it to be presented in a table
(with the added complication that the table will have two columns of
names}. Using pseudocode I would like it to work like this:

\phone{person c}{54321, 12345}
\phone{clinic a}{12345, 54321}
\phone{clinic c}{54321, 12345}
\phone{person b}{12345}
\phone{clinic b}{12345}
\phone{person a}{12345}

This should automatically be converted to

\bTABLE
\bTR\bTD person a\eTD\bTD 12345\eTD\bTD clinic a\eTD\bTD 12345, 54321\eTD\eTR
\bTR\bTD person b\eTD\bTD 12345\eTD\bTD clinic b\eTD\bTD 12345\eTD\eTR
\bTR\bTD person c\eTD\bTD 54321, 12345\eTD\bTD clinic c\eTD\bTD 54321,
12345\eTD\eTR
\eTABLE

presumably using something like

1. name and number added to a register
2. register is sorted on first field
3. t = total number of entries in register
4. l = number of lines in table, calculated as l=t\2 + t mod 2
3. create a table with l lines where each line has
  \bTR\bTD name(i) \eTD\bTD phone(i)\eTD\bTD name(i+l)\eTD\bTD phone(i+l)\eTR

It would not surprise me if this is implemented somewhere in ConTeXt
but I have been unable to find it. I would be very happy to see a
solution using lua, but I lack the knowledge to implement it myself.

Regards, Johan

-- 
Johan Sandblom, MD PhD
m +46735521477  Sweden
"What is wanted is not the will to believe, but the
will to find out, which is the exact opposite"
- Bertrand Russell
___________________________________________________________________________________
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:[~2009-05-21  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-21  9:19 sorted data in mkiv Johan Sandblom

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).