[NTG-context] Auto width and height on table cells

Hans Hagen j.hagen at xs4all.nl
Thu Jun 30 08:16:53 CEST 2022


On 6/30/2022 7:43 AM, Angel M Alganza via ntg-context wrote:
> Hello,
> 
> I want some tables to occupy 100% of \textwidth and \textheight and for
> all columns to be the same width except one or two that I want to
> specify and for all rows to be the same height except for one or two,
> that I want to specify as well..
> For the moment, I'm doing it "manually", calculating column width as
> 
>    (\textwidth - width of fixed columns) / # rest of columns
> 
> and row height as
> 
>    (\textheight - height of fixed rows) / # rest of rows
> 
> I'm getting the result that I want, but it's a bit tedious.
> 
> Is it possible to have ConTeXt do all those calculations for me?
> I haven't been able to figure it out from the manuals and the wiki.
\starttext

\startxtable[option=stretch]
    \startxrow
        \startxcell[width=3cm,option=fixed] one \stopxcell
        \startxcell two \stopxcell
        \startxcell three \stopxcell
    \stopxrow
    \startxrow
        \startxcell a \stopxcell
        \startxcell b \stopxcell
        \startxcell c \stopxcell
    \stopxrow
\stopxtable

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list