When I set the parbox
option of a tcolorbox
to false
, every section, even the first one, is preceded with additional whitespace. Is there any way to tell tcolorbox
to handle the first section
(subsection
, …) in the same way as the first section
on a page is treated, that is without additional space? That is, the following two boxes should look the same independent of the parbox
option.
\documentclass{article}
\usepackage[many]{tcolorbox}
\begin{document}
\begin{tcolorbox}[parbox=false]
\section{Test}
\end{tcolorbox}
\begin{tcolorbox}
\section{Test}
\end{tcolorbox}
\end{document}
Best Answer
It work as you want it if one removes the
\noindent
and\leavevmode
(inserted by tcolorbox) from\@parboxrestore
. But as I don't understand why tcolorbox tries so hard to switch to horizontal mode at the start of the box I don't know if this has unwanted side-effects: