# Breaking tcolorboxes with parcolumns

I tried to extend this class with breakable tcolorboxes. For some reason this does not work at all.

Here is my .cls file where I marked my change:

\ProvidesClass{cornell}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins,xparse}
\usepackage{parcolumns} % Used to create two columns
\usepackage{bookmark} % Add bookmarks to the resulting PDF
\usepackage[margin=2cm]{geometry} % Change geometry of pages
\usepackage{hyperref} % Default hyperref setup
\hypersetup{
urlcolor     = blue, % Colour for external hyperlinks
citecolor    = red   % Colour of citations
}

\date{}

\renewcommand{\maketitle}{%
\vspace{-3em}
\pdfbookmark[0]{\@title}{title}
\begin{tcolorbox}[width=\textwidth,lowerbox=invisible]
\Huge\sffamily \@title
\end{tcolorbox}
\vspace{2em}
}

{
\pdfbookmark[1]{Introduction}{intro}
\begin{tcolorbox}[width=\textwidth]
#1
\tcblower
#2
\end{tcolorbox}
}

\DeclareDocumentCommand\note{ o m }
{
\IfNoValueT{#1} {
\vspace{-1.5em}
}{}
\begin{parcolumns}[colwidths={1=.33\textwidth},nofirstindent]{2}
\colchunk{
\IfNoValueF{#1} {
\pdfbookmark[1]{#1}{note}
\begin{tcolorbox}[lowerbox=invisible,box align=top]
#1
\end{tcolorbox}
}{}
}
\colchunk{
\begin{tcolorbox}[enhanced,lowerbox=invisible,box align=top,breakable] % <<< HERE I ADDED BREAKABLE
#2
\end{tcolorbox}
}
\end{parcolumns}
}
\DeclareDocumentCommand\summary{ m }
{
\vfill
\pdfbookmark[1]{Summary}{summary}
\begin{tcolorbox}[
enhanced,
floatplacement=!b,
float,
colframe=black,
colupper=black,
opacitybacktitle=1,
opacitytext=1,
segmentation style={black!55,solid,opacity=0,line width=3pt},
title=Summary,
fonttitle=\large\bfseries\sffamily]
#1
\end{tcolorbox}
}


And here is a sample file:

\documentclass{cornell}

\usepackage{lipsum}

\title{A topic we're taking notes on}

\begin{document}
\maketitle

{Questions}
{
\begin{enumerate}
\item{What's the first question this section will answer?}
\item{What's the second question?}
\end{enumerate}
}

\note[Some key term]
{
\begin{itemize}
\item{A cool thing}
\item{Another cool thing}
\item{Not all things are cool}
\end{itemize}
}

\note[Another term]
{
\lipsum[4]
}
\note{\lipsum[5]}
\note{\lipsum[6-7]}

\summary{A fabulous summary.}

\note{\lipsum[6]}
\note{\lipsum[9-12]}
\note{\lipsum[10-20]}

\end{document}


When compiling this the results are really awkward.

Here should be a break across the two pages:

Here are actually breaks within a single page:

Does anyone know how to solve this issue?

I suggest to replace parcolumns package by paracol into cornell.cls.

May be you need some more adjustments, but following code worked for me:

\ProvidesClass{cornell}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins,xparse}
\usepackage{paracol} % Used to create two columns
\usepackage{bookmark} % Add bookmarks to the resulting PDF
\usepackage[margin=2cm]{geometry} % Change geometry of pages
\usepackage{hyperref} % Default hyperref setup
\hypersetup{
urlcolor     = blue, % Colour for external hyperlinks
citecolor    = red   % Colour of citations
}

\date{}

\renewcommand{\maketitle}{%
\vspace{-3em}
\pdfbookmark[0]{\@title}{title}
\begin{tcolorbox}[width=\textwidth,lowerbox=invisible]
\Huge\sffamily \@title
\end{tcolorbox}
\vspace{2em}
}

{
\pdfbookmark[1]{Introduction}{intro}
\begin{tcolorbox}[width=\textwidth]
#1
\tcblower
#2
\end{tcolorbox}
}

\DeclareDocumentCommand\note{ o m }
{
% The original cornell.cls has these lines uncommented. They cut the
% space between fragments (notes).
%    \IfNoValueT{#1} {
%        \vspace{-1.5em}
%    }{}
\columnratio{.33}
\begin{paracol}{2}
\begin{leftcolumn}
\IfNoValueF{#1} {
\pdfbookmark[1]{#1}{note}
\begin{tcolorbox}[lowerbox=invisible,box align=top]
#1
\end{tcolorbox}
}{}
\end{leftcolumn}
\begin{rightcolumn}
\begin{tcolorbox}[enhanced,lowerbox=invisible,box align=top,breakable] % <<< HERE I ADDED BREAKABLE
#2
\end{tcolorbox}
\end{rightcolumn}
\end{paracol}
}
\DeclareDocumentCommand\summary{ m }
{
\vfill
\pdfbookmark[1]{Summary}{summary}
\begin{tcolorbox}[
enhanced,
floatplacement=!b,
float,
colframe=black,
colupper=black,
opacitybacktitle=1,
opacitytext=1,
segmentation style={black!55,solid,opacity=0,line width=3pt},
title=Summary,
fonttitle=\large\bfseries\sffamily]
#1
\end{tcolorbox}
}


With previous class, the result looks like:

Second solution

In case that all left column boxes are like labels ore just a few words, it's also possible to forget the paracol package and use only a breakable and narrow tcolorbox with another box attached to the left.

The note command could be:

\DeclareDocumentCommand\note{ o m }
{
%    \IfNoValueT{#1} {
%        \vspace{-1.5em}
%    }{}
\begin{tcolorbox}[enhanced, breakable,
enlarge left by=.34\textwidth, width=.66\textwidth,
overlay={
\IfNoValueF{#1} {
\pdfbookmark[1]{#1}{note}
\node[anchor=north west, outer sep=0pt, inner sep=0pt] at ([xshift=-.34\textwidth]frame.north west) {\begin{tcolorbox}[width=.325\textwidth]#1\end{tcolorbox}};
}{}
}
]
#2
\end{tcolorbox}
}


Some adjustments have to be done to box sizes and interbox space but the result is quite similar:

• Thank you very much. That already looks a lot better. One last thing: The summary box should always float to the bottom of a page. In this version it does not do so anymore. Do you know how to fix that? Jan 27 at 16:16
• @L.Resch I will look it, but I think that my second solution is even better. And in this case, the summary is floating to the bottom of declared page. Jan 27 at 16:32
• you are correct. It looks the same but the summary floats to the bottom as well. Perfect! One last thing that bothers me though: When adding a new line into a note or summary the compilation breaks and it says "Paragraph ended before \summary was complete." Do you know the reason? Otherwise I will have to ask a new question Jan 27 at 16:39
• @L.Resch Did you try the original cornell with empty lines in notes? I think (not sure) that you cannot use command arguments with empty lines. If you accept to change from \note command to \begin{note}...\end{note} environment I can provide a solution, otherwise I cannot help. Jan 27 at 17:14
• a that makes sense. I would be fine with changing or extending the syntax as you suggest. How would you go about it then? Jan 27 at 17:46