ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Current text width?
       [not found] <20050307215318.4572E12800@ronja.ntg.nl>
@ 2005-03-08  8:30 ` Duncan Hothersall
  2005-03-13 21:39   ` h h extern
  0 siblings, 1 reply; 3+ messages in thread
From: Duncan Hothersall @ 2005-03-08  8:30 UTC (permalink / raw)


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.

Duncan
dh@capdm.com

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

* Re: Re: Current text width?
  2005-03-08  8:30 ` Current text width? Duncan Hothersall
@ 2005-03-13 21:39   ` h h extern
  0 siblings, 0 replies; 3+ messages in thread
From: h h extern @ 2005-03-13 21:39 UTC (permalink / raw)


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

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

* Current text width?
@ 2005-03-07 15:28 Duncan Hothersall
  0 siblings, 0 replies; 3+ messages in thread
From: Duncan Hothersall @ 2005-03-07 15:28 UTC (permalink / raw)


Hello all.

The following code (tested at contextgarden) illustrates my current problem:

--
\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:

\vbox{\bTABLE
\setupTABLE[column][1][width=0.3\textwidth]
\setupTABLE[column][2][width=0.7\textwidth]
\bTR\bTD I was hoping\eTD
\bTD that this table would make itself narrower according to the 
background offsets, like the text does. But it doesn't.\eTD\eTR
\eTABLE}
\stoptextbackground
\stoptext
--

The key is in the spec for column widths. I would like all the widths to 
be specified proportionally, but I need the right hook. I have tried 
\textwidth and \makeupwidth but neither seem to recognise the offsets 
introduced by the background. What I'd really like is a generalised 
solution, so that all tables just work no matter where they occur.

So - is there a parameter which represents the current width of the 
layout area, taking into account itemisations, textbackgrounds and 
anything else? Thanks.

[And thanks Hans for the earlier reference to details.pdf, which I am 
still trying to understand in order to allow my tables to extend into 
the margin. I'm working on it!]

Duncan
dh@capdm.com

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

end of thread, other threads:[~2005-03-13 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20050307215318.4572E12800@ronja.ntg.nl>
2005-03-08  8:30 ` Current text width? Duncan Hothersall
2005-03-13 21:39   ` h h extern
2005-03-07 15:28 Duncan Hothersall

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