ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Stretching width in natural TABLEs
Date: Mon, 3 Sep 2012 23:57:59 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.02.1209032356320.6507@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <44EACBC6-0D5C-4B87-A724-5FAA9A866C13@emory.edu>

On Tue, 4 Sep 2012, Rogers, Michael K wrote:

>
> On Sep 3, 2012, at 9:39 PM, Aditya Mahajan wrote:
>
>> On Mon, 3 Sep 2012, Michael Rogers wrote:
>>
>>> On Sep 2, 2012, at 12:24 PM, Aditya Mahajan wrote:
>>>
>>>> Is it possible to stretch the widths of each column in natural TABLEs, so that the widths are in a certain propotion? For example, suppose I have a table with three columns and I want to set the width of the first column to a fixed amount, and split the remaining space between columns two and three in a 1:2 ratio.
>>>>
>>
>>> If you know the width of the first column and total width, then you can use arithmetic, as in the example below.  But perhaps this already occurred to you, and you were wondering if the widths and stretching can be handled automatically -- the short answer is I don't know.
>>>
>>> \starttext
>>> \setupTABLE[c][1][width={2cm}]
>>> \setupTABLE[c][2][width={\dimexpr(\textwidth-2cm)/3\relax}]
>>> \setupTABLE[c][3][width={\dimexpr(\textwidth-2cm)* 2 / 3\relax}]
>>> \startTABLE
>>> \NC One \NC Two \NC Three \NC\NR
>>> \NC A \NC B \NC C \NC\NR
>>> \stopTABLE
>>> \stoptext
>>
>> Apart from being hard to maintain, this works well if I know the width of a cell in advance. But most of the time I want something the width of the fixed column to be determined using width=fit option, so I cannot precompute the width of other columns.
>>
>> Aditya
>
> That's what I was afraid.  It's just I had the same problem last week, and a deadline made me settle for the ad hoc approach.  You made me curious enough to go look at the source, and one can hack it to work.  See below, if interested.  Not optimal, and might break in future.
>
> By the way, what you posted in your other message,
>
>> \setupTABLE[c][1][width=fit]
>> \setupTABLE[c][2][width=0.33\hsize]
>> \setupTABLE[c][3][width=0.66\hsize]
>
> extends into the right margin by the width of the first column or thereabouts, for me.

Ah, thats makes more sense. I was so happy to see the right ratio of the 
widths, that I did not notice that.

> The hack:

Thanks. I'll play around with it tomorrow.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2012-09-04  3:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-02 16:24 Aditya Mahajan
2012-09-03 18:49 ` Michael Rogers
2012-09-04  1:39   ` Aditya Mahajan
2012-09-04  3:02     ` Rogers, Michael K
2012-09-04  3:57       ` Aditya Mahajan [this message]
2012-09-04 10:09       ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-09-04  2:10 ` Aditya Mahajan

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=alpine.LNX.2.02.1209032356320.6507@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /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).