ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to create cell data that spans four rows in a table?
       [not found] <1716703798.1835455.1641677975773.ref@mail.yahoo.com>
@ 2022-01-08 21:39 ` Joel via ntg-context
  2022-01-08 22:57   ` Willi Egger via ntg-context
  2022-01-09  4:55   ` Aditya Mahajan via ntg-context
  0 siblings, 2 replies; 5+ messages in thread
From: Joel via ntg-context @ 2022-01-08 21:39 UTC (permalink / raw)
  To: ntg-context; +Cc: Joel


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

I created a table that has some cells span multiple rows. This works good with cells that span an odd-number of rows, but when I try to span 4 rows, the text isn't quite vertically centered. How can I get the cell with the text "Archaeon Eon" to be a little lower, so it is centered within its box?
--Joel
Minimum working example:
\starttext

\starttable[|c|c|]
\NC {\bf Eons} \NC {\bf Eras} \NC \AR
\HL
\NC Hadeon Eon \VL \NC \AR
\HL
\NC \VL Eoarchean Era \NC \AR
\DC \DL[1] \DR
\NC \smash{Archaeon Eon} \VL Paleoarchean Era \NC \AR
\DC \DL[1] \DR
\NC \VL Mesoarchean Era \NC \AR
\DC \DL[1] \DR
\NC \VL Neoarchean Era \NC \AR

\HL\NC \VL Paleoproterozoic Era \NC \AR
\DC \DL[1] \DR
\NC Proterozoic Eon \VL Mesoproterozoic Era \NC \AR
\DC \DL[1] \DR
\NC \VL Neoproterozoic Era \NC \AR
\HL


\HL\NC \VL Paleozoic Era \NC \AR
\DC \DL[1] \DR
\NC Phanerozoic Eon \VL Mesozoic Era \NC \AR
\DC \DL[1] \DR
\NC \VL Cenozoic Era \NC \AR
\HL
\stoptable

\stoptext



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

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

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create cell data that spans four rows in a table?
  2022-01-08 21:39 ` How to create cell data that spans four rows in a table? Joel via ntg-context
@ 2022-01-08 22:57   ` Willi Egger via ntg-context
  2022-01-09  3:51     ` Joel via ntg-context
  2022-01-09 11:38     ` Wolfgang Schuster via ntg-context
  2022-01-09  4:55   ` Aditya Mahajan via ntg-context
  1 sibling, 2 replies; 5+ messages in thread
From: Willi Egger via ntg-context @ 2022-01-08 22:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Willi Egger

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.

\setupTABLE[c][1][leftframe=off,width=40mm]
\setupTABLE[c][2][rightframe=off, width=60mm]
\setupTABLE[c][each][align={lohi,center}]
\bTABLE
	\bTR
		\bTD {\bf Eons}\eTD \bTD {\bf Eras} \eTD
	\eTR
	\bTR
		\bTD  Hadeon Eon \eTD \bTD \eTD
	\eTR
	\bTR
		\bTD[ny=4] Archanon Eon  \eTD \bTD Eoarchean Era \eTD
	\eTR
	\bTR
		\bTD Paleoarchean Era \eTD
	\eTR
	\bTR
		\bTD Mesoarchean Era \eTD 
	\eTR
	\bTR
		\bTD Neoarchean Era \eTD
	\eTR
	\bTR
		\bTD[ny=3] Proterozoic Eon \eTD	\bTD Paleoproterozoic Era \eTD
	\eTR
	\bTR	
		\bTD Mesoproterozoic Era \eTD
	\eTR
	\bTR
		\bTD Neoproterozoic Era\eTD
	\eTR
	\bTR
		\bTD[ny=3] Phanerozoic Eon \eTD \bTD Paleozoic Era \eTD
	\bTR	
		 \bTD Mesozoic Era\eTD
	\eTR
	\bTR
		\bTD Cenozoic Era \eTD
	\eTR
