[NTG-context] How to create cell data that spans four rows in a table?

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sun Jan 9 12:38:46 CET 2022


Willi Egger via ntg-context schrieb am 08.01.2022 um 23:57:
> I would suggest not to use \starttable at all.
> 
> To me the most suitable table environment for such a table is \bTABLE \eTABLE. It gives you all kind of control over layout, dimensions, frames on and off etc.


I agree natural tables or extreme tables are the better choice for this 
table layout but it can be improved.


1. Keep the layout/settings local.

To ensure the \setupTABLE settings don't affect other tables you can 
either put \start and \stop at the begin and end of the table, e.g.

	\start
	\setupTABLE[...]
	\bTABLE
	...
	\eTABLE
	\stop

or put the settings in a setup-environment and load them on a pertable 
basis, e.g.

	\startsetups[fancytable]
	\setupTABLE[...]
	\stopsetups
	\bTABLE[setups=fancytable]
	...
	\eTABLE


2. Font changes are local to cells

When you apply a font switch to the whole content of a table cell there 
is no need to put braces around the text, e.g.

	\bTD \bf ... \eTD

can be used without problem. When you make this change for a table 
header and the result is bold text there is a even simpler method 
because a special cell type exists here, e.g.

	\bTH ... \eTH

creates bold text.


3. Simple markup

For natural tables with short texts in each cell there exists a simple 
mode which uses \starttable inspired markup with the short \NC and \NR 
commands to mark the start of each cell and row.

The example table of the OP can be written like below.

\starttext

\startsetups [tableframe]
     \setupTABLE [c] [1]    [leftframe=off,width=40mm]
     \setupTABLE [c] [2]    [rightframe=off, width=60mm]
     \setupTABLE [c] [each] [align={lohi,center}]
\stopsetups

\startTABLE[setups=tableframe]
\NC \bf Eons              \NC \bf Eras             \NC\NR
\NC Hadeon Eon            \NC                      \NC\NR
\NC[ny=4] Archanon Eon    \NC Eoarchean Era        \NC\NR
\NC                           Paleoarchean Era     \NC\NR
\NC                           Mesoarchean Era      \NC\NR
\NC                           Neoarchean Era       \NC\NR
\NC[ny=3] Proterozoic Eon \NC Paleoproterozoic Era \NC\NR
\NC                           Mesoproterozoic Era  \NC\NR
\NC                           Neoproterozoic Era   \NC\NR
\NC[ny=3] Phanerozoic Eon \NC Paleozoic Era        \NC\NR
\NC                           Mesozoic Era         \NC\NR
\NC                           Cenozoic Era         \NC\NR
\stopTABLE

\stoptext

Wolfgang



More information about the ntg-context mailing list