I'm taking notes about political philosophy and I've decided to use Cornell's template(https://en.wikipedia.org/wiki/Cornell_Notes). I found a template here(Cornell Notes - A lyx or latex solution needed) and that's it:
\documentclass[a4paper]{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\title{
\vspace{-3em}
\begin{tcolorbox}[colframe=white,opacityback=0]
\begin{tcolorbox}
\Huge\sffamily Cornell Notes on Something
\end{tcolorbox}
\end{tcolorbox}
\vspace{-3em}
}
\date{}
\usepackage{background}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{red}
\SetBgContents{\rule[0em]{4pt}{\textheight}}
\SetBgHshift{-2.3cm}
\SetBgVshift{0cm}
\usepackage{lipsum}% just to generate filler text for the example
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\parindent=0pt
\usepackage{xparse}
\DeclareDocumentCommand\topic{ m m g g g g g}
{
\begin{tcolorbox}[sidebyside,sidebyside align=top,opacityframe=0,opacityback=0,opacitybacktitle=0, opacitytext=1,lefthand width=.3\textwidth]
\begin{tcolorbox}[colback=red!05,colframe=red!25,sidebyside align=top,width=\textwidth,before skip=0pt]
#1.\end{tcolorbox}%
\tcblower
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth,before skip=0pt]
#2
\end{tcolorbox}
\IfNoValueF {#3}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#3
\end{tcolorbox}
}
\IfNoValueF {#4}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#4
\end{tcolorbox}
}
\IfNoValueF {#5}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#5
\end{tcolorbox}
}
\IfNoValueF {#6}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#6
\end{tcolorbox}
}
\IfNoValueF {#7}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#7
\end{tcolorbox}
}
\end{tcolorbox}
}
\def\summary#1{
\begin{tikzpicture}[overlay,remember picture,inner sep=0pt, outer sep=0pt]
\node[anchor=south,yshift=-1ex] at (current page text area.south) {%
\begin{minipage}{\textwidth}%%%%
\begin{tcolorbox}[colframe=white,opacityback=0]
\begin{tcolorbox}[enhanced,colframe=black,fonttitle=\large\bfseries\sffamily,sidebyside=true, nobeforeafter,before=\vfil,after=\vfil,colupper=black,sidebyside align=top, lefthand width=.95\textwidth,opacitybacktitle=1, opacitytext=1,
segmentation style={black!55,solid,opacity=0,line width=3pt},
title=Summary
]
#1
\end{tcolorbox}
\end{tcolorbox}
\end{minipage}
};
\end{tikzpicture}
}
\begin{document}
\maketitle
\topic{This is a question}%
{The first piece of evidence is mandatory}%
{Now add up to five\ldots}%
{\ldots additional pieces of evidence.}
\topic{Here's another question.}{\lipsum[1]}%
{\lipsum[2]}%
\summary{This is a longer box that floats to the bottom of the page.}
\topic{Here's another question to begin the new page.}{\lipsum[3]}%
{\lipsum[4]}%
{\lipsum[5]}%
\summary{And another summary that will float to the bottom of the next page.}
\end{document}
I really like it but there is a little rendering problem.

As you can see when the blue boxes are too much for the page, they are all brought to the next one. My question is whether it is possible to change the code so that just the needed box are put in the next page so that there aren't such blank spaces in the pages. In this case the code I'm using is:
\documentclass[a4paper]{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usepackage{subfiles}
\title{
\vspace{-3em}
\begin{tcolorbox}[colframe=white,opacityback=0]
\begin{tcolorbox}
\Huge\sffamily Political Philosophy
\end{tcolorbox}
\end{tcolorbox}
\vspace{-3em}
}
\date{}
\usepackage{background}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{red}
\SetBgContents{\rule[0em]{4pt}{\textheight}}
\SetBgHshift{-2.3cm}
\SetBgVshift{0cm}
\usepackage[margin=2cm]{geometry}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\parindent=0pt
\usepackage{xparse}
\DeclareDocumentCommand\topic{ m m g g g g g}
{
\begin{tcolorbox}[sidebyside,sidebyside align=top,opacityframe=0,opacityback=0,opacitybacktitle=0, opacitytext=1,lefthand width=.3\textwidth]
\begin{tcolorbox}[colback=red!05,colframe=red!25,sidebyside align=top,width=\textwidth,before skip=0pt]
#1.\end{tcolorbox}%
\tcblower
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth,before skip=0pt]
#2
\end{tcolorbox}
\IfNoValueF {#3}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#3
\end{tcolorbox}
}
\IfNoValueF {#4}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#4
\end{tcolorbox}
}
\IfNoValueF {#5}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#5
\end{tcolorbox}
}
\IfNoValueF {#6}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#6
\end{tcolorbox}
}
\IfNoValueF {#7}{
\begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth]
#7
\end{tcolorbox}
}
\end{tcolorbox}
}
\def\summary#1{
\begin{tikzpicture}[overlay,remember picture,inner sep=0pt, outer sep=0pt]
\node[anchor=south,yshift=-1ex] at (current page text area.south) {%
\begin{minipage}{\textwidth}%%%%
\begin{tcolorbox}[colframe=white,opacityback=0]
\begin{tcolorbox}[enhanced,colframe=black,fonttitle=\large\bfseries\sffamily,sidebyside=true, nobeforeafter,before=\vfil,after=\vfil,colupper=black,sidebyside align=top, lefthand width=.95\textwidth,opacitybacktitle=1, opacitytext=1,
segmentation style={black!55,solid,opacity=0,line width=3pt},
title=Further readings
]
#1
\end{tcolorbox}
\end{tcolorbox}
\end{minipage}
};
\end{tikzpicture}
}
\begin{document}
\maketitle
\subfile{parts/utilitarism}
\end{document}
and
\documentclass[../main.tex]{subfiles}
\begin{document}
\topic{\textbf{UTILITARISM}}%
{\textit{Utilitarianism}, in its simplest formulation, claims that the morally right act or policy is that which \textit{maximize utility}.}%
\topic{Utilitarism's attraction: it's a secular theory}%
{Utilitarism is made by and for humans without the helping hands of God or other concepts like that}%
\topic{Utilitarism's attraction: it's a consequentialist theory}
{It requires that we check to see whether the act or policy in question actually does some identifiable good or not.
It demands of anyone who condemns something as morally wrong that they show who is wronged, i.e. they must show how someone's life is made worse off. Likewise, consequential ism says that something is morally good only if it makes someone's life better off.}%
\topic{Definition of utility: welfare hedonism}%
{We may say that the experience or sensation of pleasure is the chief human good.}%
{It is a bad description of utility because we may prefer sensations other than pleasure in certain moments of our life; also this would arguably lead to the idea that a machine which makes you happy should always be used(Nozick's objection).}%
\topic{Definition of utility: non-hedonistic mental-state utility} %
{In response to the objection against welfare hedonism we may try saying that many different kinds of experiences are valuable, and that we should promote the entire range of valuable mental states.}%
{But this doesn't solve Nozick's objection if this is reformulated to include the possibility to induce any mental state as desired.}%
\topic{Definition of utility: preference satisfaction} %
{A third option is the 'preference-satisfaction' account of utility. On this view, increasing people's utility means satisfying their preferences, whatever they are.}%
{But we could argue that satisfying our preferences does not always contribute to our well-being.
We may regret what we have preferred: because people want to have or do the things which are worth having or doing, and this may be different from what they currently prefer to have or do. The first is what matters to us, not the second(Dworkin's objection).
Also, people may adapts their preference, a well established problem in psychology.}%
\topic{Definition of utility: informed preference satisfaction} %
{The fourth account of utility tries to accommodate the problem of mistaken and adaptive preferences by defining welfare as the satisfaction of 'rational' or 'informed' preferences.}%
{Even though it is an unobjectionable account, it is extremely vague and difficult to apply or measure; how do we know what preferences people would have if they were informed and rational?
Also, while having to choose between two goods, these may be incommensurable.
Furthermore, informed preferences can be satisfied, and hence our utility
increased on this fourth account, without it ever affecting our conscious
experiences. Richard Hare, for example, argues that my life goes worse if my
spouse commits adultery, even if I never come to know of it.}%
\summary{The machine objection by Nozick has been developed in "Anarchy, State, and Utopia".
Dworkin's objection to the preference satisfaction account of utility is developed in "Right-wing women" and in "Sovereign Virtue".}
\end{document}
If you try to compile it(especially if you compile just the subfile to ignore the big title), you'll that a blank space is left between the pages. This is due to the fact that if the blue boxes of a red box are too long for the page, all the blue boxes are brung to the next page. I'd like to move just the blue boxes that are needed.
tcolorboxes intcolorboxesin a minipage within atikznode... this is not healthy – Jan 13 '19 at 17:57