\eTABLE

Willi

> On 8 Jan 2022, at 22:39, Joel via ntg-context <ntg-context@ntg.nl> wrote:
> 
> I created a table that has some cells span multiple rows. This works good with cells that span an odd-number of rows, but when I try to span 4 rows, the text isn't quite vertically centered. How can I get the cell with the text "Archaeon Eon" to be a little lower, so it is centered within its box?
> 
> --Joel
> 
> Minimum working example:
> 
> \starttext
> 
> \starttable[|c|c|]
> \NC {\bf Eons} \NC {\bf Eras} \NC \AR
> \HL
> \NC Hadeon Eon \VL \NC \AR
> \HL
> \NC \VL Eoarchean Era \NC \AR
> \DC \DL[1] \DR
> \NC \smash{Archaeon Eon} \VL Paleoarchean Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Mesoarchean Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Neoarchean Era \NC \AR
> 
> \HL\NC \VL Paleoproterozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC Proterozoic Eon \VL Mesoproterozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Neoproterozoic Era \NC \AR
> \HL
> 
> 
> \HL\NC \VL Paleozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC Phanerozoic Eon \VL Mesozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Cenozoic Era \NC \AR
> \HL
> \stoptable
> 
> \stoptext
> 
> 
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create cell data that spans four rows in a table?
  2022-01-08 22:57   ` Willi Egger via ntg-context
@ 2022-01-09  3:51     ` Joel via ntg-context
  2022-01-09 11:38     ` Wolfgang Schuster via ntg-context
  1 sibling, 0 replies; 5+ messages in thread
From: Joel via ntg-context @ 2022-01-09  3:51 UTC (permalink / raw)
  To: Willi Egger via ntg-context; +Cc: Joel


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

 Thank you! The code is much easier to understand than the other way I was trying to use.
--Joel

    On Saturday, January 8, 2022, 04:00:12 PM MST, Willi Egger via ntg-context <ntg-context@ntg.nl> wrote:  
 
 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.

\setupTABLE[c][1][leftframe=off,width=40mm]
\setupTABLE[c][2][rightframe=off, width=60mm]
\setupTABLE[c][each][align={lohi,center}]
\bTABLE
    \bTR
        \bTD {\bf Eons}\eTD \bTD {\bf Eras} \eTD
    \eTR
    \bTR
        \bTD  Hadeon Eon \eTD \bTD \eTD
    \eTR
    \bTR
        \bTD[ny=4] Archanon Eon  \eTD \bTD Eoarchean Era \eTD
    \eTR
    \bTR
        \bTD Paleoarchean Era \eTD
    \eTR
    \bTR
        \bTD Mesoarchean Era \eTD 
    \eTR
    \bTR
        \bTD Neoarchean Era \eTD
    \eTR
    \bTR
        \bTD[ny=3] Proterozoic Eon \eTD    \bTD Paleoproterozoic Era \eTD
    \eTR
    \bTR    
        \bTD Mesoproterozoic Era \eTD
    \eTR
    \bTR
        \bTD Neoproterozoic Era\eTD
    \eTR
    \bTR
        \bTD[ny=3] Phanerozoic Eon \eTD \bTD Paleozoic Era \eTD
    \bTR    
        \bTD Mesozoic Era\eTD
    \eTR
    \bTR
        \bTD Cenozoic Era \eTD
    \eTR
\eTABLE

Willi

> On 8 Jan 2022, at 22:39, Joel via ntg-context <ntg-context@ntg.nl> wrote:
> 
> I created a table that has some cells span multiple rows. This works good with cells that span an odd-number of rows, but when I try to span 4 rows, the text isn't quite vertically centered. How can I get the cell with the text "Archaeon Eon" to be a little lower, so it is centered within its box?
> 
> --Joel
> 
> Minimum working example:
> 
> \starttext
> 
> \starttable[|c|c|]
> \NC {\bf Eons} \NC {\bf Eras} \NC \AR
> \HL
> \NC Hadeon Eon \VL \NC \AR
> \HL
> \NC \VL Eoarchean Era \NC \AR
> \DC \DL[1] \DR
> \NC \smash{Archaeon Eon} \VL Paleoarchean Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Mesoarchean Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Neoarchean Era \NC \AR
> 
> \HL\NC \VL Paleoproterozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC Proterozoic Eon \VL Mesoproterozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Neoproterozoic Era \NC \AR
> \HL
> 
> 
> \HL\NC \VL Paleozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC Phanerozoic Eon \VL Mesozoic Era \NC \AR
> \DC \DL[1] \DR
> \NC \VL Cenozoic Era \NC \AR
> \HL
> \stoptable
> 
> \stoptext
> 
> 
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki    : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki    : http://contextgarden.net
___________________________________________________________________________________
  

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

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

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create cell data that spans four rows in a table?
  2022-01-08 21:39 ` How to create cell data that spans four rows in a table? Joel via ntg-context
  2022-01-08 22:57   ` Willi Egger via ntg-context
@ 2022-01-09  4:55   ` Aditya Mahajan via ntg-context
  1 sibling, 0 replies; 5+ messages in thread
