I just need nested boxes in latex. Like this:
with the following constraints:
- the outermost box (black) will never be larger than \textwidth or pagewidth
- there is never more than one box in a row
I've already tried all kinds of fboxes, makeboxes, colorboxes, stacks etc. This comes close, but it still has the problem with several boxes in a row.
Here is a MWE:
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\begin{document}
{\fboxrule=.75pt%
\fbox{\stackunder{Box 1 }
{
\fbox{\stackunder{ Box 2 }{
\fbox{\stackunder{ Box 4 }{}}
}}
\fbox{\stackunder{ Box 3 }{}}
}
}
}
\end{document}
How can I get box 3 under box 2 and limit the entire width to the pagesize?