# Adding border/frame around boxes [closed]

I'm trying to modify a package to suit my needs but since I'm not very familar with the tex macro language I would like to add a border around the boxes created by the package so I can see exactly what they are doing.

The code that allocates the boxes is

\setbox0\box\csname pc@column@\number\count@\endcsname%
\csname pc@column@width@\number\count@\endcsname\z@%

\vbox{\unvbox\@tempboxa}%


and I'd like to simply put a frame around it or even give it a unique semi-opaque background color.

• It would be easier to suggest code if your question included a working example. You have two code snippets but they are not consistent, you show box0 being assigned to be a copy of the box with name \pc@column@<value of count@> but you don't show how that box is used, you just show the box \@tempboxa being used. As you didn't like the lua suggestion it is important to see the use as most ways of adding rules or colour would break some usage and not others, so it all depends. May 11, 2012 at 13:23
• @DavidCarlisle I need an inline method and the code I showed is irrelevant. It was just an example of code where a box was used and I would like to wrap it right at that point. The first two lines set the box register and probalby are not relevant. The lua code, as I said, puts a box around everything... it does virtually the same as just including the showframe package but more work. I don't want to show every bounding box of every frame as it is just showing too many things I'm not interested in seeing.
– Uiy
May 11, 2012 at 13:53
• There is no way of adding frames that will not break some usage, so if you do not show the usage the question can not be answered. You can change \setbox0\hbox{...} to \setbox0\hbox{\fbox{...}} and that puts rules around the box but if the usage is as you show with \unvbox then the extra fbox box will prevent the contents being unboxed and the package will fail to work. If you put colour in and the code tries to use \lastbox then the colour special will hide the box and \lastbox will be null. That is why people request MWE the question (especially this one) are not answerable otherwise. May 11, 2012 at 14:04
• @David Carlisle The question is answerable. I'm asking a general question bout putting a visual box around a bounding box. You want me to give you a specific MWE to the problem and there isn't one. I am trying to work with parcolumns. If you want an MWE then go edit that style to get the colored boxes. I have no MWE because I'm editing that code to learn it... you want me to come up with a MWE of a package?
– Uiy
May 11, 2012 at 14:25
• The problem is that you want to answer a very specific question when I want a general answer... in your response you gave a general answer... it may or may not work and you gave some examples to try. That's all I want... to be pointed in the right direction but not dragged to some specific point. If we were fishing and I grabbed the rod from you to show you how to do it would you like that or get much out of it or would you rather just be given some "pointers" then figure it out yourself?
– Uiy
May 11, 2012 at 14:28

## 1 Answer

The new(ish) lua-visual-debug package might be your friend here

tex.stackexchange.com/questions/2083/how-can-i-visualize-boxes

As that hooks the visible markings in at a later stage it can avoid problems that occur if you try to add rules to the boxes, where the debugging rules and colour inadvertently affect other aspects of the typesetting.

• unfortunately this adds to many boxes and I'm not quire sure which one the code snippet is referring too. (since several overlap on 3 sides)
– Uiy
May 11, 2012 at 13:12