ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Ondřej Hošek" <ondra.hosek@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Background color of table cells?
Date: Fri, 29 Jul 2011 04:02:46 +0200	[thread overview]
Message-ID: <CAJLZGmLwuZBN1n4nDAxGM5ehc2JrfVt1c+K8NMBJQ6K5eJxRAw@mail.gmail.com> (raw)
In-Reply-To: <CAPGiC77+nt58d=ih4yBQ-q++_VwYG5vpe5wzLUdyJ2ffK1H-7Q@mail.gmail.com>

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
___________________________________________________________________________________

      reply	other threads:[~2011-07-29  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  1:53 Alasdair McAndrew
2011-07-29  2:02 ` Ondřej Hošek [this message]

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=CAJLZGmLwuZBN1n4nDAxGM5ehc2JrfVt1c+K8NMBJQ6K5eJxRAw@mail.gmail.com \
    --to=ondra.hosek@gmail.com \
    --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).