0

I have done a lot of searching but cannot figure out how to visualized the box that a piece of content falls into without shifting the content. How do you debug?

Note: How can I visualize boxes? could be a good question if it had answers that worked without lua. But, also that OP is specifically looking to outline all boxes which I am not. If I were able to get that to work, I'd probably have a whole new problem interpreting what I see.

  • I did look at that answer, but it was not useful. There's not a way to say "can I get more answers to this" so I have to ask the question differently. – Bruno Bronosky Jul 16 '18 at 18:58
  • The way would be to add a comment at the other question. And if you ask a new question at please post a link to the other one and explain what makes your question different … maybe you like to edit your question and add some more information ;-) – Tobi Jul 16 '18 at 19:00
  • Done. Thanks @Tobi. I didn't link earlier because it was a hassle as I was posting via mobile app. – Bruno Bronosky Jul 16 '18 at 20:02
  • Your welcome, and thanks for clarification. I’m not aware of other solutions with pure (La)TeX. But maybe you could explain a bit mor in detail what exactly you want to debug, at least I didn’t understand it yet – I guess … maybe you also add an MWE illustrating a thing you want to debug. – Tobi Jul 16 '18 at 21:00
  • 2
    Your question is pretty hard to understand. Can you add more detail as to what you want and a minimal working example? – Andrew Jul 18 '18 at 15:58
3

A simple \setlength{\fboxsep}{-\fboxrule} helps if you use \fbox. I sometimes use something similar to

\documentclass{article}
\setlength{\fboxsep}{-\fboxrule}
\begin{document}
\raisebox{0pt}[0pt][0pt]{\rlap{\fbox{test1}}}test2
\end{document}

enter image description here

As one can see, no issues with shifted text, test1 is exactly below test2. In case you want a more general approach, with probably other drawbacks, you can use something similar to this approach, an answer by Circumscribe to help debugging in math mode.

  • I had to add a \noindent inside the fbox, but after that it put a box around it without shifting anything. This is very helpful. Am I don't something that makes it want to indent? Can I fix that? (That's probably the biggest reason I'm having to debug.) – Bruno Bronosky Jul 16 '18 at 20:09
  • I'd still like to find a solution to visualize an existing box rather than create a new one. Creating a new one can be error prone (as demonstrated). – Bruno Bronosky Jul 16 '18 at 20:10
  • @BrunoBronosky I assume you don't use Texlive then? The provided code produces exactly the picture I posted for me, running Texlive (on Linux, though). You can, of course, create custom commands to get rid of that need (if it's indeed needed), like \newcommand{\myfbox}[1]{\fbox{\noindent#1}}. You could also store and restore the previous used \fboxsep if you want to use \fbox in your main document as well. – nox Jul 16 '18 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.