I would like to use something like framed, but where the verticals borders are fully within the margins and the position and width of the actual content is unchanged, and with support for nesting the boxes. Is there any environment that supports this? Preferably without explicitly changing attributes for every level of nesting.
[Tex/LaTex] Framed box with border inside margin
framed
Best Answer
[Edit I mentioned in my first solution that there is a fancier way to do this, so here it is.]
I am assuming that by "the verticals borders are fully within the margins and the position and width of the actual content is unchanged" you mean that the nested boxes should have the same width as the outer boxes. If this is not the case then you just need to change the values of
in the code below. Modulo my awful choice of colours, I think that you are trying to achieve something like the following:
This was done using the mdframed package and the following code:
Personally, I prefer to have the nested boxes slightly indented. For example with
you obtain: