Problem with tabulate
Hi Guys, I am trying out the following environment: \starttabulate[p(5mm)p(5mm)] \HL \NS[1][c] Wurfstärke R / H \NC\NR \NC 2 \NC 3 \NC\NR \HL \stoptabulate These are the columns of a larger table that cause problems. P() and \NS do not work together. But also \starttabulate[cc] \HL \NS[1][c] WurfstärkeR / H \NC\NR \NC 2 \NC 3 \NC\NR \HL \stoptabulate does not provide the desired result. Ideally, “R / H” should be under “Wurfstärke”, i.e. there should be a line break. (\\ doesn't work) Both in a combined cell. Then the numbers below should be centered in their separate cells. Something like this: Wurfstärke R / H 3 2 How can this be achieved? I am grateful for any advice. Greetings Thomas
Thomas Meyer schrieb am 11.11.2024 um 12:35:
Hi Guys,
I am trying out the following environment:
\starttabulate[p(5mm)p(5mm)] \HL \NS[1][c] Wurfstärke R / H \NC\NR \NC 2 \NC 3 \NC\NR \HL \stoptabulate
These are the columns of a larger table that cause problems. P() and \NS do not work together. But also
\starttabulate[cc] \HL \NS[1][c] WurfstärkeR / H \NC\NR \NC 2 \NC 3 \NC\NR \HL \stoptabulate
does not provide the desired result.
Ideally, “R / H” should be under “Wurfstärke”, i.e. there should be a line break. (\\ doesn't work) Both in a combined cell. Then the numbers below should be centered in their separate cells. Something like this:
Wurfstärke R / H 3 2
How can this be achieved? I am grateful for any advice.
Use a different table type. \starttext \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 \blank \startframed[frame=off,topframe=on,bottomframe=on,align=middle] Wurfstärke\\ R / H\\ 2\quad 3 \stopframed \stoptext Wolfgang
Hi Wolfgang, thank you very much for your help. I really don't understand the information behind \setupTABLE but unfortunately I can't find anything in the Wiki either. It only says something about \bTABLE ... Where can I find something about this? The NaturalTables.pdf listed at https://wiki.contextgarden.net/Tables_Overview under TABLES in the document footnote probably no longer exists. Greetings Thomas Am 11.11.24 um 23:52 schrieb Wolfgang Schuster:
Thomas Meyer schrieb am 11.11.2024 um 12:35:
Hi Guys,
I am trying out the following environment:
\starttabulate[p(5mm)p(5mm)] \HL \NS[1][c] Wurfstärke R / H \NC\NR \NC 2 \NC 3 \NC\NR \HL \stoptabulate
These are the columns of a larger table that cause problems. P() and \NS do not work together. But also
\starttabulate[cc] \HL \NS[1][c] WurfstärkeR / H \NC\NR \NC 2 \NC 3 \NC\NR \HL \stoptabulate
does not provide the desired result.
Ideally, “R / H” should be under “Wurfstärke”, i.e. there should be a line break. (\\ doesn't work) Both in a combined cell. Then the numbers below should be centered in their separate cells. Something like this:
Wurfstärke R / H 3 2
How can this be achieved? I am grateful for any advice.
Use a different table type.
\starttext
\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
\blank
\startframed[frame=off,topframe=on,bottomframe=on,align=middle] Wurfstärke\\ R / H\\ 2\quad 3 \stopframed
\stoptext
Wolfgang ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Am 13.11.24 um 10:33 schrieb Thomas Meyer:
I really don't understand the information behind \setupTABLE
What’s missing in https://wiki.contextgarden.net/Command/setupTABLE ?
but unfortunately I can't find anything in the Wiki either. It only says something about \bTABLE ... Where can I find something about this?
https://wiki.contextgarden.net/TABLE
The NaturalTables.pdf listed at https://wiki.contextgarden.net/ Tables_Overview under TABLES in the document footnote probably no longer exists.
Apparently not. "enattab" is now "examples-naturaltables". Hraban
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. Greetings Thomas Am 13.11.24 um 11:06 schrieb Henning Hraban Ramm:
Am 13.11.24 um 10:33 schrieb Thomas Meyer:
I really don't understand the information behind \setupTABLE
What’s missing in https://wiki.contextgarden.net/Command/setupTABLE ?
but unfortunately I can't find anything in the Wiki either. It only says something about \bTABLE ... Where can I find something about this?
https://wiki.contextgarden.net/TABLE
The NaturalTables.pdf listed at https://wiki.contextgarden.net/ Tables_Overview under TABLES in the document footnote probably no longer exists.
Apparently not. "enattab" is now "examples-naturaltables".
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Am 14.11.24 um 12:02 schrieb Thomas Meyer:
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 ...
Ah, sorry. Maybe that’s really undocumented. Either use \bTABLE with \bTR\bTD or \startTABLE with the commands from \starttabulate (probably not all of them work, I didn’t check). The latter is easier, but has less options (at the commands). You can still use \setupTABLE with its many options. Hraban
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
Thank you Hraban and many thanks Wolfgang, for your detailed explanations! Greetings Thomas Am 14.11.24 um 20:13 schrieb Wolfgang Schuster:
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
participants (3)
-
Henning Hraban Ramm
-
Thomas Meyer
-
Wolfgang Schuster