3

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 '19 at 15:21
  • 2
    Crosspost on goLaeX – Johannes_B Nov 11 '19 at 19:47
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}

better behaved boxes?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.