[Tex/LaTex] How to make overlay of tcolorbox span over multiple pages

columnspage-breakingtcolorbox

I want to span two columns of (mainly) text over mutliple pages (to create a CV). I found a solution in How to make minipage spanning multiple pages which is almost exactly what I want to do.

However, in the statet solution, the left column only spans over the first page, so that

+-----------------+
|      Header     |
+------+----------+
|      |          |
|      |          |
| side |   Body   |
| bar  |          |
|      |          |
|      |          |
|      |          |
+------+----------+
       ~pagebreak~ 
       +----------+
       |          |
       |          |
       |          |
       |          |
       +----------+

If the content of the side bar exceeds the space of one page, it will not be broken to the next page. How can I modify the code (the overlay part) of the statet solution

\documentclass{article}
\usepackage[skins,breakable]{tcolorbox}
\usepackage{lipsum}% example texts
\begin{document}

\textcolor{red}{Header} %  <------------------------
\lipsum[1]

\begin{tcolorbox}[
  blanker,
  width=0.64\textwidth,enlarge left by=0.36\textwidth,
  before skip=6pt,
  breakable,
  overlay unbroken and first={%
    \node[inner sep=0pt,outer sep=0pt,text width=0.33\textwidth,
      align=none,
      below right]
      at ([xshift=-0.36\textwidth]frame.north west)
  {%
    \textcolor{red}{Sidebar} %  <------------------------
    \lipsum[2]
  };}]
\textcolor{red}{Body}: %  <------------------------
\lipsum[3-7]
\textcolor{red}{End of body}
\end{tcolorbox}

\end{document}

to break the content of the side bar over two (or multiple) columns, so that it will look like

+-----------------+
|      Header     |
+------+----------+
|      |          |
|      |          |
| side |   Body   |
| bar  |          |
|      |          |
|      |          |
|      |          |
+------+----------+
    ~pagebreak~ 
+------+----------+
|      |          |
|      |          |
|      |          |
|      |          |
+------+----------+

Best Answer

This is a manual solution and valid when body in broken only in two parts.

It uses magazine library to break a text in parts and store them to be used later (see its origin in tcolorbox: Can one store the parts of a breakable tcolorbox for later use?).

I don't know how to know the height of body's first fragment in order to used when fragmenting sidebar. Therefore I have used some trial and error tests until I've found the final value. When the sidebar is divided in two fragments and stored into an array, we can use these fragment in overlay nodes for unbroken and first and last overlay options.

\documentclass{article}
\usepackage[most]{tcolorbox} %<--- change to most to include magazine.
\usepackage{lipsum}% example texts
\begin{document}

\begin{tcolorbox}[
    blanker,
    width=0.33\textwidth,
    breakable,
    break at=14cm/0pt,
    reset box array,
    store to box array]
    \textcolor{red}{Sidebar} %  <------------------------
    \lipsum[2-3]
\end{tcolorbox}


\textcolor{red}{Header} %  <------------------------
\lipsum[1]

\begin{tcolorbox}[
  blanker,
  width=0.64\textwidth,enlarge left by=0.36\textwidth,
  before skip=6pt,
  breakable,
  overlay unbroken and first={%
    \node[inner sep=0pt,outer sep=0pt,text width=0.33\textwidth,
      align=none,
      below right]
      at ([xshift=-0.36\textwidth]frame.north west)
  {%
    \useboxarray{1}
  };},
  overlay last={%
    \node[inner sep=0pt,outer sep=0pt,text width=0.33\textwidth,
      align=none,
      below right]
      at ([xshift=-0.36\textwidth]frame.north west)
  {%
    \useboxarray{2}
  };},
  ]
\textcolor{red}{Body}: %  <------------------------
\lipsum[3-7]
\textcolor{red}{End of body}
\end{tcolorbox}

\end{document}

enter image description here

Related Question