making TABLE spacing match tabulate/halign spacing
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
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
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
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
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!
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
unfortunately, enabling overlay collapses cell heights, ruining vertical alignment. Kirill
participants (3)
-
Henning Hraban Ramm
-
Kirill Davidov
-
Wolfgang Schuster