ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: h h extern <pragma@wxs.nl>
Subject: Re: Re: Current text width?
Date: Sun, 13 Mar 2005 22:39:46 +0100	[thread overview]
Message-ID: <4234B322.5020704@wxs.nl> (raw)
In-Reply-To: <422D62B8.9010606@capdm.com>

Duncan Hothersall wrote:
> I said:
> 
>> So - is there a parameter which represents the current width of the 
>> layout area, taking into account itemisations, textbackgrounds and 
>> anything else? Thanks.
> 
> 
> I came up with a rather ugly kludge which solves my immediate problem 
> but might not be best. I created a new dimen, \RealWidth, and before 
> each table I set it to the value of \textwidth minus leftskip minus 
> rightskip. In other words, I did this:
> 
> -- 
> \newdimen\RealWidth
> \definetextbackground[TestBackground]
>          [leftoffset=1em,rightoffset=1em,topoffset=8pt,
>     bottomoffset=8pt,frame=on,location=paragraph]
> \starttext
> \starttextbackground[TestBackground]
> Some text first, which behaves perfectly, and then a table:
> 
> \leavevmode\RealWidth=\textwidth\advance\RealWidth 
> by-\leftskip\advance\RealWidth by-\rightskip\bTABLE
> \setupTABLE[column][1][width=0.3\RealWidth]
> \setupTABLE[column][2][width=0.7\RealWidth]
> \bTR\bTD I was hoping\eTD
> \bTD that this table would make itself narrower according to the
> background offsets, like the text does. And now it does!\eTD\eTR
> \eTABLE}
> \stoptextbackground
> \stoptext
> -- 
> 
> This produces what I want as far as I have tested it. I'm not sure it's 
> the best or most comprehensive solution though.

kind of; an alternative is:

\startlinecorrection % needed anyway
\setlocalhsize \hsize\localhsize
\dontleavehmode \bTABLE
\setupTABLE[column][1][width=0.3\hsize]
\setupTABLE[column][2][width=0.7\hsize]
\bTR\bTD I was hoping\eTD
\bTD that this table would make itself narrower according to the
background offsets, like the text does. And now it does!\eTD\eTR
\eTABLE
\stoplinecorrection

auto adaption is kind of tricky here because

Hans

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

      reply	other threads:[~2005-03-13 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050307215318.4572E12800@ronja.ntg.nl>
2005-03-08  8:30 ` Duncan Hothersall
2005-03-13 21:39   ` h h extern [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=4234B322.5020704@wxs.nl \
    --to=pragma@wxs.nl \
    --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).