Adding border/frame around boxes
1,070
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.
Related videos on Youtube
Author by
Uiy
Updated on May 12, 2020Comments
-
Uiy over 3 years
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.
-
David Carlisle over 11 yearsIt 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.
-
Uiy over 11 years@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.
-
David Carlisle over 11 yearsThere 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. -
Uiy over 11 years@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 over 11 yearsThe 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?
-
David Carlisle over 11 years"you want me to come up with a MWE of a package?" As has been explained before you need an example of the problem, not of the solution. In this case a MWE would have been a complete document using the package and a description of which boxes you'd like to become visible. You may want a general answer but sometimes (as here) you are bumping up against the limits of the system and there is no general answer.
-
Jake over 11 years@Uiy: I can see your point, but it would be nice if you could try to see that of others: The point of this site is to solve concrete problems. From the FAQ "You should only ask practical, answerable questions based on actual problems that you face." Broad questions like this one, where you only add new information once a proposed answer doesn't work for you just waste people's time.
-
-
Uiy over 11 yearsunfortunately 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)