Using the tcolorbox package to produce exercises for a textbook, I use the option invisible
to let space for students for writing their solutions.
Now I want to use the help lines
in overlay commands only in the lower part, and not in the upper part, so get an upper part with blank background. How can I do this?
More, can I use a more general command for help lines
in the lower part, which inserts only horizontal lines, and not the vertical ones?
Edit: The solution given first is not useful when the exercise breaks, where we obtain the error message: ! Package pgf Error: No shape named segmentation is known.
I give an example where I make the exercise breaked:
\documentclass{book}
\usepackage{etoolbox}
\usepackage[most]{tcolorbox}
\NewTColorBox[auto counter,number within=chapter]{exercise}{m+O{}}{%
enhanced,
breakable,
colframe=green!20!black,
colback=yellow!10!white,
coltitle=green!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
\shade[inner color=green!80!yellow,outer color=yellow!10!white]
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Exercise~ \thetcbcounter:},
label={exercise:#1},
attach title to upper=\quad,
segmentation style={double=white,draw=green!20!black,double distance=1pt,solid},
lowerbox=invisible,
savelowerto=solutions/exercise-\thetcbcounter.tex,
record={\string\solution{#1}{solutions/exercise-\thetcbcounter.tex}},
#2
}
\begin{document}
\pagestyle{empty}
\tcbstartrecording
\begin{exercise}{Ex1}[coltitle=cyan!80!black]
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
Compute the derivative of the following function:
\begin{equation*}
f(x)=\sin((\sin x)^2)
\end{equation*}
\tcblower
The derivative is:
\[f^\prime(x) = \cos((\sin x)^2) 2\sin x \cos x.\]
\end{exercise}
\tcbstoprecording
\end{document}