我对练习 2 中的虚线有问题,它不能正确显示(第 2、3 页的开始和结束...)。
\documentclass[11pt, a4paper]{report}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage[french]{babel}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage[top=1.cm,bottom=2.cm,left=1cm,right=1.cm,heightrounded,marginparwidth=2cm,marginparsep=7mm]{geometry}
%---------------------------------------
\newtcolorbox[auto counter]{Exercice}[2][]{%
% borderline={2pt}{0mm}{black!45},
% borderline west={1.5cm}{-1.55cm}{blue!15},
% toptitle=1pt,%bottomtitle=2pt,
% bottom=.5mm,left=1mm,right=1mm,
top=4mm,
colback=white,
colframe=blue!10,
colbacktitle=blue!10,
borderline west={1.5pt}{15.6mm}{gray},
borderline={1.5pt}{0mm}{gray},
coltitle=black,
fonttitle=\bfseries,
title=Exercice~\thetcbcounter~:\ #2,
enhanced,
leftrule=1.6cm,toprule=0pt,rightrule=0pt,bottomrule=0pt,
breakable,if odd page*={overlay broken = {
\draw[dashed,line width=1.5pt, gray, rounded corners]
(frame.south east) -- (frame.south west);}}{overlay broken = {
\draw[dashed,line width=1.5pt, gray, rounded corners]
(frame.north east) -- (frame.north west);}},
before upper={\parindent15pt},
attach boxed title to top left={yshift=-3.2mm, xshift=2.cm},
boxed title style={colframe=gray,boxrule=1.5pt},
#1% For possible options
}
%---------------------------------------
\begin{document}
\begin{Exercice}[]{}
\lipsum[1-10]
\end{Exercice}
\begin{Exercice}[]{}
\lipsum[5-12]
\end{Exercice}
\end{document}
答案1
这就是你要找的东西吗?
\documentclass[11pt, a4paper]{report}
%\usepackage{fontspec}
%\usepackage{xltxtra}
%\usepackage[french]{babel}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{tikz}
%\usepackage{xcolor} % loaded by tikz
\usepackage[top=1.cm,bottom=2.cm,left=1cm,right=1.cm,heightrounded,marginparwidth=2cm,marginparsep=7mm]{geometry}
%---------------------------------------
\newtcolorbox[auto counter]{Exercice}[2][]{
top=4mm,
colback=white,
colframe=blue!10,
colbacktitle=blue!10,
borderline west={1.5pt}{15.6mm}{gray},
borderline={1.5pt}{0mm}{gray},
coltitle=black,
fonttitle=\bfseries,
title=Exercice~\thetcbcounter~:\ #2,
enhanced,
leftrule=1.6cm,
toprule=0pt,
rightrule=0pt,
bottomrule=0pt,
breakable,
overlay first = {%
\draw[dashed,line width=1.5pt, gray, rounded corners]
(frame.south east) -- (frame.south west);
},
overlay middle = {%
\draw[dashed,line width=1.5pt, gray, rounded corners]
(frame.south east) -- (frame.south west);
\draw[dashed,line width=1.5pt, gray, rounded corners]
(frame.north east) -- (frame.north west);
},
overlay last = {%
\draw[dashed,line width=1.5pt, gray, rounded corners]
(frame.north east) -- (frame.north west);
},
before upper={\parindent15pt},
attach boxed title to top left={yshift=-3.2mm, xshift=2.cm},
boxed title style={colframe=gray,boxrule=1.5pt},
#1% For possible options
}
%---------------------------------------
\begin{document}
\begin{Exercice}[]{}
\lipsum[1-10]
\end{Exercice}
\begin{Exercice}[]{}
\lipsum[5-20]
\end{Exercice}
\end{document}