0
%===== 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}

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

But, The above source code is from odd pages.

**I want to make the symmetry different for odd and even pages!! ** Please tell me where I need to fix it in the source code.

2
  • 2
    You've gone to a lot of trouble to make your "figures" show what you want, but I don't understand them. Could you elaborate on what you're trying to do? Could you also make your source code display properly?
    – Teepeemm
    Commented Mar 5 at 17:23
  • 3
    Section "4.22 even and odd pages" in tcolorbox documentation explains how to define different options for even and odd pages.
    – Ignasi
    Commented Mar 5 at 18:21

1 Answer 1

0

I think this is what you want, the breakable boxes also switched based on odd and even page:

\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}

enter image description here enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .