5

When I type something like

\bTABLE
\bTR\bTD abc\eTD\bTD abcdefg\eTD\eTR
\bTR\bTD 123456789\eTD\bTD 1234\eTD\eTR
\eTABLE

in ConTeXt, it automatically sets the column widths to fit the text contained within, like so:

What I want

This is the exactly the output that I want to see. The problem I have is that, in some documents, I use the \setupTABLE command elsewhere to set the TABLE width manually. After I've done that, I don't know how to revert back to this default behaviour. This is what I mean:

What I don't want

What's the proper way of achieving the effect I'm looking for?

3

The standard way to deal with this is to use setups:

\startsetups name
   \setupTABLE[...][...]
    ....
\stopsetups

where name can be any string.

Then, you can use

\bTABLE[setups=name]
 ....
\eTABLE

and context will apply the setup name. You can even define multiple setups and select them using

\bTABLE[setups={one, two}]
 ....
\eTABLE

etc.

  • Hi Aditya. That's an interesting feature. I didn't know it before. I'm going to +1 your answer. With my original question though, I was wondering how one would specify auto-fit table width EXPLICITLY inside a setup, (thus reverting the previous width setting) like \setupTABLE[width=automatic] or something. I tried searching for it and couldn't find it anywhere. Either that, or some way of removing the previous \setupTABLE---I don't know if ConTeXt has something like \resetTABLEsetup. I'll award the Accepted Answer to someone who knows how to do either. – HazySmoke Mar 11 '14 at 0:17
3

You can keep the effect of \setupTABLE using it after \bTABLE

\starttext

\bTABLE
\bTR\bTD abc\eTD\bTD abcdefg\eTD\eTR
\bTR\bTD 123456789\eTD\bTD 1234\eTD\eTR
\eTABLE



\bTABLE
\setupTABLE[c][each][width=1in]
\bTR\bTD 1inch\eTD\eTR
\eTABLE


\bTABLE
\bTR\bTD This\eTD\bTD more\eTD\eTR
\bTR\bTD like\eTD\bTD it\eTD\eTR
\eTABLE

\stoptext

enter image description here

  • I edited your answer so that it matches with the ConTeXt style. I hope that you don't mind the edit. – Aditya Mar 5 '14 at 5:08
  • @Aditya Thanks for the edit! Of course I don't mind it :) – Gonzalo Medina Mar 5 '14 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.