T-F-S / tcolorbox

A LaTeX package to create highly customizable colored boxes.
http://www.ctan.org/pkg/tcolorbox
LaTeX Project Public License v1.3c
213 stars 15 forks source link

breakable option and tcbdocmarginnote / tcolorbox inside of marginnote #281

Open mkm-gh opened 2 weeks ago

mkm-gh commented 2 weeks ago

When using the breakable option in a margin note (tcbdocmarginnote or tcolorbox inside of marginnote) and the box is „pushed“ to a new page, the layout is broken. Please see the minimal example below.

This may be related to the known issues of the marginnote package.

\documentclass{article}

\usepackage{lipsum}

\usepackage{marginnote}

\usepackage[most]{tcolorbox}
%\usepackage[most,documentation]{tcolorbox}

\begin{document}

\lipsum[1-5]

%\clearpage % This dirty fix resolves the issue

\section{A}
Text
\marginnote{\begin{tcolorbox}[breakable] % breakable causes the problem
A
\end{tcolorbox}}
Text

% The following is also broken

%\section{A}
%Text
%\tcbdocmarginnote[breakable]{ % breakable causes the problem
%A
%}
%Text

\end{document}
muzimuzhi commented 2 weeks ago

According to package manual of marginnote, sec. 2 Issues Using marginnote:

No page break can occur within a margin note created using the \marginnote command.

So using breakable tcolorbox in \marginnote is meaningless. The broken layout may be caused by wrong detection of remaining page height triggered by breakable option.