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
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
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 -----------------------------------------------------------------
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
participants (4)
-
Hans Hagen
-
Hans van der Meer
-
luigi scarso
-
Taco Hoekwater