Following the example in the tcolorbox manual, p. 148, I produced the following MWE:
\documentclass[11pt]{book}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage[no-math]{fontspec}
% Define box for questions
\newtcbtheorem{exemplo}{\, Exemplo}%
{ % frame stuff
breakable,
arc=40mm,
size=normal,
enhanced,
colframe=blue,
colback=white,colbacklower=white,
borderline={0pt}{0pt}{blue!10},
% margens da frame
top=0.3cm,left=0.2cm,bottom=0.2cm,right=0.2cm,
lefttitle=0.2cm, toptitle=0.1cm,bottomtitle=0.05cm,
coltitle=blue,
fonttitle=\bfseries,
colbacktitle=blue!10,
}{ex}
\newfontfamily\cooljazz[NFSSFamily=cooljazz,BoldFont={Boogaloo Regular},Scale=0.85,Ligatures=TeX]{cooljazz}
\usepackage[subdued, defaultmathsizes]{mathastext}
\MTfamily{cooljazz}
\Mathastext[cooljazz]
% Environment for solving the questions
\newenvironment{resol}
{ \MTversion{cooljazz}\MTdonotfixfonts
\setmainfont{cooljazz}[Scale = .8, Extension = .ttf ]
}{\par}
% define grid backround
\newtcolorbox{notebook}{
enhanced,
breakable,
sharp corners,
colback=white,
colframe=white,
boxrule=0mm,top=0mm,bottom=0mm,left=0mm,right=0mm,
%left=1.3in,
underlay={%
breakable,
\begin{tcbclipinterior}
\draw[help lines,step=5mm,blue!25,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}}
}
\begin{document}
Minimum Working Example
\begin{exemplo}{Exemplo}{}
\lipsum[1-1]
\linebreak
\begin{notebook}
\begin{resol}
\lipsum[2-5]
\end{resol}
\end{notebook}
\end{exemplo}
\end{document}
The result is:
I can't align the box at the top of the page with the book class. I can with the article class, but, either way the grid box does not break across pages... Also, the last right vertical line of the grid does not show up, neither does the last horizontal bottom line... I wonder if someone has a suggestion on how to solve this....
The problem seems to be that tcolorbox
does not allow for a box inside another box to break....
Thanks in advance.
Addition:
I was able to get this effect:
Not perfect, but will do for now. The solution was to add
\begin{tcbclipinterior}
\draw[help lines, step=5mm, gray25!20, shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}}
to the exemplo
box, and then define a blank box for the heading as:
\newtcolorbox{note}{
enhanced,
breakable,
sharp corners,
colback=white,
colframe=white,
boxrule=-2.25mm,top=2mm,bottom=1mm,left=2mm,right=2mm}
It's still not perfect as the top of the grid shows up partially after the box title....
resol
box insideexemplo
which has some non zero inner margins. I'm not sure if this is the real problem but you can consider it.resol
is not a box, just an environment. But thanks anyway.