# tcolorbox: Colored margins in breakable box

Maybe I haven't made myself clear. In the following example

\documentclass{scrbook}

\usepackage{tcolorbox}
\usepackage{lipsum}
\tcbuselibrary{skins}
\usepackage{calc}
\usetikzlibrary{patterns}
\tcbuselibrary{skins,breakable}

\newtcolorbox{mybox}{
enhanced,
breakable,
toggle left and right,
colback=white,
rightrule=3cm,
if odd page={right skip=-3cm}{left skip=-3cm},
colframe = gray!50
}

\begin{document}

\begin{mybox}
\lipsum
\end{mybox}

Anyway

\begin{mybox}
\lipsum[1]
\end{mybox}

\end{document}


the margin of the breakable part on the second page is shifted to right, but I like it in the proper margin as in the second box on page 2

\documentclass{scrbook}

\usepackage{tcolorbox}
\usepackage{lipsum}
\tcbuselibrary{skins,breakable}

\newtcolorbox{mybox}{
enhanced,
breakable,
toggle left and right,
colback=white,
rightrule=3cm,
if odd page={right skip=-3cm}{left skip=-3cm},
colframe = gray!50,
extras middle and last={if odd page={right skip=-3cm}{left skip=-3cm},}
}

\begin{document}

\begin{mybox}
\lipsum
\end{mybox}

Anyway

\begin{mybox}
\lipsum[1]
\end{mybox}

\end{document}


• Perfect, exactly what I was looking for. Thanks very much @cfr – Peter Buechel Nov 13 '19 at 20:10