ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] making TABLE spacing match tabulate/halign spacing
@ 2024-10-14  8:12 Kirill Davidov
  2024-10-14 17:11 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Kirill Davidov @ 2024-10-14  8:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Greetings,

TABLE uses framed extensively to make its cells. it adds all sorts of
offsets and paddings (especially vertical) to cells that annoy me
greatly. i'd like to set up TABLEs to have the same vertical spacing as
a regular tabulate table or even halign, but i keep getting lost in the
options for both TABLE and framed. which ones do i need? i'd like it to
play nice with interline spacing options as well.

MWE:

% === mwe start ===
\startsetups document:start
\setupinterlinespace[line=3.5ex]
\stopsetups

%\showboxes

\startdocument

\startcolumns[n=4]

text\blank[none]
more text\blank[none]

\columnbreak

\unprotect
\halign{%
    \hss#\tabskip=1em&\tabskip=0pt#\cr
    text&more text\cr
    more text&text\cr
}%
\protect

\columnbreak

\starttabulate[|r|l|]
\NC text \NC more text \NC\AR
\NC more text \NC text \NC\AR
\stoptabulate

\columnbreak

\start
\setupTABLE[column][1][align=flushright]%
\setupTABLE[column][2][align=flushleft]%
\bTABLE
    \bTR \bTD text \eTD \bTD more text \eTD \eTR
    \bTR \bTD more text \eTD \bTD text \eTD \eTR
\eTABLE
\stop

\stopcolumns

\stopdocument
% === mwe end ===

Kirill

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

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

* [NTG-context] Re: making TABLE spacing match tabulate/halign spacing
  2024-10-14  8:12 [NTG-context] making TABLE spacing match tabulate/halign spacing Kirill Davidov
@ 2024-10-14 17:11 ` Wolfgang Schuster
  2024-10-14 18:09   ` Kirill Davidov
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2024-10-14 17:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Kirill Davidov

Kirill Davidov schrieb am 14.10.2024 um 10:12:
> Greetings,
> 
> TABLE uses framed extensively to make its cells. it adds all sorts of
> offsets and paddings (especially vertical) to cells that annoy me
> greatly. i'd like to set up TABLEs to have the same vertical spacing as
> a regular tabulate table or even halign, but i keep getting lost in the
> options for both TABLE and framed. which ones do i need? i'd like it to
> play nice with interline spacing options as well.

You can improve the layout of natural tables (and extreme tables) when 
you set the offset value to 0pt. Horizontal space between the columns 
can be either added with the columndistance key or by adding loffset and 
roffset values.

To use \halign use \aligntab as replacement for &.

%%%% begin example
\setupinterlinespace[line=3.5ex]

\startdocument

\halign\bgroup
 
\hss\aligncontent\removeunwantedspaces\tabskip\emwidth\aligntab\tabskip\zeropoint\aligncontent\cr
   text     \aligntab more text\cr
   more text\aligntab text     \cr
\egroup


\starttabulate[|r|l|]
\NC text      \NC more text \NC\NR
\NC more text \NC text      \NC\NR
\stoptabulate

\setupTABLE[frame=off,offset=0pt,columndistance=1em,rulethickness=0pt]
\setupTABLE[column][1][align=flushright]
\setupTABLE[column][2][align=flushleft]
\bTABLE
   \bTR \bTD text      \eTD \bTD more text \eTD \eTR
   \bTR \bTD more text \eTD \bTD text      \eTD \eTR
\eTABLE

\stopdocument
%%%% end example

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
___________________________________________________________________________________

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

* [NTG-context] Re: making TABLE spacing match tabulate/halign spacing
  2024-10-14 17:11 ` [NTG-context] " Wolfgang Schuster
@ 2024-10-14 18:09   ` Kirill Davidov
  2024-10-14 18:20     ` Wolfgang Schuster
  2024-10-14 19:35     ` Henning Hraban Ramm
  0 siblings, 2 replies; 7+ messages in thread
From: Kirill Davidov @ 2024-10-14 18:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

i should have probably mentioned ahead of time that i needed this since
i wanted to replicate a booktabs style table layout with normal text
spacing, like one would have in LaTeX with the appropriate package. the
plan was to have a top/bottom rule enabled for a row. sadly it seems
like with this solution rule thickness is added no matter if the frame
is on or off.

