[NTG-context] Re: Current text width?
Duncan Hothersall
dh at capdm.com
Tue Mar 8 09:30:48 CET 2005
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 at capdm.com
More information about the ntg-context
mailing list