ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Background color of table cells?
@ 2011-07-29  1:53 Alasdair McAndrew
  2011-07-29  2:02 ` Ondřej Hošek
  0 siblings, 1 reply; 2+ messages in thread
From: Alasdair McAndrew @ 2011-07-29  1:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 914 bytes --]

I'm setting up a table, for which I'd like the first column to have a
background of a middle gray.  According to the wiki, something like this
should work:

\starttable[|p(4cm)|p(11.75cm)|]
  \HL
  \BL[1]\AR
  \VL\tfa{\bf A bit of text}\VL A lot of text, which will be broken up into
several lines\VL\AR
  \HL
\stoptable

There are two problems here: (1) the background covers only the line of "A
bit of text" and not the entire cell, and (2) the background color is too
light.

I experimented with this from the wiki:

\starttabulate[|CR{red}c|CC{yellow}c|CM{green}c|CL{blue}c|]
   \NC test \NC test \NC test \NC test \NC \NR
   \NC test \NC test \NC test \NC test \NC \NR
   \NC test \NC test \NC test \NC test \NC \NR
   \NC test \NC test \NC test \NC test \NC \NR
\stoptabulate

but it produced no colors at all (and yes, I do have colors turned on).

How can I achieve the effect I'm after?

Thanks,
Alasdair

[-- Attachment #1.2: Type: text/html, Size: 2163 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

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

* Re: Background color of table cells?
  2011-07-29  1:53 Background color of table cells? Alasdair McAndrew
@ 2011-07-29  2:02 ` Ondřej Hošek
  0 siblings, 0 replies; 2+ messages in thread
From: Ondřej Hošek @ 2011-07-29  2:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Jul 29, 2011 at 03:53, Alasdair McAndrew <amca01@gmail.com> wrote:
> I'm setting up a table, for which I'd like the first column to have a
> background of a middle gray.  According to the wiki, something like this
> should work:
>
> \starttable[|p(4cm)|p(11.75cm)|]
>   \HL
>   \BL[1]\AR
>   \VL\tfa{\bf A bit of text}\VL A lot of text, which will be broken up into
> several lines\VL\AR
>   \HL
> \stoptable
>
> There are two problems here: (1) the background covers only the line of "A
> bit of text" and not the entire cell, and (2) the background color is too
> light.
>
> I experimented with this from the wiki:
>
> \starttabulate[|CR{red}c|CC{yellow}c|CM{green}c|CL{blue}c|]
>    \NC test \NC test \NC test \NC test \NC \NR
>    \NC test \NC test \NC test \NC test \NC \NR
>    \NC test \NC test \NC test \NC test \NC \NR
>    \NC test \NC test \NC test \NC test \NC \NR
> \stoptabulate
>
> but it produced no colors at all (and yes, I do have colors turned on).
>
> How can I achieve the effect I'm after?
>
> Thanks,
> Alasdair

Not sure how to do it with all the other table interfaces (what is
their deprecation status anyway?), but:

% set background of first (1) column (c) to gray
\setupTABLE[c][1][background=color,backgroundcolor=gray]

\bTABLE

\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR
\bTR \bTD test \eTD \bTD test \eTD \bTD test \eTD \bTD test \eTD \eTR

\eTABLE

The syntax looks rather familiar if you've ever constructed tables in
HTML. You may wish to define your own color (before setupTABLE, and
replacing "gray" with "myowngray" there):

\definecolor[myowngray][s=0.3]

"s=" defines a grayscale color; 0 is black, 1 is white. Of course, you
may choose a different name.

Cheers,
~~ Ondra
___________________________________________________________________________________
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
___________________________________________________________________________________

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

end of thread, other threads:[~2011-07-29  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29  1:53 Background color of table cells? Alasdair McAndrew
2011-07-29  2:02 ` Ondřej Hošek

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