ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Thomas Meyer <thomasgmeyer@t-online.de>
Subject: [NTG-context] Re: Problem with tabulate
Date: Thu, 14 Nov 2024 20:13:18 +0100	[thread overview]
Message-ID: <3a988866-d930-2a6a-3340-7e36e6758399@gmail.com> (raw)
In-Reply-To: <ce27ec32-12b7-4e5b-947f-ebed51ecb9e8@t-online.de>


[-- Attachment #1.1: Type: text/plain, Size: 3426 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 4553 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2024-11-14 19:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 11:35 [NTG-context] " Thomas Meyer
2024-11-11 22:52 ` [NTG-context] " Wolfgang Schuster
2024-11-13  9:33   ` Thomas Meyer
2024-11-13 10:06     ` Henning Hraban Ramm
2024-11-14 11:02       ` Thomas Meyer
2024-11-14 11:08         ` Henning Hraban Ramm
2024-11-14 19:13         ` Wolfgang Schuster [this message]
2024-11-15  8:52           ` Thomas Meyer

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=3a988866-d930-2a6a-3340-7e36e6758399@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=thomasgmeyer@t-online.de \
    /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).