tcolorbox:可破坏框中的彩色边距

tcolorbox:可破坏框中的彩色边距

也许我没表达清楚。在下面的例子中

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

第二页的可拆分部分的边距向右移动,但我喜欢它有适当的边距,就像第二页的第二个框一样

答案1

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

表现更好的盒子?

相关内容