[Tex/LaTex] Tcolorbox: Background color of subtitle

tcolorbox

How can I correct the transition between the background-colors? The MWE:

\documentclass[a4paper]{article}
\usepackage[scale=.85]{geometry}
\usepackage{tcolorbox,enumitem}
\tcbuselibrary{skins,xparse}

\begin{document}
\noindent

\begin{tcolorbox}[skin=bicolor,title=Main Title,
    colframe=red!75!black,colback=blue!10!white,colbacklower=green!10,width=0.5\linewidth,height=0.5\linewidth]
    The upper part. \par ~~~\par ~~~\par ~~~\par ~~~\par ~~~\par ~~~\par ~~~\par ~~~\par ~~~
\tcblower
\tcbsubtitle[before skip=\baselineskip]%
      {My subtitle}
    The lower part.
  \end{tcolorbox}


\end{document}

and the result is:

enter image description here

Thanks a lot; Harald

Best Answer

This is really wierd and is probably a bug. The hack in the code below fixes the problem to produce:

enter image description here

but I don't understand what is happening. The before skip=... is supposed to take care of this but adjusting the skip amount alone does not fix the problem. Similarly, it should be possible to do this using only a \vskip command but I could not get this to work either. I was only able to fix the problem by having both a \vskip and a before skip. Here's the hack:

\documentclass[a4paper]{article}
\usepackage[scale=.85]{geometry}
\usepackage{tcolorbox,enumitem}
\tcbuselibrary{skins,xparse}

\begin{document}
\noindent

\begin{tcolorbox}[skin=bicolor,title=Main Title,
    colframe=red!75!black,colback=blue!10!white,colbacklower=green!10,
    width=0.5\linewidth,
    height=0.5\linewidth]
    The upper part. \par ~~~\par ~~~\par ~~~\par 
    ~~~\par ~~~\par ~~~\par ~~~\par ~~~\par ~~~
\tcblower\vskip-\baselineskip
\tcbsubtitle[before skip=-\baselineskip]{My subtitle}
    The lower part.
  \end{tcolorbox}

\end{document}

You may need to adjust the \vskip amount as I think that -\baselineskip puts the subtitle a fraction too high, but using this was more asthetically pleasing than choosing a random distance.