ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* colored box background
@ 2006-07-14  8:55 Hans van der Meer
  2006-07-14  9:49 ` Taco Hoekwater
  2006-07-14 10:07 ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Hans van der Meer @ 2006-07-14  8:55 UTC (permalink / raw)



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

Say I have a box, e.g. \setbox\thebox=\vbox{....} with dimensions \wd 
\thebox etc.
What then is the most efficient and economic (in terms of complexity  
and speed) way to generate a colored background for it?
I know I can use \framed, but this I wish to avoid because it seems  
overly complex for this simple task and may have side effects in  
terms of alignment issues.
Is the best perhaps using a metapost graphic? and if so, what is best  
MPgraphic, useMPgraphic, reuseMPgraphic, etc.?

Hans van der Meer




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

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: colored box background
  2006-07-14  8:55 colored box background Hans van der Meer
@ 2006-07-14  9:49 ` Taco Hoekwater
  2006-07-14 10:07 ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Taco Hoekwater @ 2006-07-14  9:49 UTC (permalink / raw)




Hans van der Meer wrote:
> Say I have a box, e.g. \setbox\thebox=\vbox{....} with dimensions 
> \wd\thebox etc.
> What then is the most efficient and economic (in terms of complexity and 
> speed) way to generate a colored background for it? 

If you really want your code to be as efficient and minimalist as
possible, you are better of with the plain format than with ConTeXt
in any case. Personally I prefer to optimize on complexity and
readability of my sources instead of on machine clock cycles.

That said, metapost graphics are, in general, heavier than \framed.
If you really need thousands and thousands of those boxes, a macro
like:

   \def\bgcolorthebox#1%
     {\dontleavehmode
      \rlap{\color[#]
         {\vrule height \ht\thebox
                 depth \dp\thebox
                 width \wd\thebox}}%
      \box\thebox }

can help. But if it is only a few, simply use \framed.


Taco

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

* Re: colored box background
  2006-07-14  8:55 colored box background Hans van der Meer
  2006-07-14  9:49 ` Taco Hoekwater
@ 2006-07-14 10:07 ` Hans Hagen
  2006-07-14 10:13   ` Taco Hoekwater
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2006-07-14 10:07 UTC (permalink / raw)


Hans van der Meer wrote:
> Say I have a box, e.g. \setbox\thebox=\vbox{....} with dimensions 
> \wd\thebox etc.
> What then is the most efficient and economic (in terms of complexity 
> and speed) way to generate a colored background for it?�
> I know I can use \framed, but this I wish to avoid because it seems 
> overly complex for this simple task and may have side effects in terms 
> of alignment issues.
> Is the best perhaps using a metapost graphic? and if so, what is best 
> MPgraphic, useMPgraphic, reuseMPgraphic, etc.?
\backgroundline[red]{...}

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: colored box background
  2006-07-14 10:07 ` Hans Hagen
@ 2006-07-14 10:13   ` Taco Hoekwater
  2006-07-14 10:24     ` luigi scarso
  2006-07-14 10:33     ` Hans van der Meer
  0 siblings, 2 replies; 6+ messages in thread
From: Taco Hoekwater @ 2006-07-14 10:13 UTC (permalink / raw)




Hans Hagen wrote:
> 
> \backgroundline[red]{...}

As you can see, there are plenty commands even I had not heard
about yet :-)

Taco

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

* Re: colored box background
  2006-07-14 10:13   ` Taco Hoekwater
@ 2006-07-14 10:24     ` luigi scarso
  2006-07-14 10:33     ` Hans van der Meer
  1 sibling, 0 replies; 6+ messages in thread
From: luigi scarso @ 2006-07-14 10:24 UTC (permalink / raw)


On 7/14/06, Taco Hoekwater <taco@elvenkind.com> wrote:
>
>
> Hans Hagen wrote:
> >
> > \backgroundline[red]{...}
>
> As you can see, there are plenty commands even I had not heard
> about yet :-)

...call for modules.pdf ?

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

* Re: colored box background
  2006-07-14 10:13   ` Taco Hoekwater
  2006-07-14 10:24     ` luigi scarso
@ 2006-07-14 10:33     ` Hans van der Meer
  1 sibling, 0 replies; 6+ messages in thread
From: Hans van der Meer @ 2006-07-14 10:33 UTC (permalink / raw)


Thanks, I will try the suggestions.

As for Taco's remark:

> If you really want your code to be as efficient and minimalist as
> possible, you are better of with the plain format than with ConTeXt
> in any case. Personally I prefer to optimize on complexity and
> readability of my sources instead of on machine clock cycles.

Yes, I from the old programming school (back to the sixties) and I  
like simple efficient and thus a bit minimalistic, code. Not because  
of the clock cycles (anymore) but because I believe the simplest code  
most often is the one with the least problems.
Regarding plain format: no I like what is possible in Context and am  
abhorred by the idea to have to find out all that by myself; but so  
now and then I am self-willed enough to do things "my way".

On Jul 14, 2006, at 12:13, Taco Hoekwater wrote:

>
>
> Hans Hagen wrote:
>>
>> \backgroundline[red]{...}
>
> As you can see, there are plenty commands even I had not heard
> about yet :-)
>
> Taco
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

met vriendelijke groet
Hans van der Meer

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

end of thread, other threads:[~2006-07-14 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14  8:55 colored box background Hans van der Meer
2006-07-14  9:49 ` Taco Hoekwater
2006-07-14 10:07 ` Hans Hagen
2006-07-14 10:13   ` Taco Hoekwater
2006-07-14 10:24     ` luigi scarso
2006-07-14 10:33     ` Hans van der Meer

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