我想让 TCOLORBOX 中的奇数页和偶数页有所不同

我想让 TCOLORBOX 中的奇数页和偶数页有所不同
%===== SOURCE CODE in tcolorbox manual(page 84) ===========

\colorlet{colexam}{red!75!black}
\newtcolorbox[use counter=example]{myexample}{%
empty,title={Example \thetcbcounter},attach boxed title to top left,
boxed title style={empty,size=minimal,toprule=2pt,top=4pt,
overlay={\draw[colexam,line width=2pt]
([yshift=-1pt]frame.north west)--([yshift=-1pt]frame.north east);}},
coltitle=colexam,fonttitle=\Large\bfseries,
before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=0pt,right=3mm,top=4pt,
breakable,pad at break*=0mm,vfill before first,
overlay unbroken={\draw[colexam,line width=1pt]
([yshift=-1pt]title.north east)--([xshift=-0.5pt,yshift=-1pt]title.north-|frame.east)
--([xshift=-0.5pt]frame.south east)--(frame.south west); },
overlay first={\draw[colexam,line width=1pt]
([yshift=-1pt]title.north east)--([xshift=-0.5pt,yshift=-1pt]title.north-|frame.east)
--([xshift=-0.5pt]frame.south east); },
overlay middle={\draw[colexam,line width=1pt] ([xshift=-0.5pt]frame.north east)
--([xshift=-0.5pt]frame.south east); },
overlay last={\draw[colexam,line width=1pt] ([xshift=-0.5pt]frame.north east)
--([xshift=-0.5pt]frame.south east)--(frame.south west);},%
}
\begin{myexample}
\lipsum[1]
\end{myexample}

%===========================================================

但是,上述源代码来自奇数页。

**我想让奇数页和偶数页的对称性不同!!**请告诉我需要在源代码中的哪里修复它。

答案1

我想这就是你想要的,可破坏的盒子也会根据奇数页和偶数页切换:

\documentclass{report}
\usepackage{lipsum}
\usepackage[skins,breakable]{tcolorbox}
\colorlet{colexam}{red!75!black}
\newcounter{example}
\newtcolorbox[use counter=example]{myexample}{%
empty,
title={Example \thetcbcounter},
attach boxed title to top left,
boxed title style={
enhanced jigsaw,
size=minimal,
toprule=2pt,
top=4pt,
colframe=colexam,
colback=white
},
coltitle=colexam,
fonttitle=\Large\bfseries,
before=\par\medskip\noindent,
parbox=false,
boxsep=0pt,
left=0pt,
right=3mm,
top=4pt,
breakable,
pad at break*=0mm,
vfill before first,
if odd page*={
overlay unbroken={\draw[colexam,line width=1pt]
([yshift=-1pt]title.north east)--([xshift=-0.5pt,yshift=-1pt]title.north-|frame.east)
--([xshift=-0.5pt]frame.south east)--(frame.south west); },
overlay first={\draw[colexam,line width=1pt]
([yshift=-1pt]title.north east)--([xshift=-0.5pt,yshift=-1pt]title.north-|frame.east)
--([xshift=-0.5pt]frame.south east); },
overlay middle={\draw[colexam,line width=1pt] ([xshift=-0.5pt]frame.north east)
--([xshift=-0.5pt]frame.south east); },
overlay last={\draw[colexam,line width=1pt] ([xshift=-0.5pt]frame.north east)
--([xshift=-0.5pt]frame.south east)--(frame.south west);}
}{
overlay unbroken={\draw[colexam,line width=1pt]
([yshift=\tcboxedtitleheight-1pt]frame.north east)--([yshift=-1pt]title.north east) ([xshift=-0.5pt]title.north west)--(frame.south west)--(frame.south east);},
overlay first={\draw[colexam,line width=1pt]
([yshift=\tcboxedtitleheight-1pt]frame.north east)--([yshift=-1pt]title.north east)
([xshift=-0.5pt]title.north west)--(frame.south west);},
overlay middle={\draw[colexam,line width=1pt] ([xshift=-0.5pt]frame.north west)
--([xshift=-0.5pt]frame.south west); },
overlay last={\draw[colexam,line width=1pt] ([xshift=-0.5pt]frame.north west)
--([xshift=-0.5pt]frame.south west)--(frame.south east);}
}
}


\begin{document}
\begin{myexample}
\lipsum[1-16]
\end{myexample}\clearpage\null\clearpage
\begin{myexample}
\lipsum[1-16]
\end{myexample}
\begin{myexample}
\lipsum[1]
\end{myexample}\clearpage
\begin{myexample}
\lipsum[1]
\end{myexample}
\end{document}

在此处输入图片描述 在此处输入图片描述

相关内容