4

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

2
  • It works as expected for me, if I remove the empty lines from the \newtcolorbox call's argument.
    – Skillmon
    Nov 10, 2019 at 15:21
  • 2
    Crosspost on goLaeX
    – Johannes_B
    Nov 11, 2019 at 19:47

1 Answer 1

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

better behaved boxes?

1
  • Perfect, exactly what I was looking for. Thanks very much @cfr Nov 13, 2019 at 20:10

You must log in to answer this question.

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