0

The following code produces three levels of nested boxes in Overleaf. Since each can have a lot of text, I need them to break between multiple pages as needed; but only some do, while others overflow the page, making them impossible to read.

I've tried many solutions, including the suggestions in the comments of this unsolved post.

Any idea?

\documentclass[10pt,twoside, a4paper]{article}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,xparse,breakable}
\tcbset{%
    breakable,
    title filled=false}
\usepackage{lipsum}
\begin{document}
\large {\textbf{Table 1.} Caption.}
\begin{tcolorbox}[breakable, enhanced, colback=white]
\centering\textbf{\Large Title}
\begin{tcolorbox}[breakable, enhanced, colback=gray!20]
{\textbf{Intro}\newline}
\lipsum[1]
\end{tcolorbox}
\begin{tcolorbox}[breakable, enhanced, colback=yellow!50]
{\textbf{First Section}\newline}
\lipsum[2]
\begin{tcolorbox}[breakable, enhanced, colback=blue!20]
{\textbf{Subsection 1.1}\newline}
\lipsum[3-5]
\end{tcolorbox}
\begin{tcolorbox}[breakable, enhanced, colback=gray!20]
{\textbf{Subsection 1.2}\newline}
\lipsum[6-7]
\end{tcolorbox}
\end{tcolorbox}
\end{tcolorbox}
\end{document}
David Carlisle
  • 757,742
  • 2
    Welcome to TeX.SX! I would be surprised if there was an easy way to make your nested boxes breakable: tcolorbox's manual states: "you cannot not nest a breakable box inside a breakable box. The breakable key for a nested box is ignored automatically, i. e. inner boxes are always unbreakable." (p. 399) – Vincent Jul 10 '23 at 01:13
  • It's not an Overleaf problem, inner boxes are not breakable as already Vincent mentioned – MadyYuvi Jul 10 '23 at 06:21
  • \large {\textbf{Table 1.} Caption.} makes the whole document large not just the caption, did you intend {\large \textbf{Table 1.} Caption.} ? – David Carlisle Jul 10 '23 at 09:49

0 Answers0