From: Aditya Mahajan via ntg-context @ 2022-01-09  4:55 UTC (permalink / raw)
  To: Joel via ntg-context; +Cc: Aditya Mahajan

On Sat, 8 Jan 2022, Joel via ntg-context wrote:

> I created a table that has some cells span multiple rows. This works good with cells that span an odd-number of rows, but when I try to span 4 rows, the text isn't quite vertically centered. How can I get the cell with the text "Archaeon Eon" to be a little lower, so it is centered within its box?

I would also recommend natural tables. But, for tables, you can use \Lower(dims){....} to improve vertical alignment. For example:

\starttext

\starttable[|c|c|]
\NC {\bf Eons} \NC {\bf Eras} \NC \AR
\HL
\NC Hadeon Eon \VL \NC \AR
\HL
\NC \VL Eoarchean Era \NC \AR
\DC \DL[1] \DR
\NC \Lower(1\lineheight){Archaeon Eon} \VL Paleoarchean Era \NC \AR
\DC \DL[1] \DR
\NC \VL Mesoarchean Era \NC \AR
\DC \DL[1] \DR
\NC \VL Neoarchean Era \NC \AR

\HL\NC \VL Paleoproterozoic Era \NC \AR
\DC \DL[1] \DR
\NC Proterozoic Eon \VL Mesoproterozoic Era \NC \AR
\DC \DL[1] \DR
\NC \VL Neoproterozoic Era \NC \AR
\HL


\HL\NC \VL Paleozoic Era \NC \AR
\DC \DL[1] \DR
\NC Phanerozoic Eon \VL Mesozoic Era \NC \AR
\DC \DL[1] \DR
\NC \VL Cenozoic Era \NC \AR
\HL
\stoptable

\stoptext


Aditya
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to create cell data that spans four rows in a table?
  2022-01-08 22:57   ` Willi Egger via ntg-context
  2022-01-09  3:51     ` Joel via ntg-context
@ 2022-01-09 11:38     ` Wolfgang Schuster via ntg-context
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2022-01-09 11:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Willi Egger via ntg-context
  Cc: Wolfgang Schuster, Willi Egger

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

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-09 11:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1716703798.1835455.1641677975773.ref@mail.yahoo.com>
2022-01-08 21:39 ` How to create cell data that spans four rows in a table? Joel via ntg-context
2022-01-08 22:57   ` Willi Egger via ntg-context
2022-01-09  3:51     ` Joel via ntg-context
2022-01-09 11:38     ` Wolfgang Schuster via ntg-context
2022-01-09  4:55   ` Aditya Mahajan via ntg-context

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