修改代码,使“锻炼”标题不出现在下一页

修改代码,使“锻炼”标题不出现在下一页

请修改代码,这样如果练习的内容太长,下一页上就不会出现“练习”的标题

  \documentclass[a4paper,12pt]{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm }
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[left=3cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows,shapes,shadows.blur,shapes.symbols,positioning}
\usepackage{lipsum}
\renewcommand*\sfdefault{ugq}
%============================================
%======================================
\definecolor{pBlue}{RGB}{102, 53, 153}
%==================================
%==========================================================
\definecolor{myblue}{HTML}{1D2A6E}
\definecolor{myred}{HTML}{A97E77}
\definecolor{mybrown}{HTML}{B35823}
\definecolor{gold}{HTML}{B48920}
\definecolor{myorange}{HTML}{ED8C2B}
\definecolor{col}{RGB}{45, 136, 119}
\definecolor{MainRed}{rgb}{.8, .1, .1}
\definecolor{winered}{rgb}{0.5,0,0}
%==========================================================
\def\cola{pink!50!purple}
\def\colb{cyan!80!blue}
%==================================================
\definecolor{titleboxcolor}{RGB}{199,232,250}
\definecolor{darkblue}{RGB}{59,134,215}
%===================================
%=========================================
%===========================================
\makeatletter
\newtcolorbox[auto counter]{exo}[2][]{%
enhanced, 
breakable,
before skip=1.5cm ,
after skip=1.5cm ,
colback=white,
frame hidden,
top=.75cm,
attach boxed title to top left, 
boxed title style={empty},
overlay={%
\begin{scope}
\node[circle,fill=\cola!90!black,minimum size=8mm] (circ) at (frame.north west) {};
\node[fill=\cola,anchor=west,minimum height=8mm,minimum width=2.5cm,font=\large\bfseries\color{white}] at (circ) {Exercice};
\node[fill=white,line width=2pt,circle,draw=\cola,minimum size=1cm,right=1.9cm of circ,font=\LARGE\sffamily\color{black!20!teal}] (num) {\thetcbcounter};
\node[rounded rectangle, rounded rectangle west arc=0pt, minimum height=0.7cm,fill=black!20!teal,font=\large\bfseries\color{white}, drop shadow={opacity=.5,shadow xshift=0pt},right=.5cm of num]  {#2};
%=====================
\draw[line width=1.5pt, black!20!teal]
([shift={(-20pt, 13pt)}]frame.north west) coordinate (iniPoint)
-- (iniPoint|-frame.south west)
-- ([xshift=-30pt]frame.south east)
to[out=0, in=-90] ([yshift=30pt]frame.south east)
-- (frame.north east) -- ++(-2.5, 0) coordinate (endPoint) -- ++(-3pt, 3pt) -- ++(-3pt, -3pt)
-- ++(3pt, -3pt) -- (endPoint);
\draw[line width=1.5pt, black!20!teal] ([xshift=4pt]iniPoint) -- ++(-8pt, 0);
\draw [line width=1.5pt, black!20!teal] (iniPoint) ++(-6pt, -10pt) -- ++(12pt, 0);
\draw[line width=1.5pt, black!20!teal] (iniPoint) ++(-6pt, -14pt)-- ++(12pt, 0);
\end{scope} 
}, 
#1
}
\makeatother

\begin{document}
    
\begin{exo}{Séries numériques}
Étudier la convergence des séries numériques de termes généraux suivants: 

\[ 
\begin{array}{lllll}
\displaystyle \mathbf 1.\ u_n=\frac{n}{3^n}&&\displaystyle \mathbf 2.\ u_n=\frac{(-1)^n }{n^{2}}&&\displaystyle \mathbf 3.\  \ u_n=\frac{e^n}{2^{n}+1}\\
\end{array}
\]
\end{exo}


\begin{exo}{Suites de fonctions} 
    Soit $f_{n}(x)=\frac{\sin\left(nx\right)}{1+n^{2}\,x^{2}}$ pour $x\in\mathbb{R}$. 
    \begin{enumerate}
        \item Montrer que $(f_{n})$ converge simplement sur $\mathbb{R}$ vers la fonction $f\equiv 0$.
        \item La suite de fonctions $(f_{n})$ converge-t-elle uniformément vers $f$? 
    \end{enumerate}
    
\end{exo}

\begin{exo}{Equations différentielles}
    Résoudre les équations différentielles suivantes:
    \begin{enumerate}
        \item $\displaystyle{y'-3 y = \textrm{e}^{x}} $
        \item $\displaystyle{y''+2 y' - 3y = \textrm{e}^{-x}}$
    \end{enumerate}
\end{exo}


\end{document}

在此处输入图片描述

答案1

如果您要允许breakable,则需要分别定义overlay unbroken未破损的覆盖,以及overlay first,,overlay middle以及overlay last如果盒子破损会发生什么。

请尝试以下步骤开始(尽管可能需要进行各种更改):

\newtcolorbox[auto counter]{exo}[2][]{%
enhanced, 
breakable,
before skip=1.5cm ,
after skip=1.5cm ,
colback=white,
frame hidden,
top=.75cm,
attach boxed title to top left,
boxed title style={empty},
%%%% The original overlay you specified is used as "overlay unbroken"
overlay unbroken={%
\begin{scope}
\node[circle,fill=\cola!90!black,minimum size=8mm] (circ) at (frame.north west) {};
\node[fill=\cola,anchor=west,minimum height=8mm,minimum width=2.5cm,font=\large\bfseries\color{white}] at (circ) {Exercice};
\node[fill=white,line width=2pt,circle,draw=\cola,minimum size=1cm,right=1.9cm of circ,font=\LARGE\sffamily\color{black!20!teal}] (num) {\thetcbcounter};
\node[rounded rectangle, rounded rectangle west arc=0pt, minimum height=0.7cm,fill=black!20!teal,font=\large\bfseries\color{white}, drop shadow={opacity=.5,shadow xshift=0pt},right=.5cm of num]  {#2};
%=====================
\draw[line width=1.5pt, black!20!teal]
([shift={(-20pt, 13pt)}]frame.north west) coordinate (iniPoint)
-- (iniPoint|-frame.south west)
-- ([xshift=-30pt]frame.south east)
to[out=0, in=-90] ([yshift=30pt]frame.south east)
-- (frame.north east) -- ++(-2.5, 0) coordinate (endPoint) -- ++(-3pt, 3pt) -- ++(-3pt, -3pt)
-- ++(3pt, -3pt) -- (endPoint);
\draw[line width=1.5pt, black!20!teal] ([xshift=4pt]iniPoint) -- ++(-8pt, 0);
\draw [line width=1.5pt, black!20!teal] (iniPoint) ++(-6pt, -10pt) -- ++(12pt, 0);
\draw[line width=1.5pt, black!20!teal] (iniPoint) ++(-6pt, -14pt)-- ++(12pt, 0);
\end{scope} 
}, 
%%%% overlay first is almost the same as overlay unbroken, but
%%%%  without the bottom line and the curved bottom right corner.
overlay first={%
\begin{scope}
\node[circle,fill=\cola!90!black,minimum size=8mm] (circ) at (frame.north west) {};
\node[fill=\cola,anchor=west,minimum height=8mm,minimum width=2.5cm,font=\large\bfseries\color{white}] at (circ) {Exercice};
\node[fill=white,line width=2pt,circle,draw=\cola,minimum size=1cm,right=1.9cm of circ,font=\LARGE\sffamily\color{black!20!teal}] (num) {\thetcbcounter};
\node[rounded rectangle, rounded rectangle west arc=0pt, minimum height=0.7cm,fill=black!20!teal,font=\large\bfseries\color{white}, drop shadow={opacity=.5,shadow xshift=0pt},right=.5cm of num]  {#2};
%=====================
\draw[line width=1.5pt, black!20!teal]
([shift={(-20pt, 13pt)}]frame.north west) coordinate (iniPoint)
-- (iniPoint|-frame.south west);
\draw[line width=1.5pt, black!20!teal] (frame.south east)
-- (frame.north east) -- ++(-2.5, 0) coordinate (endPoint) -- ++(-3pt, 3pt) -- ++(-3pt, -3pt)
-- ++(3pt, -3pt) -- (endPoint);
\draw[line width=1.5pt, black!20!teal] ([xshift=4pt]iniPoint) -- ++(-8pt, 0);
\draw [line width=1.5pt, black!20!teal] (iniPoint) ++(-6pt, -10pt) -- ++(12pt, 0);
\draw[line width=1.5pt, black!20!teal] (iniPoint) ++(-6pt, -14pt)-- ++(12pt, 0);
\end{scope} 
},
%%%% overlay middle just draws lines on the left and right sides
overlay middle={%
        \draw[line width=1.5pt, black!20!teal] ([xshift=-20pt]frame.north west)--([xshift=-20pt]frame.south west);
        \draw[line width=1.5pt, black!20!teal] (frame.north east)--(frame.south east);
},
%%%% overlay last is copied from overlay unbroken, but just draws the 
%%%% left and right sides, plus the bottom right corner curve.
overlay last={%
\draw[line width=1.5pt, black!20!teal]
([xshift=-20pt]frame.north west) -- ([xshift=-20pt]frame.south west)
-- ([xshift=-30pt]frame.south east)
to[out=0, in=-90] ([yshift=30pt]frame.south east)
-- (frame.north east);
},
#1
}

相关内容