is an equivalent negative offset added to the appropriate rows a proper
way around this? i measured the baseline skip in Inkscape, and it seems
to be correct.

Kirill


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

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

* [NTG-context] Re: making TABLE spacing match tabulate/halign spacing
  2024-10-14 18:09   ` Kirill Davidov
@ 2024-10-14 18:20     ` Wolfgang Schuster
  2024-10-14 18:49       ` Kirill Davidov
  2024-10-14 19:35     ` Henning Hraban Ramm
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2024-10-14 18:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Kirill Davidov

Kirill Davidov schrieb am 14.10.2024 um 20:09:
> i should have probably mentioned ahead of time that i needed this since
> i wanted to replicate a booktabs style table layout with normal text
> spacing, like one would have in LaTeX with the appropriate package. the
> plan was to have a top/bottom rule enabled for a row. sadly it seems
> like with this solution rule thickness is added no matter if the frame
> is on or off.
>
> is an equivalent negative offset added to the appropriate rows a proper
> way around this? i measured the baseline skip in Inkscape, and it seems
> to be correct.

You can use MetaPost to draw the table rules and keep the default lines 
at 0pt, to add
additional vertical space when needed you can use the toffset and 
boffset keys.

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
___________________________________________________________________________________

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

* [NTG-context] Re: making TABLE spacing match tabulate/halign spacing
  2024-10-14 18:20     ` Wolfgang Schuster
@ 2024-10-14 18:49       ` Kirill Davidov
  0 siblings, 0 replies; 7+ messages in thread
From: Kirill Davidov @ 2024-10-14 18:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 10/14/24 23:20, Wolfgang Schuster wrote:

> You can use MetaPost to draw the table rules and keep the default
> lines at 0pt, to add
> additional vertical space when needed you can use the toffset and
> boffset keys.
>
> Wolfgang
oh, that's wonderful. just followed the wiki tutorial on making metapost
rules and made a \toprule equivalent, thickness and all. now i just need
to put the other rules and put the whole TABLE setup into a, well,
setup. this helps greatly so far, thank you!
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* [NTG-context] Re: making TABLE spacing match tabulate/halign spacing
  2024-10-14 18:09   ` Kirill Davidov
  2024-10-14 18:20     ` Wolfgang Schuster
@ 2024-10-14 19:35     ` Henning Hraban Ramm
  2024-10-15  8:30       ` Kirill Davidov
  1 sibling, 1 reply; 7+ messages in thread
From: Henning Hraban Ramm @ 2024-10-14 19:35 UTC (permalink / raw)
  To: ntg-context

Am 14.10.24 um 20:09 schrieb Kirill Davidov:
> i should have probably mentioned ahead of time that i needed this since
> i wanted to replicate a booktabs style table layout with normal text
> spacing, like one would have in LaTeX with the appropriate package. the
> plan was to have a top/bottom rule enabled for a row. sadly it seems
> like with this solution rule thickness is added no matter if the frame
> is on or off.
> 
> is an equivalent negative offset added to the appropriate rows a proper
> way around this? i measured the baseline skip in Inkscape, and it seems
> to be correct.

To avoid the rule thickness, you usually use offset=overlay; I don’t 
know if it works with TABLE cells.

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
___________________________________________________________________________________

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

* [NTG-context] Re: making TABLE spacing match tabulate/halign spacing
  2024-10-14 19:35     ` Henning Hraban Ramm
@ 2024-10-15  8:30       ` Kirill Davidov
  0 siblings, 0 replies; 7+ messages in thread
From: Kirill Davidov @ 2024-10-15  8:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

unfortunately, enabling overlay collapses cell heights, ruining vertical alignment.

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

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

end of thread, other threads:[~2024-10-15  8:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-14  8:12 [NTG-context] making TABLE spacing match tabulate/halign spacing Kirill Davidov
2024-10-14 17:11 ` [NTG-context] " Wolfgang Schuster
2024-10-14 18:09   ` Kirill Davidov
2024-10-14 18:20     ` Wolfgang Schuster
2024-10-14 18:49       ` Kirill Davidov
2024-10-14 19:35     ` Henning Hraban Ramm
2024-10-15  8:30       ` Kirill Davidov

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