5

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~ 
+------+----------+
|      |          |
|      |          |
|      |          |
|      |          |
+------+----------+
2

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

  • Thanks for your help! I found another (quite simple) solution yesterday, see post. – Grabu Jul 17 '18 at 6:46
1

I ended up using tcolorbox for both columns, nested in a paracol environment, such that

\documentclass[10pt, a4paper]{report}

\usepackage{lipsum}
\usepackage{geometry}
\usepackage[skins,breakable]{tcolorbox}
\usepackage{paracol}

\geometry{a4paper, left=5mm, right=20mm, top=15mm, bottom=25mm}

\begin{document}

\setcolumnwidth{34mm, 10cm}
\setlength{\columnsep}{7mm}

\begin{paracol}{2}
    \begin{tcolorbox}[blanker, breakable, width=\linewidth]
        \lipsum[1-5]
    \end{tcolorbox}
    \switchcolumn
    \begin{tcolorbox}[blanker, breakable, width=\linewidth]
        \lipsum[1-10]
    \end{tcolorbox}
\end{paracol}

\end{document}
  • 1
    why do you use tcolorbox? paracol already breaks columns. – Ignasi Jul 23 '18 at 12:04
  • Because I want the text to be justified and I wasn't able to do so only with paracol (I had especially problems with the smaller left column). I therefore use tcolorbox only for justifying the text. – Grabu Jul 23 '18 at 16:56

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.