Thomas Meyer schrieb am 14.11.2024 um
12:02:
Hi Hraban,
Wolfgangs example
\start
\setupTABLE[start][frame=off,width=11mm,align=middle,offset=0pt]
\setupTABLE[row][first][topframe=on]
\setupTABLE[row][last][bottomframe=on]
\startTABLE
\NC[nc=2] Wurfstärke\\ R / H \NC\NR
\NC 2 \NC 3 \NC\NR
\stopTABLE
\stop
seems to be a mixture of
\starttabulate
\NC \NC \NC\NR ...
and
\setupTABLE
\bTABLE
\bTR \bTD ...
For that what Wolfgang wrote I found nothing in the wiki.
No explanation for \start nor width nor the mixture(?) above ...
Perhaps Wolfgang can also comment on that.
1. \startTABLE
The \startTABLE environment I used in my example is just a wrapper for
\bTABLE which saves typing for short/small tables.
In the following example both tables produce the same results because
the first table is converted into the code used by the second table.
%%%% begin example
\starttext
\startTABLE
\NC table content \NC\NR
\stopTABLE
\bTABLE
\bTR \bTD table content \eTD \eTR
\eTABLE
\stoptext
%%%% end example
2. Table settings
When you use the \bTABLE environment each cell is a \framed block where
you can set the width or height, framecolor etc.
%%%% begin example
\starttext
\bTABLE
\bTR \bTD[width=2cm,height=2cm,framecolor=red,align={middle,lohi}] table
content \eTD \eTR
\eTABLE
\startframed[width=2cm,height=2cm,framecolor=red,align={middle,lohi}]
table content \stopframed
\stoptext
%%%% end example
3. \setupTABLE
With the \setupTABLE command you can change the values which are used to
format the cells of the table.
With the first two optional arguments you can control whether settings
are applied only to certain table rows or columns but also for certain
cells (e.g. row 3 column 2).
%%%% begin example
\starttext
\setupTABLE[framecolor=red]
\bTABLE
\bTR \bTD first table \eTD \eTR
\eTABLE
\stoptext
%%%% end example
4. \start
When you use the \setupTABLE command like shown below the settings are
applied to all the following tables.
%%%% begin example
\starttext
\setupTABLE[framecolor=red]
\bTABLE
\bTR \bTD first table \eTD \eTR
\eTABLE
\bTABLE
\bTR \bTD second table \eTD \eTR
\eTABLE
\stoptext
%%%% end example
To ensure the new color for the frame is only applied to the first table
add \start before you change the value with \setupTABLE and \stop after
the table.
When you do this you create a local group where the changed frame color
is kept local to the group.
%%%% begin example
\starttext
\start
\setupTABLE[framecolor=red]
\bTABLE
\bTR \bTD first table \eTD \eTR
\eTABLE
\stop
\bTABLE
\bTR \bTD second table \eTD \eTR
\eTABLE
\stoptext
%%%% end example
When you have multiple tables with the same style you don't want to
change the table values each time by hand.
The method of choice here is to collect all changes to the table layout
in a \startsetups block (the argument is just a name for the block) and
load it afterwards at the start of the table with the setups key.
%%%% begin example
\starttext
\startsetups [redtableframe]
\setupTABLE[framecolor=red]
\stopsetups
\bTABLE[setups=redtableframe]
\bTR \bTD first table \eTD \eTR
\eTABLE
\bTABLE
\bTR \bTD second table \eTD \eTR
\eTABLE
\stoptext
%%%% end example
Wolfgang